PDA

View Full Version : Major MySQL problems


Ninth Dimension
08-24-2002, 10:39 PM
Hi, what am I doing wrong in the query below?

SELECT vbs_chapters.id,vbs_chapters.chapterid,vbs_chapter s.storyid,vbs_chapters.title,vbs_chapters.body,vbs _chapters.path1,vbs_chapters.path2,vbs_chapters.us erid,vbs_chapters.dateline,vbs_chapters.display,us er.username FROM vbs_chapters,user $showallvalue AND vbs_chapters.storyid = $storyid AND vbs_chapters.userid=user.userid ORDER BY vbs_chapters.chapterid

I've attached the sql for the tables so you can see them if you want to.

Ninth Dimension
08-24-2002, 10:55 PM
I've just realised that the query above is not going to help you much as it's missing a lot of the data.

here is a sample query after the script has done it's calculations.

SELECT vbs_chapters.chapterid,vbs_chapters.storyid,vbs_ch apters.title,vbs_chapters.body,vbs_chapters.path1, vbs_chapters.path2,vbs_chapters.userid,vbs_chapter s.dateline,vbs_chapters.display,user.username FROM vbs_chapters,user WHERE (vbs_chapters.chapterid = 4) OR (vbs_chapters.chapterid = 2) OR (vbs_chapters.chapterid = 1) AND vbs_chapters.storyid = 5 AND vbs_chapters.userid=user.userid

Issvar
08-27-2002, 12:08 AM
The first query misses the WHERE keyword.
The second query might not do what you intend to do, you probably want an extra set of parentheses around the three WHERE clauses joined by OR.

Last hint, when you have a problem tell what is wrong.

Ninth Dimension
08-27-2002, 12:14 AM
Hi, sorry I should have updated this thread, I solved the problems (or rather found someone else that knew the answer).

but thank you for your help anyway. :D