how can i check to see if data exists before pulling it out?
Posted: Tue Jul 17, 2007 4:21 pm
I use this code to get data from a database:
How can i make it so if there is no data with the correct username, it gives a message saying no data was found?
Code: Select all
$sql = "SELECT * from dailyvibe WHERE userlink='$username' ORDER BY postid DESC";
$result = mysql_query($sql) or print ("Can't select entry from table php_blog.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)){
$date = stripslashes($row['timestamp']);
$title = stripslashes($row['title']);
$entry = stripslashes($row['entry']);
...other stuff...
}