Insert VALUES('') cant accept variable
Posted by: jason chan
Date: October 22, 2011 02:38AM

Hi,

I have a table with ip and time stamp

I would like to update the database if (a = b)

int a = 2;
int b = 2;

if (a == b)
{ mysql_query(connect,"insert into ipstat values(('b'),1,now())on duplicate key update hits=hits+1");
}

I have a primary key in the table having ID's 1 and 2. The problem here is that in the values('b') section, it does not recognize it as 2 and hence does not update the time stamp. However,If i physically put a values('2') it recognizes i have a ID 2 in the table and updates the time stamp.

How can i allow it to read the variable b as 2 for my case?

Thanks in advance

Jason

Options: ReplyQuote


Subject
Views
Written By
Posted
Insert VALUES('') cant accept variable
1120
October 22, 2011 02:38AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.