<?php
$sql= "UPDATE usedcar SET car_reg ="$car_reg" WHERE car_id ="$car_id""; $sql_result = mysql_query($sql, $connection) or die ("Couldnt execute query");?>
When I run this page I get the error message
Warning: Supplied argument is not a valid MySQL result resource in /Library/WebServer/Documents/skoda/mod_records3.php on line 34
Please can you help. I would like to know
What does this message mean, Is the problem in my sql or the php?[quote][/quote]
Your SQL syntax or a table/column name is wrong... whenever you do a query ALWAYS check result and halt on errors...
$samadams = mysql_query ("SELECT drink FROM keg WHERE brand='samadams' AND type='lager'",$mydb);
if (!$samadams) die ('Query failed: '.mysql_error($mydb));
It is likely that one of your variables contain illegal characters, ALWAYS make sure ANY data used in a query from ANY other source that originates from user input is being escaoed properly, in mysql case you can use mysql_escape_string();
This is may help
Yuo have got -> $sql="UPDATE usedcar SET car_name=$car_name WHERE car_id=$car_id";
Try -> $sql="UPDATE usedcar SET car_name='$car_name' WHERE car_id=$car_id";
Adding the single quotes around the value if its a string, this may apply to $car_id if this is also a string if an number then the quotes arent needed.