What's wrong with this code?
<?php
// includes
include("../../includes/config.php");
include("../../includes/functions.php");
include ("../../includes/connect.php");
// generate and execute query
$list_computername_sql = ("SELECT cname,machid FROM inventory WHERE clientid='$clientid'");
$list_computername_result = mysql_query($list_computername_sql);
$numrows = mysql_num_rows($list_computername_result);
if ($numrows>0) {
while ($list = mysql_fetch_array($list_computername_result)) {
echo "<li><a href=\"openlinq.php?module=inventory&clientid=$clientid&machid=".$list["machid"]."\">".$list["cname"]." </a><br><br></li>";
}
}else{
echo"<font face=\"arial\" size=\"3\" color=\"#CC0000\">There are no computers available at this time.</font>";
}
?>
To test the code I use a URL with a valid clientid select (ie www.mysite.com?client=1). I get the error:
Undefined variable: clientid on the select statement line. When I add substitute a numeral for $clientid the code works. This is quite frustrating.
Any thoughts?
Thanks.