Link to home
Start Free TrialLog in
Avatar of runnerjp
runnerjp

asked on

else statment only ever outputs the first statement

im trying to grab from the db users that have posted in my forum... so then if they have posted in a spesific thread then it will show an icon ...
think is my code only shows yes u possted here... no matter what the outcome :S
<?php
require_once '../settings.php';
 
 
$query = mysql_query("SELECT COUNT(postid) FROM forumtutorial_posts WHERE postid='255' OR parentid = '255' AND author='demo'");
 
   if($query != 0) {
      echo 'yes you poster here';
   }
   else
   {echo 'no';}
   ?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of runnerjp
runnerjp

ASKER

thanks that worked great... 2 questions... who () the or and also whats this ($query, 0,0);
>also whats this ($query, 0,0);
actually, that is mysql_result($query, 0,0);

that function returns the first column (0-based index) from the first row (again, 0-based index) from the query handle ($query). more info:
www.php.net/mysql_result