Hi,
I am trying to master php/mysql. I am trying to setup mysql and php on my notebook computer with the intention of uploading a finished site to my web host where mysql will be running on an Apache server. I think I have mysql running... I can add records and then retrieve them using the command line in mysql. I have a short php file that to try it out with but I can't get it to work. Here is what I have...
Windows 2000 SP2
mysql Ver 10.4 Distrib 3.22.34, for Win95/Win98 (i586)
Connection id: 1
Current database: realestate
Current user: root@localhost
Server version 3.22.34-shareware-debug
Protocol version 10
Connection localhost via TCP/IP
TCP port 3306
Uptime: 44 min 15 sec
PHP V4?? I downloaded V4 I believe but how do I check that??
I get the following message when I try to run my page.
Parse error: parse error in c:\inetpub\wwwroot\gethomes.php on line 33
Is there a way to know if I'm getting connected to mysql through php?
Is there something wrong with my code.
database=realestate, table=homes.
Here is the code I'm using...
<body bgcolor="red">
<p>
<p>
Write this!
<p>
<?php
//Connect to server...
$dbcnx = mysql_connect(localhost, root, pwd);
if (!$dbcnx) {
echo( "Unable to connect to the database server at this time." );
exit();
}
//Select the database
mysql_select_db(REALESTATE);
if (!@mysql_select_db("realestate") ) {
echo("Unable to locate the database at this time.");
exit();
}
?>
Here are the homes:
<?php
//Select the records by field.
$result = mysql_query("SELECT location FROM HOMES");
if (!$result) {
echo("Error performing query: " mysql_error());
exit();
}
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["school"] . "</P>");
}
?>
</body>