Sql Query Error - Question

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Sql Query Error - Question
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 43
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.03 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
$db->sql_query("UPDATE ".$prefix."_users SET user_new_privmsg = 1 WHERE user_id=" . $userdata['user_id'] . " LIMIT 1", $dbi);


Could some tell me what is wrong with this line of code. I get a error saying something is missing or expected. What am I missing?


Back to top Reply with quote
#2   re: Sql Query Error - Question
aUsTiN
CZ Active Member
usa.gif georgia.gif
Age: 41
Gender: Male
Website:
Status: Offline
Joined: Sep 09, 2003
0.02 posts per day
Posts: 142
Points: 57
  MSN Messenger 
Replace it with


      $q =  "UPDATE " . $prefix . "_users
            SET user_new_privmsg = '1'
            WHERE user_id = ". $userdata['user_id'] ."
            LIMIT 1";
      $r = $db -> sql_query($q);


And tell me what ya get.


Back to top Reply with quote
#3   
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 43
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.03 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
Parse error: parse error, expecting `','' or `';''



Back to top Reply with quote
#4   
stealthusa
CZ Addict
stealthusa has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Self-Employed
Age: 58
Gender: Male
Fav. Sports Team: Cowboys
Website:
Status: Offline
Joined: Jan 23, 2004
0.05 posts per day
Posts: 353
Points: 14,459
 Yahoo Messenger  ICQ Number
what part of the forums did you get that from




_________________
Back to top Reply with quote
#5   re: Sql Query Error - Question
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 43
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.03 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
I am editing the pop up pm code in the CZ User login Block. I change the code to pop up an OK\Cancel Dialog box instead of the new windows. If the user selects cancel I would like to update user_new_privmsg field in the user table so the dialog box will stop after the user cancels it.

Basically if the user selects Cancel instead of OK, the user table gets updated so the pop up no longer will happen on next load.

In the code I gave it should say user_new_privmsg = '0', but that is not the error.

I just thought of something, Can you update the sql database from inside a javascript function? Because thats what I was doing. I think that is the error.




box.JPG
 Description:
N/A
 Filesize:  10.96 KB
 Viewed:  10970 Time(s)

box.JPG




Back to top Reply with quote
#6   re: Sql Query Error - Question
aUsTiN
CZ Active Member
usa.gif georgia.gif
Age: 41
Gender: Male
Website:
Status: Offline
Joined: Sep 09, 2003
0.02 posts per day
Posts: 142
Points: 57
  MSN Messenger 
The line it says the parse error is on, paste the lines above & under it.



Back to top Reply with quote
#7   re: Sql Query Error - Question
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 43
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.03 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
if ($dopmpopup == 1){
getusrinfo($user);
    if ($userinfo['user_popup_pm'] && $userinfo['user_new_privmsg']) {
      echo "<s cript language=\"Javas cript\" type=\"text/javas cript\">
<!--
        if(confirm('You have a new private message.  Click OK to view it, or Cancel to hide this prompt.'))
     {
      var answer = confirm('Open your inbox in a new window?  (Press Cancel to open in the current window.)');
        if (!answer)
           popupWindow=window.location('modules.php?name=Private_Messages');
        else
           popupWindow=window.open('modules.php?name=Private_Messages', '', 'location=yes,toolbar=yes,menubar=yes,directories=yes,status=yes,resizable=yes,scrollbars=yes,height=480,width=640', false);
     }
else{
$q =  "UPDATE " . $prefix . "_users
            SET user_new_privmsg = '1'
            WHERE user_id = ". $userdata['user_id'] ."
            LIMIT 1";
      $r = $db -> sql_query($q); }

//-->
</s cript>";
}
   
    }   else {
$content .= "";
}



Back to top Reply with quote
#8   re: Sql Query Error - Question
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
You could set it so it will only pop up once if you cant get that to work:

getusrinfo($user);
    if ($userinfo['user_popup_pm'] && $userinfo['user_new_privmsg']) {
        echo "<script language=\"Javascript\" type=\"text/javascript\">
<!--
        window.open('modules.php?name=Private_Messages&file=index&mode=newpm&popup=1', '', 'HEIGHT=225,resizable=yes,WIDTH=400');
//-->
</script>";
$q =  "UPDATE " . $prefix . "_users
            SET user_new_privmsg = '1'
            WHERE user_id = ". $userdata['user_id'] ."
            LIMIT 1";
      $r = $db -> sql_query($q);
    }

Its not tested but i dont see why it wouldnt work.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#9   re: Sql Query Error - Question
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 43
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.03 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
Thanks I'll try that.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum