coding and dbase
Posted: Wed Aug 27, 2003 11:55 am
Ok, I have two questions. First, how can I improve this coding below:
As you can see I have a table with in which this form is searching. Now I wish to add pictures to this database to be displayed in the search results. How can I do this?
All help is welcome,
SPanx in advance!
Code: Select all
<? include "header.php" ?>
<?
$hostname = "www.www.com"; // Usually localhost.
$username = "fluffy"; // If you have no username, leave this space empty.
$password = "fluffy"; // The same applies here.
$usertable = "Prezime"; // This is the table you made.
$dbName = "ifluffy"; // This is the main database you connect to.
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>
<?
//error message (not found message)
$XX = "No Record Found";
$query = mysql_query("SELECT * FROM $usertable WHERE surname LIKE '%$search%' LIMIT 0, 1 ") or die (mysql_errno() . ' ' . mysql_error());
while ($row = mysql_fetch_array($query))
{
echo('<b>Surname:</b> ' . $rowї"surname"] . '<br>');
echo('<b>Place:</b> ' . $rowї"place"] . '<br>');
echo('<b>Region:</b> ' . $rowї"region_country"] . '<br>');
echo('<b>Family Saint:</b> ' . $rowї"family_saint "] . '<br>');
echo('<b>Information:</b> ' . $rowї"information"] . '<br>');
echo('<br>');
}
//below this is the function for no record!!
if (!mysql_num_rows($query))
{
print ("$XX");
}
//end
?>
<? include "footer.php" ?>All help is welcome,
SPanx in advance!