Forum Moderators: coopster

Message Too Old, No Replies

Problems with First Php Site

         

unbeatabletechnology

5:21 pm on Apr 9, 2005 (gmt 0)

10+ Year Member



I get this message when I try to run the php on my site: No Record Found, to search again please close this window

Here is the php code I used:

I double checked all the database names and login and they are correct.


<center>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="#000000">
<tr>
<td width="60"><b>id</b></td>
<td width="100"><b>shoename</b></td>
<td width="70"><b>category</b></td>
<td width="150"><b>brand</b></td>
<td width="100"><b>color</b></td>
<td width="100"><b>shoetype</b></td>
<td width="100"><b>retailprice</b></td>
</tr>
<tr>
<td>
<? $hostname = "reviewsdb.runningfarm.com"; // The Dreamhost DB server.
$username = "xyz"; // The username you created for this database.
$password = "xyz"; // The password you created for the username.
$usertable = "xyz"; // The name of the table you made.
$dbName = "shoereviews"; // 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");
?>
<?
//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 * FROM details WHERE $metode LIKE '%$search%' LIMIT 0, 50");
while ($row = @mysql_fetch_array($query))
{
$variable1=$row["id"];
$variable2=$row["shoename"];
$variable3=$row["category"];
$variable4=$row["brand"];
$variable5=$row["color"];
$variable6=$row["shoetype"];
$variable7=$row["retailprice"];
//table layout for results

print ("<tr>");
print ("<td>$variable1</td>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("<td>$variable4</td>");
print ("<td>$variable5</td>");
print ("<td>$variable6</td>");
print ("<td>$variable7</td>");
print ("</tr>");
}
//below this is the function for no record!
if (!$variable1)
{
print ("$XX");
}
//end
?>
</table>
</center>

mcibor

6:48 pm on Apr 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The code seems to be ok. Try printing out really how many rows are there in this query:

print("The number of results from a query: \"SELECT * FROM details WHERE $metode LIKE '%$search%' LIMIT 0, 50\" is: ". mysql_num_rows($query));

There you will see if the query is correct and if there are really no answers in it.

Hope it solves itself!
Michal Cibor