Jump to content

help with code - A-Z listing


Ameslee

Recommended Posts

ok another problem has arised.  Ok the records are now links, but now when i click on the link it goes to the page but it says not record found.  I was working on this page yesterday with Thorpe, and it was working fine.  here is the code that runs the 2 pages.

code1
[code]
<?php
for ($i = 'A'; $i != 'AA'; $i++){
echo "<a href = \"?search=$i\"> $i </a>";
}
if(isset($_GET['search']) && $_GET['search'] != ''){

$hostname = localhost;
$username = ;
$password = ;


$conn = mysql_connect($hostname, $username, $password) or die(mysql_error());
$connection = mysql_select_db("greenac_VORNExpo", $conn);

$search = $_GET['search'];

$sql = mysql_query("SELECT * FROM exhibits WHERE exhibit LIKE '$search"."%'") or die(mysql_error());
while ($row = mysql_fetch_array($sql)){
// display results
echo "<br /><a href=\"display_exhibits1.php\">" .$row['exhibit']. "</a><br />";


}
}


?>[/code]

Now for the second page

[code]
<?php
$hostname = localhost;
$username = ;
$password = ;

$conn = mysql_connect($hostname, $username, $password) or die(mysql_error());
$connection = mysql_select_db("greenac_VORNExpo", $conn);


$query = "SELECT * FROM `exhibits` WHERE serviceid='{$_GET['id']}'";

if ($mysql_result = mysql_query($query,$conn)) {
    if (mysql_num_rows($mysql_result) > 0) {
$row=mysql_fetch_row($mysql_result);


echo("<table width=100%><tr><td width=20%><b>Exhibit:</b><td width=35%>$row[1]");
echo("<tr><td width=20%><b>Located:</b><td width=35%>$row[2]");
echo("<tr><td width=20%><b>Services:</b><td width=35%>$row[3]");
echo("<tr><td width=20%><b>More Info:</b><td width=35%>");
echo("<tr><td width=10%><b>Contact Person:</b><td width=35%>$row[5]");
echo("<tr><td width=10%><b>Contact Number:</b><td width=35%>$row[6]");
echo("<tr><td width=10%><b>Mobile:</b><td width=35%>$row[7]");
echo("<tr><td width=10%><b>Email:</b><td width=35%>$row[8]");


} else {
      echo "No results found";
    }
  } else {
  echo "Query failed: ". mysql_error() . ": $query";
}

?>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.