Page 1 of 1

PHP & My SQL configuration

Posted: Fri Aug 16, 2002 10:05 am
by jcgm5000
Hi:
Someone can help me?
I install Linux Red Hat 7.3 and My SQL 3.23.51.
When i access a .php file from browser it don't work.
How can i test if configuration of PHP, My SQL or Apache are working rigth?

This is the code i write:

<html>
<head>
<title>Book-O-Rama Search Results</title>
</head>
<body>
<h1>Book-O-Rama Search Results</h1>
<?
if (!$searchtype || !$searchterm)
{
echo "You have not entered search details. Please go back and try again.";
exit;
}

$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);

@ $db = mysql_pconnect("localhost", "bookorama", "bookorama");

if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}

mysql_select_db("books");
$query = "select * from books where ".$searchtype." like '%".$searchterm."%'";
$result = mysql_query($query);

$num_results = mysql_num_rows($result);

echo "<p>Number of books found: ".$num_results."</p>";

for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "<p><strong>".($i+1).". Title: ";
echo stripslashes($row["title"]);
echo "</strong><br>Author: ";
echo stripslashes($row["author"]);
echo "<br>ISBN: ";
echo stripslashes($row["isbn"]);
echo "<br>Price: ";
echo stripslashes($row["price"]);
echo "</p>";
}

?>

</body>
</html>


:?

Posted: Sat Aug 17, 2002 10:49 am
by twigletmac
You have to tell us what doesn't work for us to be able to help you properly.

Mac

Posted: Sat Aug 17, 2002 6:46 pm
by jcgm5000
Simply the browser show text before the connection statement nothing before it.

Browser don't report execution errors or warnings. I don't know what happen.

I made a default installation of Red Hat . PHP works because in a .php file i write <? phpinfo(); ?> and the browser shows configuration.
I install MySQL late and works when i use it from the command line. I can show database and can do SQL statements.

Tell me if you need more information.

Thanks.

Posted: Sat Aug 17, 2002 9:04 pm
by volka
Browser don't report execution errors or warnings. I don't know what happen.
also check the server-logs. if display_errors is turned off in your php.ini you won't see any errors in the browser