Here's the code I'm having trouble with. I have a line in my MySQL database named Need_Help. It is set to return a 1 or a 0:
Need_Help tinyint(1) No 0
My problem is that the code is returning 'Need Help' regardless of the value of the Need_Help line in my database. Thanks in advance and Happy New Year!
if (mysql_num_rows($result) > 0) {
while($row = mysql_fetch_object($result)) {
if($row->Need_Help = 1) {
echo 'Need Help';
}
echo '<b><a href="' . $row->Web_Address . '">' . $row->Company_Name . '</a></b>
<br /> ';
echo $row->City . ',   ' . $row->State . ',   ' . $row->Country . '  
  ' ;
echo $row->Comment ;
echo '<br /><br /> ';
}
}
Easy for someone (not me) question
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: Easy for someone (not me) question
Code: Select all
if($row->Need_Help == 1) {
Re: Easy for someone (not me) question
Haha 3 cheers!!! You're amazing! It works! Thanks and Happy New Year!
Re: Easy for someone (not me) question
Just to clear it up, a single = is an assignment character meaning that in your IF statement, you were assigning $row->Need_Help to equal 1 so it always returned true.
Re: Easy for someone (not me) question
Got it now... Thanks much!