1.

Solve : MySQL Query isn't working?

Answer»

I have all the connections and stuff. It does connect, or it would die().
This query is supposed to CHANGE the persons "Status" to $ChangeTo


$query = mysql_query("UPDATE user SET Status = $ChangeTo WHERE username='$user'");


Do you guys see anything wrong?    Have you selected the database?

HTTP://www.w3schools.com/php/php_mysql_update.aspWhen debugging SQL statements, I usually echo the entire query string to the BROWSER so I can see what variable substitutions have happened.

BEWARE SQL INJECTION ATTACKS!

Using a good DB library is good practice.  MD2 from PEAR is really very good and quite easy to use once you get it set up. Quote

BEWARE SQL INJECTION ATTACKS!
I can help you there, if you like. Quote from: kpac on July 22, 2009, 02:43:16 PM
I can help you there, if you like.

If you use a decent library, there's nothing to worry about, really.  What do you normally do, Kpac? Quote
What do you normally do, Kpac?
When hacking into websites?

Well, it does help to know how to break into your own site, and because I do know how, I don't usually use a library. Usually just trial and error with me until I feel it's secure enough. PHP has some great functions for filtering content though. Quote from: kpac on July 23, 2009, 03:23:28 AM
Usually just trial and error with me until I feel it's secure enough.

 

So... a rigorous testing process then!  Well, I've never used PEAR or a libary like that. STILL, I usually not bad at plugging all the holes.
try this and see the difference.
 
$query = mysql_query("UPDATE user SET Status = $ChangeTo WHERE   
      username='$user';");



Discussion

No Comment Found