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
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
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.
PHP Code:
if ($result) // Just checking if there was a result
{
echo "<strong>Hobbies:</strong> $result";
}
Last edited by JohnSoutar; 23-03-2008 at 06:00 PM.
i'm well 'ard.
John's one seem's about right, if you want it to display something like 'THERE WAS NO RECORD!'
then do this..
I think that's rightPHP Code:
<?php
if ($result) // Just checking if there was a result
{
echo "<strong>Hobbies:</strong> $result";
}
else
{
echo('THERE WAS NO RECORD');
?>
Want to hide these adverts? Register an account for free!