Ok, figured it out. I was using an int for the field but the value was too large for it. I used bigint instead and life is suddenly so much better. Well it helps that its bright and sunny here too :) On Sun, Apr 19, 2009 at 10:37 AM, mrfroasty <mrfroasty@xxxxxxxxx> wrote: > Try using var_export() or var_dump() to debug to see why that 1st time is > having different values than what you want.... :-) > The idea from the sample code I have provided is not to use phone as id... > > P:S > A wild guess would phone is some sort of string..... > > GR > mrfroasty > > > > Rij wrote: >> >> Ok. But that still doesn't tell me why I am getting the behavior from >> my code. Where is the garbage value coming from? And why only the >> first time I do an INSERT? >> >> To Daniel Carrera, thanks for your tip. I sure will look up your >> suggestion. >> >> On Sun, Apr 19, 2009 at 2:32 AM, mrfroasty <mrfroasty@xxxxxxxxx> wrote: >> >>> >>> Hello, >>> >>> May be try something like this: >>> >>> $query1= >>> CREATE TABLE contacts( >>> id int(16) NOT NULL auto_increment, >>> phone varchar(15) NOT NULL, >>> name varchar(15) NOT NULL, >>> address varchar(15) NOT NULL, >>> PRIMARY KEY (id) >>> ); >>> >>> $query2 = "INSERT INTO contacts VALUES ('NULL','$phone', '$name', >>> '$address')"; >>> >>> P:S >>> id incremented automatically by MYSQL now >>> >>> GR >>> mrfroasty >>> >>> >>> >>> >> >> > > > -- > Extra details: > OSS:Gentoo Linux-2.6.25-r8 > profile:x86 > Hardware:msi geforce 8600GT asus p5k-se > location:/home/muhsin > language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS > Typo:40WPM > url:http://mambo-tech.net > url:http://blog.mambo-tech.net > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php