corbins
6-18-03, 07:34 PM
I'm extremely new to mySQL. I just finished reading my first book on the subject.
I'm having a very difficult time selecting the database, using code that was printed in the book. I've made some of my own variations to the code to see more of what's happening in the process. Would an expert take a look and tell me what I'm doing wrong? I would greatly appreciate it. The output of the code is at My SQL Test (http://www.siddonsfire.com/sqltest.php) . The code looks like this:
<?php $user = "siddonsguest";
$host = "mysql01.powweb.com";
$password = "";
$today = date("M j, Y g:i:s a");
$database = "siddonsfire";
echo "Connecting to <i>$host</i> as <i>$user</i> on $today<br>\n";
$connection = "mysql_connect($host,$user,$password)" or die ("<br><B><H1>SQL Error: Could not connect to $connection.\n");
echo "You have successfully connected to <b>$host</b> as <b>$user.</b><br>\n";
mysql_select_db($database) or die ("<BR><B>SQL Error: Could not select the $database database.");
/* Display results in a table */
echo "<C><H1>Backlog</H1>";
echo "<table cellspacing='50'>";
echo "<tr><td colspan='5'><hr></td></tr>";
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<tr> \n
<td>$jobno</td> \n
<td>$workorder</td> \n
<td>$customer</td> \n
<td>$chassis</td> \n
<td>$body</td> \n";
}
?>
</table><br></body></html>
Would be very extactic if someone can see where my problem is. The siddonsguest user has all priv to database except drop and delete.
Corbin
I'm having a very difficult time selecting the database, using code that was printed in the book. I've made some of my own variations to the code to see more of what's happening in the process. Would an expert take a look and tell me what I'm doing wrong? I would greatly appreciate it. The output of the code is at My SQL Test (http://www.siddonsfire.com/sqltest.php) . The code looks like this:
<?php $user = "siddonsguest";
$host = "mysql01.powweb.com";
$password = "";
$today = date("M j, Y g:i:s a");
$database = "siddonsfire";
echo "Connecting to <i>$host</i> as <i>$user</i> on $today<br>\n";
$connection = "mysql_connect($host,$user,$password)" or die ("<br><B><H1>SQL Error: Could not connect to $connection.\n");
echo "You have successfully connected to <b>$host</b> as <b>$user.</b><br>\n";
mysql_select_db($database) or die ("<BR><B>SQL Error: Could not select the $database database.");
/* Display results in a table */
echo "<C><H1>Backlog</H1>";
echo "<table cellspacing='50'>";
echo "<tr><td colspan='5'><hr></td></tr>";
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<tr> \n
<td>$jobno</td> \n
<td>$workorder</td> \n
<td>$customer</td> \n
<td>$chassis</td> \n
<td>$body</td> \n";
}
?>
</table><br></body></html>
Would be very extactic if someone can see where my problem is. The siddonsguest user has all priv to database except drop and delete.
Corbin