Reply to Re: Problems Connecting To MySQL

Your name:

Reply:


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.
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация