Re: php+mysql simple query help me pls! ty.
| From: | louie miranda | Date: | Thu, 03 Jan 2002 20:18:11 +0000 |
| Subject: | Re: php+mysql simple query help me pls! ty. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79355@lists.php.net to get a copy of this message | ||
yes, i forgot something,
this = mysql_select_db("mydb",$db);
i did not specify my db name.
thanks :)
louie
----- Original Message -----
From: "Rick Emery" <remery@excel.com>
To: "'louie miranda'" <louie@chikka.com>; <php-db@lists.php.net>
Cc: <php-general@lists.php.net>
Sent: Friday, January 04, 2002 4:06 AM
Subject: RE: [PHP-DB] php+mysql simple query help me pls! ty.
> Test the mysql_query() return value:
> $result = mysql_query("SELECT * FROM members") or
> die("Error:".mysql_error());
>
> there may be an error in your query.
>
> -----Original Message-----
> From: louie miranda [mailto:louie@chikka.com]
> Sent: Thursday, January 03, 2002 1:59 PM
> To: php-db@lists.php.net
> Cc: php-general@lists.php.net
> Subject: [PHP-DB] php+mysql simple query help me pls! ty.
>
>
> Hi, can someone help me here! :(
> I can't query the data on my sql from php.
> db is fine, i couldnt see the prob in php!
> pls help, ty.
>
>
>
> # MSQL #######################################################
> mysql> desc members;
> +----------+-------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +----------+-------------+------+-----+---------+----------------+
> | id | tinyint(5) | | PRI | NULL | auto_increment |
> | ircname | varchar(30) | YES | | NULL | |
> | email | varchar(30) | YES | | NULL | |
> | realname | varchar(40) | YES | | NULL | |
> | asl | varchar(30) | YES | | NULL | |
> | info | varchar(70) | YES | | NULL | |
> +----------+-------------+------+-----+---------+----------------+
>
>
>
> # PHP ########################################################
> <html>
> <body>
>
> <?php
>
> $db = mysql_connect("my_db_host", "my_db_user", "my_db_pass")
> or die("Could not connect");
>
> mysql_select_db("mydb",$db);
>
> $result = mysql_query("SELECT * FROM members",$db);
>
> printf("ircname: %s<br>n", mysql_result($result,0,"ircname"));
> printf("email: %s<br>n", mysql_result($result,0,"email"));
> printf("realname: %s<br>n", mysql_result($result,0,"realname"));
> printf("asl: %s<br>n", mysql_result($result,0,"asl"));
> printf("info: %s<br>n", mysql_result($result,0,"info"));
>
> ?>
>
> </body>
> </html>
>
>
> # ERROR ############################################################
>
>
> Warning: Supplied argument is not a valid MySQL result resource in
> /mnt/host-users/cavite/irc/members/t2.php on line 13
> ircname:
> n
> Warning: Supplied argument is not a valid MySQL result resource in
> /mnt/host-users/cavite/irc/members/t2.php on line 14
> email:
> n
> Warning: Supplied argument is not a valid MySQL result resource in
> /mnt/host-users/cavite/irc/members/t2.php on line 15
> realname:
> n
> Warning: Supplied argument is not a valid MySQL result resource in
> /mnt/host-users/cavite/irc/members/t2.php on line 16
> asl:
> n
> Warning: Supplied argument is not a valid MySQL result resource in
> /mnt/host-users/cavite/irc/members/t2.php on line 17
> info:
> n
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>