Jump to content

mysql_query doesnt update, but mysql_affected_rows() says it does


leeming

Recommended Posts

I have tested this query, and cant understand why it isnt working...

i have put mysql_affected_rows() after to see if it worked or not, which it returns true.
So then i printed the query to screen, to double check the variables are going into it correctly. Which they where.. so i loged into myPHPadmin, and copied and pasted the query, which then worked.

So i concluded it was a connection error some how (even tho mysql_affected_rows() is returning true), and i have an "or die()" on the end of it with a message for me to know whats going on... the query runs so it doesn't go to that...


why would mysql_affected_rows() be telling me Update query worked, when i know it didnt (by checking myself thru myPHPadmin)
[quote author=ataria link=topic=117117.msg477572#msg477572 date=1165076041]
Post the script.
Let's take a look at this baby.
[/quote]
heh neva like posting my code, especialy my queries, due to custom functions.. any way..

[code]
    $sql = "UPDATE Accounts SET Account_Aim = '".htmlentities($_REQUEST['aim'], ENT_QUOTES)."', Account_Msn = '".htmlentities($_REQUEST['msn'], ENT_QUOTES)."', Account_Yahoo = '".htmlentities($_REQUEST['yahoo'], ENT_QUOTES)."', Account_Icq = '".htmlentities($_REQUEST['icq'], ENT_QUOTES)."', Account_Gender = '".htmlentities($_REQUEST['gender'], ENT_QUOTES)."', Account_Website = '".htmlentities($_REQUEST['userwebsite'], ENT_QUOTES)."', Account_Location = '".htmlentities($_REQUEST['location'], ENT_QUOTES)."', Account_Army_Name = '".htmlentities($_REQUEST['arname'], ENT_QUOTES)."', Account_Sig = '".htmlentities($_REQUEST['sig'], ENT_QUOTES)."', Account_Personal = '".htmlentities($_REQUEST['personal'], ENT_QUOTES)."' WHERE Account_ID = '".USERID."'";
    $query = mysql_query($sql, cdb(0))or die('wtf');//bavaderror($sql);
   
    if(mysql_affected_rows() == 0)
    {
      print"not updated?<br>";
    }
   
    print"<center><b><font color=green>Your Profile Has Been Updated</font></b></center>";
[/code]

it never prints out "not updated"...
Hmm.
Try.

[code]
$sql = mysql_query("UPDATE Accounts SET Account_Aim = '".htmlentities($_REQUEST['aim'], ENT_QUOTES)."', Account_Msn = '".htmlentities($_REQUEST['msn'], ENT_QUOTES)."', Account_Yahoo = '".htmlentities($_REQUEST['yahoo'], ENT_QUOTES)."', Account_Icq = '".htmlentities($_REQUEST['icq'], ENT_QUOTES)."', Account_Gender = '".htmlentities($_REQUEST['gender'], ENT_QUOTES)."', Account_Website = '".htmlentities($_REQUEST['userwebsite'], ENT_QUOTES)."', Account_Location = '".htmlentities($_REQUEST['location'], ENT_QUOTES)."', Account_Army_Name = '".htmlentities($_REQUEST['arname'], ENT_QUOTES)."', Account_Sig = '".htmlentities($_REQUEST['sig'], ENT_QUOTES)."', Account_Personal = '".htmlentities($_REQUEST['personal'], ENT_QUOTES)."' WHERE Account_ID = '".USERID."'");
   
    if(mysql_affected_rows() == 0)
    {
      print"not updated?<br>";
    }
   
    print"<center><b><font color=green>Your Profile Has Been Updated</font></b></center>";
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.