Please help - getting very desperate! Sun, 12 October 2003 05:39
I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did
not work. I also had an abortive download from PHP.NET as I could not
configure Apache myself.
The REAL problem is that PHPmyAdmin works and sees my test database
Wines....
But my PHP program does not!
The code I have used is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<TITLE> Getting PHP & MY SQL to work </TITLE>
<head>Wines PHP Tester<BR></head>
<body>
<?php
echo "This is PHP here....<BR>\n";
$link_id = @msql_pconnect("localhost");
if (!$link_id) {
echo ("Failed to connect to MySQL!");
exit;
}
else;
{
echo "Connected OK!";
}
if (!mysql_select_db("Wines")) {
echo ("Failed to select database cms!");
exit;
}
echo ("Connected to Database");
$resultset = mysql_query("SELECT * FROM wine");
while ($row = mysql_fetch_row ($resultset)) {
echo "Date $row[0]: $row[1]\n";
}
echo ("end");
?>
</html>
</BODY>
</HTML>
And I have also tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Getting PHP & MY SQL to work </TITLE>
</HEAD>
<BODY>
<html>
<head>Wines PHP Tester<BR></head>
<body>
<?php
echo "This is PHP here....<BR>\n";
$connection = mysql_connect("localhost");
$db = mysql_select_db("Wines",$connection);
$query = "SELECT * FROM Wine";
echo "Select...";
$result = mysql_query($query,$connection);
echo "result...";
?>
</body>
</html>
</BODY>
</HTML>
But I get no results. It works fine in PHPmyAdmin though.
I did have a different Mysql on my XPHome box which I have
subsequently deleted as it could not connect to the server once PHP
was installed.
I am falling further behind in my degree as I can even get the db up
and running so I cant even get coding!
Please please help.