FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[RESOLVED] WHERE clause





Aelita
WHY DOESN"T IT WORK. I've spent hours trying to figure out why my string of code doesn't work... Come down to this the WHERE clause for mysql queries isn't working or I don't know how to use it correctly..

Code:
$sql_comments = 'SELECT id FROM Comments';
   $comments = $db->sql_query($sql_comments);
   if ($comments == false)
   {
      echo 'here again';
   }

This comes out a blank scrreen which is good.

This however doesn't!

Code:
$sql_comments = 'SELECT id FROM Comments WHERE post_id = 1';
   $comments = $db->sql_query($sql_comments);
   if ($comments == false)
   {
      echo 'here again';
   }


Why???? Please someone help, and please dont answer if you dont know why...............
kv
Try printing out the error message. It will give a clue of the problem. If your column is of type text, then you will require quotes around the value.
Aelita
THANK YOU!!!!!!!!!!!!!!
i bloody mispelled topic in my database it was topcid supose to be topicid argh... but thanks man!
Would have never gotten it without that, so dumb...

PROBLEM SOLVED CLOSE TOPIC!
Daniel15
Glad you fixed the problem

Topic -closed-
Related topics
SQL Basics
Mysql error!
PhpBB Login Problem Please help me
About the "language" of my site
Need Help Yet again :: Comment system, data from 3 tables !!
Require the attention of various web designers
mySQL Query Problem
Edit Profile script
PHP MySQL Question
SQL.....Where to start?
admin page troubles
Caution: LIMIT is much much slower than WHERE
Search Option
Help me writing this query. Urgent
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.