MySQL Forums
Forum List  »  PHP

Re: SELECT not echoing single entries
Posted by: Keith Mundrick
Date: July 27, 2005 12:08PM

OKAY! That didn't work. Here is the full code for the page I'm using it on, and I am using your code, Slava.

People input their address and it looks up their zoning information.

_________________________________________

<?php

$link = mysql_connect('localhost', 'XXXXXXXXXX', 'XXXXXXXX')
or die('Could not connect: ' . mysql_error());
mysql_select_db('land_info_search') or die('Could not select database.');

// Retrieve all the data from the table

$query = sprintf("select * from land_info where ADDR_NUM='%s' and ST_NAMEFULL='%s'",
$addy, $street);
$result = mysql_query($query) or die(mysql_error());

if($result)
{
while($row = mysql_fetch_row($result))
print_r($row);
}

while ($row = mysql_fetch_array($result))
{
echo "<table width='500' border='0'>";
echo "<tr>";
echo "<td colspan='2'>img</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2'>Zoning information for $addy $street</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Zoning Classification:</td>";
echo "<td>$row[ZONE_CLASS]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Fire District:</td>";
echo "<td>$row[FIRE_DIST]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Police District: </td>";
echo "<td>$row[POLICE_DIST]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Voting Precinct: </td>";
echo "<td>$row[PRECINCT_CH]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Polling Place: </td>";
echo "<td>$row[PLNG_PLC]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[PLNG_ADDR]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[PLNG_CITY]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Elementary School District: </td>";
echo "<td>$row[ELEM_FULLNAME]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[ELEM_ADDR]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[ELEM_CITY], IL $row[ELEM_ZIP]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[ELEM_PHONE]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[ELEM_URL]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td>High School District: </td>";
echo "<td>$row[HIGH_FULLNAME]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[HIGH_ADDR]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[HIGH_CITY], IL $row[HIGH_ZIP]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[HIGH_PHONE]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>$row[HIGH_URL]</td>";
echo "</tr>";
echo "<tr>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Garbage Collection Day: </td>";
echo "<td>$row[GARBAGE_DAY]</td>";
echo "</tr>";
echo "</table>";
}


// Closing connection
mysql_close($link);
?>

Options: ReplyQuote


Subject
Written By
Posted
Re: SELECT not echoing single entries
July 27, 2005 12:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.