ok this is my first time really working with php, im usually working with coldfusion but im not awesome at that either. Im trying to display some of the fields in a calendar database. There are like 5 fields but i am only displaying 2 of them for this particular page. Could you see what im doing wrong here, im getting this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on line 44
#take this part out
$num = mysql_num_rows($result);
if($num > 0){
#instead you can do.
while($row = mysql_fetch_assoc($result)){
if ($row[0] != NULL) {
echo'<tr><td><span class="style13">$row[0]</span></td></tr>';
}
else
{
echo'<span class="style13">The calendar is experiencing technical difficulties. We apologize for the inconvenience.</span>';
}
echo'</table>';
Altho i might have a clue on the parse error, i would be nice to state where the parse error occurs
#if i am correct try, my monitor is messes up
#@ the moment so i cant really see the nice hightlighted colors :(
$query = "SELECT * FROM --TABLENAME--";
$result = mysql_query($query) or die (mysql_error());
if ($row['0'] != NULL) {
echo '<tr><td><span class="style13">"'.$row['0'].'"</span></td></tr>';
}
else
{
echo'<span class="style13">The calendar is experiencing technical difficulties. We apologize for the inconvenience.</span>';
}
also, whats a better way to set up that if statement because if it doesnt validate then the else statement runs as many times as there are items in the database.
Basicly what ure original problem was not executing the else statement measn that youre row is not NULL. in that case it will always return something… ofcourse you can tweak that… lets say if ($row[‘0’] == ‘something’) { do something } else { do something else }
Meaning that if you have specified that tabel field to be NOT NULL if wont do the else statement
i finally got it working, thanks for all the help guys, i just have a few formatting issues on printing out the query and then ill be done with that part.