//case for database search
case "Search":
if(isset($firstname, $lastname)){
mysql_select_db("webuser23", $dbc);
$result = "SELECT * FROM customers WHERE firstname='.$firstname.' ";
mysql_query($dbc);

echo "<table border='1'>";
echo "<tr>";
echo "<th>Firstname</th>";
echo "<th>Lastname</th>";
echo "<th>Phone</th>";
echo "<th>Address</th>";
echo "<th>City</th>";
echo "<th>State</th>";
echo "<th>Zip</th>";

echo "</tr>";

while($row = mysql_fetch_array($result))
    {
echo "<tr>";
  echo "<td>" . $row['firstname'] . "</td>";
  echo "<td>" . $row['lastname'] . "</td>";
  echo "<td>" . $row['phone'] . "</td>";
  echo "<td>" . $row['address'] . "</td>";
  echo "<td>" . $row['city'] . "</td>";
  echo "<td>" . $row['state'] . "</td>";
  echo "<td>" . $row['zip'] . "</td>";
  echo "</tr>";
echo "</table>";
    }
    if (!mysql_query($result, $dbc))
  {
  die('Error: ' . mysql_error());
  }

mysql_close($dbc);
}
  break;

//I only see the table headers, but i cannot see the row with database values. Please help.

Change line 5 and 6:

$query = "SELECT * FROM customers WHERE firstname = '$firstname'";
$result = mysql_query($query);

That works, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.