Re: Update Command in MYSQL

From: Date: Mon, 31 Jul 2000 13:26:05 +0000
Subject: Re: Update Command in MYSQL
Groups: php.db 
Request: Send a blank email to php-db+get-1642@lists.php.net to get a copy of this message
Quotes are allways a problem in a query with array values. Try split the query assambling it in parts to avoid having nested quotes. Like: $query = "UPDATE $table SET Monday = \'" . $mon["$count"] ; $query .= "\', Tuesday = \'" . $tues["$count"] ; and so on ... I hope this helps. Jayme. -----Mensagem original----- De: Nashirak Bosk <nashirak@mindspring.com> Para: php-db@lists.php.net <php-db@lists.php.net> Data: Segunda-feira, 31 de Julho de 2000 01:29 Assunto: [PHP-DB] Update Command in MYSQL >I am having trouble updating my database. My table has all varchar(25) >except for the Number column which is an int . <cut> > 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 > > > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net >For additional commands, e-mail: php-db-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#1642) next »