Below is two scripts. The first one connects fine. The second gives the
following error.

Parse error: parse error in /usr/www/users/abc/connect.php on line 1

What is the problem with the second script? Thanks in advance - Craig

#1 - Works
---------------------------------------
<HTML>
<HEAD>
<TITLE> Our List of Jokes </TITLE>
<HEAD>

<BODY>
<?php
// Connect to the database server
$dbcnx = @mysql_connect("localhost", "root", "DWZ9bBXe");
if (!$dbcnx) {
echo( "<P>Unable to connect to the" . "database server at this time.</P>" );
exit();
}
// Select the jokes database
if (! @mysql_select_db("jokes") ) {
echo( "<P>Unable to locate the joke" . "database at this time.</P>" );
exit();
}
?>
<P> Here are all the jokes in our database: </P>
<BLOCKQUOTE>
<?php

// Request the text of all the jokes
$result = mysql_query("SELECT JokeText FROM jokes");
if (!$result) {
echo("<P>Error performing query: " . mysql_error() . "</P>");
exit();
}
// Display the text of each joke in a paragraph
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["JokeText"] . "</P>");
}
?>
</BLOCKQUOTE>
</BODY>
</HTML>
---------------------------------------
---------------------------------------

#2 Errors
---------------------------------------
<html>
<head>
<title>Connect to a MySQL Server</title>
</head>

<body>
<?php

$dbcnx = @mysql_connect("localhost", "root", "DwZ9bBXe");

if ($dbcnx != FALSE)
{
 print "The connection to the server was made successfully.";
}
else
{
 print "The connection to the server failed.";
}

mysql_close($dbcnx);

?>

</body>
</html>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to