Code: Select all
<?php
include '../login/dbc.php';
//first open connection to your database
$takeuser = mysql_query("SELECT * FROM users WHERE id='$_SESSION[id]' AND activated='1'"); //Right now script check id number from url against the database
if (mysql_num_rows($takeuser) < 1) { //checks if we have that id number in our database
echo "You Have No Friends...Better Get Some"; //inform the user that we found 0 result
} else { //or if we found some
while ($row=mysql_fetch_array($takeuser)) { //Taking the result set
echo 'Name: ' . $row['friendname'] . '<br/><hr/><br/>'; //Displaying the result (ie you can have various fields in your table, display what you want)
} //closing the loop
} //closing the "if" statement
mysql_close($link); //and then we close connection
?>
but it comes up the error as "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource"
even though i've used this before.
any help would be appreciated, Kedora19