I am a fan of the kevin tutorial and currently am in part 4. I am having a problem. I copy and pasted kevin's html to contact the jokes database with php and put all the appropiate stuff and in write cases and everything and doublechecked and checked that the commands were working in the mysql prompt, and all it does is display the html part of the code, here is the code minus the login info:
<HTML><HEAD><TITLE> Our List of Jokes </TITLE><HEAD><BODY><?php
// Connect to the database server $dbcnx = @mysql_connect("host", "user", "pass"); 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>
<? // Request the text of all the jokes $result = mysql_query("SELECT JokeText FROM Jokes"); if (!$result) { echo("<P>Error performing query: " . mysql_error() . "</P>"); }
// Display the text of each joke in a paragraph while ( $row = mysql_fetch_array($result) ) { echo("<P>" . $row["JokeText"] . "</P>"); }
?>
</BLOCKQUOTE></BODY></HTML>
I really need help as I cant move on the tutorial and I want to see if I can write a pretty simple email collecting script but I need the MySQL part to work first. The reason I am so dumbfounded is because it doesnt return any errors.
It coul;d jsu tbe your display but it appears you have your connect statement on the same line as a comment so it is comenting out this connect statement.
On secoond thought it appears you have evrything commented out, so your @ error checking would not be recoginized, make sure you put everthing that isn't a comment on a new line ie.
// Connect to the database server
$dbcnx = @mysql_connect("host", "user", "pass");
if (!$dbcnx) { echo( "<P>Unable to connect to the " . "database server at this time.</P>" );
exit();
}
Bookmarks