rhoula

Untitled

Jun 9th, 2011
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. <?
  2.  
  3. $hostname = "localhost"; // Our DB server.
  4. $username = "Victoria"; // The username you created for this database.
  5. $password = "password"; // The password you created for the username.
  6. $usertable = "restaurants"; // The name of the table you made.
  7. $dbName = "123pizzadelivery"; // This is the name of the database you made.
  8.  
  9. MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
  10. @mysql_select_db( "$dbName") or die( "Unable to select database");
  11. ?>
  12.  
  13.  
  14. <table border="1" bgcolor="#99FFFF" cellpadding="0" cellspacing="0" bordercolor="#ffffff">
  15. <tr>
  16. <td width="400"><b><center>Stats</center></b></td>
  17. </table>
  18.  
  19.  
  20. <?php
  21.  
  22. $newquery = "select count(*) from restaurants";
  23. $result = mysql_query($newquery);
  24.  
  25. echo "<tr>";
  26. echo "&nbsp; There have been <b>" . mysql_result($result,0) . "</b> restaurants added to our Database.\r\n";
  27. print "</tr>";
  28.  
  29.  
  30. ?>
  31.  
  32.  
  33. <center>
  34. <h1>Search Results</h1>
  35.  
  36. <table border="1" bgcolor="#99FFFF" cellpadding="0" cellspacing="0"
  37. bordercolor="#ffffff">
  38. <tr>
  39. <!-- <td width="60"><b>Id</b></td> -->
  40. <td width="260"><b><center>Restaurant Name</center></b></td>
  41. <td width="250"><b><center>Address 1</center></b></td>
  42. <td width="160"><b><center>Address 2</center></b></td>
  43. <td width="240"><b><center>City</center></b></td>
  44. <td width="40"><b><center>State</center></b></td>
  45. <td width="60"><b><center>Zip</center></b></td>
  46. <td width="120"><b><center>Phone Number</center></b></td>
  47. <td width="250"><b><center>URL</center></b></td></tr>
  48.  
  49.  
  50. <?
  51. //error message (not found message)begins
  52. // $XX = "No Record Found, to search again please close this window";
  53. //query details table begins
  54. $query = mysql_query("SELECT *, CONCAT('(', LEFT(PhoneMain, 3), ')',
  55. SUBSTRING(PhoneMain, 4, 3), '-', MID(PhoneMain, 7)) AS 'PhoneNumber'
  56. FROM restaurants WHERE $metode LIKE '%$search%' LIMIT 0, 50");
  57. while ($row = @mysql_fetch_array($query))
  58. {
  59. // $variable1=$row["id"];
  60. $variable2=$row["Name"];
  61. $variable3=$row["Address1"];
  62. $variable4=$row["Address2"];
  63. $variable5=$row["City"];
  64. $variable6=$row["State"];
  65. $variable7=$row["Zip"];
  66. $variable8=$row["PhoneNumber"];
  67. $variable9=$row["URL"];//table layout for results
  68.  
  69. echo ("<tr>");
  70. // echo ("<td><b><bgcolor='123456'><font color='#000000'><center>$variable1</center></font></b></td>");
  71. echo ("<td width='260' bgcolor='CCFFFF".$col."'><b>&nbsp; $variable2</b></td>");
  72. echo ("<td width='250' bgcolor='CCFFFF".$col."'>&nbsp; $variable3</center></td>");
  73. echo ("<td width='250' bgcolor='CCFFFF".$col."'>&nbsp; $variable4</center></td>");
  74. echo ("<td width='240' bgcolor='CCFFFF".$col."'><center>$variable5</center></td>");
  75. echo ("<td width='40' bgcolor='CCFFFF".$col."'><center>$variable6</center></td>");
  76. echo ("<td width='60' bgcolor='CCFFFF".$col."'><center>$variable7</center></td>");
  77. echo ("<td width='120' bgcolor='CCFFFF".$col."'><center>$variable8</center></td>");
  78. echo ("<td width='250' bgcolor='CCFFFF".$col."'>&nbsp; $variable9</center></td>");
  79. print ("</tr>");
  80. }
  81.  
  82.  
  83. //below this is the function for no record!!
  84. if (!$variable1)
  85. {
  86. print ("$XX");
  87. }
  88. //end
  89. ?>
  90. </table>
  91. </center>
Advertisement
Add Comment
Please, Sign In to add comment