English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Warning: Division by zero in /mnt/w0401/d40/s45/b028724c/www/hoodtalk.org/board.php on line 258
SQL-DATABASE ERROR

Database error in WoltLab Burning Board (): Invalid SQL: SELECT threadid, if (voted>0 AND voted>=0,votepoints/voted,0) AS vote FROM bb1_threads WHERE boardid='2' AND visible = 1 AND important < 2 AND (important=1 OR lastposttime >= '1174653747') ORDER BY important DESC, , lastposttime DESC
mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' lastposttime DESC' at line 1
mysql error number: 1064
mysql version: 5.0.24a-log
php version: 4.3.10
Date: 23.03.2007 @ 07:42
Script: /board.php?boardid=2
Referer: http://hoodtalk.org/thread.php?postid=83009

2007-03-23 01:46:13 · 1 answers · asked by emart4036 2 in Computers & Internet Programming & Design

1 answers

Your problem is with your SQL, but not due to an extra comma (although you should remove it). You actually place a condition in your SQL where you could divide by zero:

if (voted>0 AND voted>=0,votepoints/voted,0) AS vote

Since voted could be 0 in this expression, you get the error. Here's what I think you want; I'm not sure because your WHERE conditions aren't clear:

SELECT threadid, CASE WHEN voted > 0 THEN votepoints / voted ELSE 0 END CASE AS vote FROM bb1_threads WHERE boardid = 2 AND visible = 1 AND (important < 2 OR (important = 1 OR lastposttime >= 1174653747)) ORDER BY important DESC, lastposttime DESC

2007-03-23 03:26:23 · answer #1 · answered by Anonymous · 0 0

fedest.com, questions and answers