|
Posted by paul on 08/02/05 05:24
MBS wrote:
....
> // Connect to the database server
> $dbcnx = @mysql_connect('localhost', 'root', 'mypasswd');
> if (!$dbcnx) {
> exit('<p>Unable to connect to the ' .
> 'database server at this time.</p>');
> }
> // Select the jokes database
> if (!@mysql_select_db('ijdb')) {
> exit('<p>Unable to locate the joke ' .
> 'database at this time.</p>');
> }
....
>
> $result = @mysql_query('SELECT joketext FROM joke');
> if (!$result) {
> exit('<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>';
>
> The problem is that the HTML produced stops after the <body> tag.
But you aren't getting any results from those error trapping thingies?
Try putting print statements in there along the way to debug what's
happening at each step.
In front of:
if (!$dbcnx) {
put:
print "$dbcnx; //debug
etc.
> Also,
> looking at my MySQL log, I do not see that any connection was made.
>
> I also tried mysqli_connect as well. That didn't work, either.
>
> Thanks.
>
Navigation:
[Reply to this message]
|