What is wrong with this script?

wxdqz

New Member
This is the script, stripped down to the core so that the problems can be found, it obviously is connecting to the database, and selecting the table, but it gets the error message when trying to select the column, and then has a really screwed up problem with printing the script in the page rather than what is supposed to be output. After the page html stuff I have what it looks like in the web browser.


<HEAD>
<TITLE> Article Search </TITLE>
<HEAD>
<BODY>
<?php

// Connect to the database server
$dbcnx = @mysql_connect("database", "userid", "password");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" );
exit();
}

// Select the articles database
if (! @mysql_select_db("articles") ) {
echo( "<P>Unable to locate the articles " .
"database at this time.</P>" );
exit();
}

?>
<P> Results: </P>
<BLOCKQUOTE>

<?php

// Select article titles
$result = mysql_query("SELECT TITLE FROM articles");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}

// Display article titles
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["TITLE"] . "</P>");
}

?>

</BLOCKQUOTE>
</BODY>


Web browser output:

Results:

Error performing query: " . mysql_error() . "

"); exit(); } // Display article titles while ( $row = mysql_fetch_array($result) ) { echo("
" . $row["TITLE"] . "

"); } ?>

Can anyone help me with this please?

CDK
<!-- m --><a class="postlink" href="http://www.humanevolution.f2s.com">http://www.humanevolution.f2s.com</a><!-- m -->
 
Back
Top