View Full Version : [PHP&MYSQL] Help
Jibbish
23-03-2008, 10:00 AM
Ok, i've got this profile system thing. And I want it so if there is not a record in the database for Hobbies: so on the profile itself it wont display the category Hobbies:
Does anyone know how to do this? +REP is giving for everyone who tries
JohnSoutar
23-03-2008, 05:57 PM
Just do your query, and when it comes to the Hobbies section check whether the result for their hobbies is null or not. If it is, don't echo the HTML for that section.
if ($result) // Just checking if there was a result
{
echo "<strong>Hobbies:</strong> $result";
}
Independent
24-03-2008, 08:16 AM
John's one seem's about right, if you want it to display something like 'THERE WAS NO RECORD!'
then do this..
<?php
if ($result) // Just checking if there was a result
{
echo "<strong>Hobbies:</strong> $result";
}
else
{
echo('THERE WAS NO RECORD');
?>
I think that's right (:
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.