Hi, I'm struggling with some php code. I'm trying to insert some info into a mysql DB. I beleive I'm failing on the SQL statement, specifically the WHERE syntax. Can anyone help? ------------ bypass = 0 --confirmed $i = 0 works and inserts into the DB. $i=1 works, but doesn't insert into DB.
------------- if ($bypass==0){ // Add picks: this is ugly! if ($i==0){ echo " i equals zero"; $sql = "INSERT INTO picks (u_id, p_1) VALUES ('$u_id','$s_id0')"; $result = mysql_query ($sql); } elseif ($i==1){ echo "i equals one"; printf ("u_id equals %s\n",$u_id); $sql = "INSERT INTO picks (p_2) VALUES ('$s_id1')WHERE picks.u_id=$u_id"; $result = mysql_query ($sql,$db); } --------------- The phppool.picks looks like (with more p_*): mysql> select u_id,p_1,p_2,p_3 from phppool.picks -> ; +------+-----+-----+-----+ | u_id | p_1 | p_2 | p_3 | +------+-----+-----+-----+ | 1 | 2 | 0 | 0 | | 2 | 1 | 0 | 0 | | 3 | 7 | 0 | 0 | | 4 | 7 | 0 | 0 | | 0 | 0 | 2 | 0 | | 5 | 2 | 0 | 0 | +------+-----+-----+-----+ 6 rows in set (0.00 sec) Any help would be greatly appreciated. I know the code is ugly. I haven't coded in a few years, and this is my first php program. Jordan -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]