Helpful Information
 
 
Category: MySQL
update

update $category set name=$name , image=$image , price=$price , stock=$stock , description=$description where name = '$name'

Obviously there is something wrong with that query, can anybody spot it?

Thanks!
Jared

update '$category' set name='$name' , image='$image' , price='$price' , stock='$stock' , description='$description' where name = '$name'

Hope this helps mate

Jee

Thanks for helping, but it still doesn't seem to work.

You will need to be more descriptive of what's not working. Is is generating an error? Is the query running and the fields not being updated?

if (mysql_query("my query is here")) {
echo "yes";
} else {
echo "no";
}

It returns no.

Try this and paste the results


if (mysql_query("my query is here")) {
echo "yes";
} else {
echo "no<br />".mysql_error();
}

Jee

You have an error in your SQL syntax near ''' set name='Matrix' , image='' , price='2.00' , stock='No' , description='The p' at line 1

Could it be that I want the image to be blank?

No, that shouldn't bother MySQL. Far more interesting is what is contained in $category at the time you send your query. Put your query string in a variable like $sql and echo it so you can see for yourself if the value is valid.

I don't know exactly if that's important, but I don't use single quotes (') around my table name... though I don't know if they're allowed or not, but the documentation doesn't use them either.










privacy (GDPR)