problem in updating in PHP
I want to update some fields of my table. In order to do it I use the following command in phpmyadmin which works fine:
UPDATE tamrin SET tamrin.A =60 WHERE Team LIKE 'Pas' ; but in php this command doesn't work. databse connection and everything else is correct because i can query my table's data. My code looks like this: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Result</title> </head> <body> <?php require 'db.inc'; // Connect to the MySQL server if (!($connection = @ mysql_connect($hostname, $username, $password))) die("Cannot connect"); if (!mysql_select_db("League", $connection)) showerror(); $query = "UPDATE 'tamrin' SET tamrin.A =60 WHERE Team LIKE 'Pas'"; if (mysql_affected_row()==0) { echo "query did nothing"; } ?> </body> </html> I cannot see any change after this page in loaded :( |
You have single quotes around the table in you PHP code but not in the example you used with phpmyadmin.
Could that be the issue? graeme |
$query = "UPDATE tamrin SET A =60 WHERE Team LIKE 'Pas'"; works fine
thank you for your attention |
Eh,.. the code you posted does not call mysql_query() to actually execute the query:
PHP Code:
|
All times are GMT -5. The time now is 02:10 AM. |