RE: [PHP] HELP!!!
| From: | Matthew Clark | Date: | Wed, 05 Jul 2000 23:14:17 +0000 |
| Subject: | RE: [PHP] HELP!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5096@lists.php.net to get a copy of this message | ||
I imagine your connection
> $mysql_link = mysql_connect();
has failed, so $mysql_link has a value of 0....
with no arguments, mysql_connect assumes no password and will assume the
username that owns the http process (usually "nobody" or "webuser" or
something similar)
to see if it IS failing, try
$mysql_link = mysql_connect() or die(mysql_errno().":".mysql_error());
perhaps you meant
$mysql_link = mysql_connect($dbhost, $dbuser, $dbpass);
HTH
Matthew Clark.
>-----Original Message-----
>From: Joel Johnston [mailto:strobe@texas.net]
>Sent: 06 July 2000 12:05 AM
>To: php-general@lists.php.net
>Subject: [PHP] HELP!!!
>
>
>I'm a newbie!! now that thats outta the way, I need help. I'm trying to
>do a simple query to my MySQL datasource. Whenever I do a query and try
>to report anything from the results I get the following error.
>
>
>Warning: 0 is not a MySQL result index in
>/usr/local/etc/httpd/htdocs/sanddollarauto.com/php3/testconnect.php3 on
>line 23
>
>It doesn't matter what the query contains or how it is output. I get
>this error no matter what I do. I'm a Cold Fusion Developer and am new
>to PHP but shouldn't the following code work?
>
>
> <?php
>
> $dbuser = 'root';
>
> $dbhost = 'localhost';
>
> $dbpass = 'password';
>
> $dbname = 'sand';
>
> $dbtble = 'new_cars';
>
> $mysql_link = mysql_connect();
>
> $column =
>mysql_list_fields($dbname,$dbtble,$mysql_link);
>
>
> {
> print mysql_field_name($column,1)."<br>";
> }
>
> ?>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>