Page 1 of 1
Mysql UPDATE problem
Posted: Mon Sep 26, 2005 6:55 pm
by dcahrakos
Well, im working with a forum that probably not many people heard of, but that doesnt matter...anyway, im trying to do this, but it doesnt work
Code: Select all
mysql_query("UPDATE categories SET id='$cid', name='$cname', minpow='$cminpow' WHERE id=$id") or print mysql_error();
well, it says it works, but it doesnt actually update anything...can anyone shed some light on this mysterious problem? cause technically it should work, but I cant figure it out for the life of me, all variables are declared, and everything, so there shouldnt be a problem.
Thanks in advance.
Posted: Mon Sep 26, 2005 7:19 pm
by feyd
emit the query string to see if the string itself is correct for what you want to accomplish.
Posted: Tue Sep 27, 2005 3:57 pm
by Skara
This probably isn't the case, but double check that what you're trying to update is actually there. I spent about an hour trying to figure out this exact same problem and I finally realized that I called the update before the insert. It never occurred to me because the update was physically below the insert in a separate function. ^^;
Re: Mysql UPDATE problem
Posted: Wed Sep 28, 2005 3:43 am
by omega-systems
Fot this type of SQL statements, mysql_query() returns TRUE on success and FALSE on error. A non-FALSE return value means that the query was legal and could be executed by the server. It does not indicate anything about the number of rows affected or returned. It is perfectly possible for a query to succeed but affect no rows or return no rows.
Regards,
Michael.
Project Manager
Omega Systems Ltd
Email:
info@omega-systems.biz
ICQ: 264962449
MSN:
omega-systems@hotmail.com
AIM: OmegaSys Ltd