Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $hostname = "localhost"; // Our DB server.
- $username = "Victoria"; // The username you created for this database.
- $password = "password"; // The password you created for the username.
- $usertable = "restaurants"; // The name of the table you made.
- $dbName = "123pizzadelivery"; // This is the name of the database you made.
- MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
- @mysql_select_db( "$dbName") or die( "Unable to select database");
- ?>
- <table border="1" bgcolor="#99FFFF" cellpadding="0" cellspacing="0" bordercolor="#ffffff">
- <tr>
- <td width="400"><b><center>Stats</center></b></td>
- </table>
- <?php
- $newquery = "select count(*) from restaurants";
- $result = mysql_query($newquery);
- echo "<tr>";
- echo " There have been <b>" . mysql_result($result,0) . "</b> restaurants added to our Database.\r\n";
- print "</tr>";
- ?>
- <center>
- <h1>Search Results</h1>
- <table border="1" bgcolor="#99FFFF" cellpadding="0" cellspacing="0"
- bordercolor="#ffffff">
- <tr>
- <!-- <td width="60"><b>Id</b></td> -->
- <td width="260"><b><center>Restaurant Name</center></b></td>
- <td width="250"><b><center>Address 1</center></b></td>
- <td width="160"><b><center>Address 2</center></b></td>
- <td width="240"><b><center>City</center></b></td>
- <td width="40"><b><center>State</center></b></td>
- <td width="60"><b><center>Zip</center></b></td>
- <td width="120"><b><center>Phone Number</center></b></td>
- <td width="250"><b><center>URL</center></b></td></tr>
- <?
- //error message (not found message)begins
- // $XX = "No Record Found, to search again please close this window";
- //query details table begins
- $query = mysql_query("SELECT *, CONCAT('(', LEFT(PhoneMain, 3), ')',
- SUBSTRING(PhoneMain, 4, 3), '-', MID(PhoneMain, 7)) AS 'PhoneNumber'
- FROM restaurants WHERE $metode LIKE '%$search%' LIMIT 0, 50");
- while ($row = @mysql_fetch_array($query))
- {
- // $variable1=$row["id"];
- $variable2=$row["Name"];
- $variable3=$row["Address1"];
- $variable4=$row["Address2"];
- $variable5=$row["City"];
- $variable6=$row["State"];
- $variable7=$row["Zip"];
- $variable8=$row["PhoneNumber"];
- $variable9=$row["URL"];//table layout for results
- echo ("<tr>");
- // echo ("<td><b><bgcolor='123456'><font color='#000000'><center>$variable1</center></font></b></td>");
- echo ("<td width='260' bgcolor='CCFFFF".$col."'><b> $variable2</b></td>");
- echo ("<td width='250' bgcolor='CCFFFF".$col."'> $variable3</center></td>");
- echo ("<td width='250' bgcolor='CCFFFF".$col."'> $variable4</center></td>");
- echo ("<td width='240' bgcolor='CCFFFF".$col."'><center>$variable5</center></td>");
- echo ("<td width='40' bgcolor='CCFFFF".$col."'><center>$variable6</center></td>");
- echo ("<td width='60' bgcolor='CCFFFF".$col."'><center>$variable7</center></td>");
- echo ("<td width='120' bgcolor='CCFFFF".$col."'><center>$variable8</center></td>");
- echo ("<td width='250' bgcolor='CCFFFF".$col."'> $variable9</center></td>");
- print ("</tr>");
- }
- //below this is the function for no record!!
- if (!$variable1)
- {
- print ("$XX");
- }
- //end
- ?>
- </table>
- </center>
Advertisement
Add Comment
Please, Sign In to add comment