All pastes #611000 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-09 18:57 UTC
rendered paste body
<?php
include 'config.php';
	

	trim($lname);
	if (!$lname)
	{
	       $sql = "SELECT * FROM dating";
	       $result = mysql_query($sql) or die(mysql_error());
	}
        else
        {    
	       $sql = "SELECT * FROM dating WHERE lastname='".$lname."'";
	       $result = mysql_query($sql) or die(mysql_error());
        }
	

	if(mysql_num_rows($result) < 0)
	{
		echo "Sorry, there were no matches for your query. Please try again.";
	}
	else
	{
		echo "<TABLE BORDER=1><TR><TH>First name</TH><TH>last name</TH><TH>city</TH><TH>&nbsp;</TH></TR>";
		
		while($row = mysql_fetch_array($result))
		{
			
		echo "<TR><TD>". $row['firstname'] ." ". $row['lastname'] ." ". $row['city'] ."</TD></TD></TR><br />";
		
		}
		
		echo "</TABLE>";
	}
	
?>