What if it's NULL?
Posted: Sat Jan 24, 2004 10:11 pm
Hello, and thanks again to all who answer these questions from us newbies...
I have the following code:
Later in the page I display a link to a website by using:
A simple question (I think)...
How would I adjust this code to NOT display a link for the website if the table returned a NULL value (not everyone has a website)
I am learning.....
Thanks,
--Tim
I have the following code:
Code: Select all
<?php
$dlrID = $_GET['dlrID'];
$connect=mysql_connect('host', 'user', 'pass') or die('Could not connect due to '.mysql_error());
$database=mysql_select_db('database') or die ('Unable to select DB due to '.mysql_error());
$sql = "select NAME, logopath, WebSite, Street, City, Phone1 from Dealerlist where gaID='$dlrID'" or die('Query failed due to '.mysql_error());
$result=mysql_query($sql) or die('Result call failed due to '.mysql_error());
$rows = mysql_fetch_row($result);
$website = $rows[2];
?>Code: Select all
<a href="<? echo $website; ?>" target="_blank">Visit Our Website</a>How would I adjust this code to NOT display a link for the website if the table returned a NULL value (not everyone has a website)
I am learning.....
Thanks,
--Tim