Current location: Hot Scripts Forums » Programming Languages » PHP » syntax error plz help


syntax error plz help

Reply
  #1 (permalink)  
Old 06-27-03, 03:02 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
syntax error plz help

hi,

i have this rating system that i got to set-up good but when i load the rate file it displays this error:

Rating: LINE 74:You have an error in your SQL syntax near '' at line 1

now i dont know what this means so could someone plz tell me what it is and how to fix it.
Reply With Quote
  #2 (permalink)  
Old 06-27-03, 03:59 PM
Ryan's Avatar
Ryan Ryan is offline
Coding Addict
 
Join Date: May 2003
Location: Virginia
Posts: 391
Thanks: 0
Thanked 8 Times in 3 Posts
Could you post the SQL command you tried to use, please?
__________________
Ryan Huff
iNET Interactive, LLC

http://www.inetinteractive.com
Reply With Quote
  #3 (permalink)  
Old 06-27-03, 04:05 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
i dont know what it is it did it once i ran the script if u want the script reply and ill give it to u. now i checked the line and it is a insert into command. thats all i know.
Reply With Quote
  #4 (permalink)  
Old 06-27-03, 04:30 PM
Ryan's Avatar
Ryan Ryan is offline
Coding Addict
 
Join Date: May 2003
Location: Virginia
Posts: 391
Thanks: 0
Thanked 8 Times in 3 Posts
Could you post the code of the script then? The error you gave is too general for someone to give you a solution to.
__________________
Ryan Huff
iNET Interactive, LLC

http://www.inetinteractive.com
Reply With Quote
  #5 (permalink)  
Old 06-27-03, 04:33 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
so u want the line that made the error or the whole script.
Reply With Quote
  #6 (permalink)  
Old 06-27-03, 04:43 PM
Ryan's Avatar
Ryan Ryan is offline
Coding Addict
 
Join Date: May 2003
Location: Virginia
Posts: 391
Thanks: 0
Thanked 8 Times in 3 Posts
Well, let's see that line first.
__________________
Ryan Huff
iNET Interactive, LLC

http://www.inetinteractive.com
Reply With Quote
  #7 (permalink)  
Old 06-27-03, 04:49 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
ok heres that line:

$query = "SELECT COUNT(*) as num, ((COUNT(*)/(COUNT(*)+".$GLOBALS['m']."))*AVG(rate)+(".$GLOBALS['m']."/(COUNT(*)+".$GLOBALS['m']."))*".$GLOBALS['C'].") AS rate FROM ".$GLOBALS['table']." WHERE rate>0 AND rate<11 AND article=".$id;
$res = mysql_query($query) or die("<b>LINE 74</b>:".mysql_error());
Reply With Quote
  #8 (permalink)  
Old 06-27-03, 05:04 PM
Ryan's Avatar
Ryan Ryan is offline
Coding Addict
 
Join Date: May 2003
Location: Virginia
Posts: 391
Thanks: 0
Thanked 8 Times in 3 Posts
Ok you can give this a shot, I took out a lot of the parenthesis (I never use them) but I probably forgot something, somewhere.
PHP Code:

<?php

$query 
"SELECT COUNT(*) AS num, COUNT(*) / COUNT(*) + {$GLOBALS['m']} * AVG(rate) + {$GLOBALS['m']} /(COUNT(*) + {$GLOBALS['m']} * {$GLOBALS['C']} AS rate FROM {$GLOBALS['table']} WHERE rate > 0 AND rate < 11 AND article= {'$id'}";

$res mysql_query($query) or die("<b>LINE 74</b>:".mysql_error());
?>
Reply With Quote
  #9 (permalink)  
Old 06-27-03, 05:13 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
so copy and paste this where the old line was.
Reply With Quote
  #10 (permalink)  
Old 06-27-03, 05:13 PM
Ryan's Avatar
Ryan Ryan is offline
Coding Addict
 
Join Date: May 2003
Location: Virginia
Posts: 391
Thanks: 0
Thanked 8 Times in 3 Posts
Yes, try that and let me know how it goes.
__________________
Ryan Huff
iNET Interactive, LLC

http://www.inetinteractive.com
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Code Syntax error...need help...missing operator geneane ASP 3 09-02-03 07:39 PM
Error: Syntax error converting datetime from character string. Han84 ASP 1 08-22-03 04:59 AM
eval variables syntax banquet PHP 1 07-09-03 04:49 AM


All times are GMT -5. The time now is 08:10 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.