While loop / Null Value
Posted: Sat Jun 23, 2007 10:39 pm
I am looking to list the column names that have values that are not null in a certain row.
What I have so far is the fallowing
what I have it doing so far is displaying the columns name, while taking out those that I dont want to display(like id and such). But then I dont know how to check to see if that value is/isnt Null.
Do you guys have any idea or am I on the completely wrong track.
Thanks you guys have been so helpful with this stuff.
What I have so far is the fallowing
Code: Select all
<?php
error_reporting(0);
function mysqls_sad()
{
echo "MySQL said: Error: " . mysql_errno() . ' - ' . mysql_error();
exit();
}
if (!is_resource(($dbcon = mysql_connect("db949.perfora.net", "dbo207711380", "###pass##"))))
{
mysqls_sad();
}
if (!mysql_select_db('db207711380', $dbcon))
{
mysqls_sad();
}
$flavor = $_GET["flavor"];
$sql = 'SELECT * FROM `flavors` WHERE `flavor`=\'Apple\' LIMIT 0, 30 ';
if (false === ($result = mysql_query($sql)))
{
mysqls_sad();
}
while($brand = mysql_fetch_field($result))
{
if ($brand->name != 'flavor_id' && $brand->name != 'flavor' && $brand->name != 'desc' && $brand->not_null!='1')
{
echo $brand->name;
echo "<br/>";
}
}
?>Do you guys have any idea or am I on the completely wrong track.
Thanks you guys have been so helpful with this stuff.