PHP & My SQL configuration

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
jcgm5000
Forum Newbie
Posts: 2
Joined: Fri Aug 16, 2002 10:05 am

PHP & My SQL configuration

Post 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>


:?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You have to tell us what doesn't work for us to be able to help you properly.

Mac
jcgm5000
Forum Newbie
Posts: 2
Joined: Fri Aug 16, 2002 10:05 am

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
Post Reply