Jump to content

How to hid a title if the field is empty


blueearth

Recommended Posts

something to digest. ((try it out, work it out as your learning.

<?php

// database connection.

//select a phone number where the id = whatever.
$sql="SELECT phone FROM what_ever where id='$what_ever'";

// get the select sql statement.
$res=mysql_query($sql)or die("You got a $sql error".mysql_error());

//fetch a array of $row to get the phone number.
$row=mysql-fetch_array($res);

// put $row array name as variable $phone.
$phone=$row['phone'];

// if the variable name $phone is empty.
if(empty($phone)){

// if empty set variable $phone to this comment.
$phone="your phone number is not set";

}else{
// else if there is a number show this comment.
$phone= " your phone number is : $phone";

}
// echo out the variable of $phone.
echo $phone;

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.