| Web Design & Programming Building websites, coding scripts or developing apps? html, css, javascripts, ajax, php, asp, java, c+, C++ and other geeky info is here. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Status: Junior Member Join Date: Jul 2009 Posts: 2
![]() | I can't figure why when my array is equal to 0 it still echos yes when it should say no. $result = mysql_query("SELECT COUNT(*) FROM title WHERE title LIKE '%blue%'"); $array = mysql_fetch_array($result); echo $array[0]; if ($array = 0) { echo "yes"; } else { echo "no!"; } Doing what peng says will always give me the else and never the if |
| | |
| | #2 (permalink) |
| Status: Junior Member Join Date: Jul 2009 Posts: 5
![]() | you can't echo an array() and you should not use a variable name of $array because that is a reserved word in PHP do something like $_array = mysql_fetch_array($result); and you will have to if(count($_array) == "0"){ echo "Yes"; } else{ echo "No!"; } you will have to |
| | |
![]() |
| Thread Tools | |
| Display Modes | |
| |