02-24-2007, 03:47 PM
Hey,
I am new to PHP and am trying to create a page that is basically a directory that calls information from the mysql database.
this is my function
PHP Code:
function review($letter){
$result = mysql_query("SELECT * FROM reviews WHERE name LIKE '".$letter."%' ORDER BY name", $connection);
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$name = mysql_result($result, $i, "name");
echo "<a href="/reviews/".$name.".php">".$name."</a>
";
}
}
when I say review("A"), it should call the information from the reviews database and create a link for all the names that start with the letter A.
I do not know why it is not working, I am pretty sure it has someting to do with the query but can not pinpoint it. Any help is greatly appreciated.
Thanks.
I am new to PHP and am trying to create a page that is basically a directory that calls information from the mysql database.
this is my function
PHP Code:
function review($letter){
$result = mysql_query("SELECT * FROM reviews WHERE name LIKE '".$letter."%' ORDER BY name", $connection);
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$name = mysql_result($result, $i, "name");
echo "<a href="/reviews/".$name.".php">".$name."</a>
";
}
}
when I say review("A"), it should call the information from the reviews database and create a link for all the names that start with the letter A.
I do not know why it is not working, I am pretty sure it has someting to do with the query but can not pinpoint it. Any help is greatly appreciated.
Thanks.