Update Command in MYSQL

From: Date: Mon, 31 Jul 2000 04:35:11 +0000
Subject: Update Command in MYSQL
Groups: php.db 
Request: Send a blank email to php-db+get-1634@lists.php.net to get a copy of this message
I am having trouble updating my database. My table has all varchar(25) except for the Number column which is an int . I have localized my problem to the actual query I give to the database. In Particular I think it may be my Number column. This is a snipet of my code. All the arrays come from the previous form. // Define all MYSQL Variables $host = "localhost"; $username = "username"; $password = "password"; $database = "database"; $table = "table"; // Conect to the database MYSQL_CONNECT ($host) or DIE ("Unable to connect to databse"); @mysql_select_db("$database") or DIE ("Unable to select database"); // Set all counters to 0 for flag pruposes $count = 0; while ($count < $i-1) { MYSQL_QUERY ("UPDATE $table SET Monday = '$mon[$count]', Tuesday = '$tues[$count]' , Wednesday = '$wed[$count]' , Thursday = '$thur[$count]' , Friday = '$fri[$count]' , Saturday = '$sat[$count]' WHERE Number = $num[$count]"); // Update Counters $count++; } MYSQL_CLOSE (); ?> <br><br> <center><h1>All records have been updated<h1></center> </body> </html> I have tried displaying my query before it is sent and it seemed to be fine. I wanted to make sure so I copied and pasted my query into a manually opened MYSQL connection and it updated what I wanted!?!? I have also tried takning the arrays out of the query, but still no luck. If anyone could help me out with this that would be great. Nashirak

« previous php.db (#1634) next »