php+mysql simple query help me pls! ty.
| From: | louie miranda | Date: | Thu, 03 Jan 2002 19:58:45 +0000 |
| Subject: | php+mysql simple query help me pls! ty. | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-general+get-79351@lists.php.net to get a copy of this message | ||
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