yes, i forgot something,
this = mysql_select_db("mydb",$db);
i did not specify my db name.
thanks :)
louie
- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'louie miranda'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]]
> Sent: Thursday, January 03, 2002 1:59 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> 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
>
>
>
>
> $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: %sn", mysql_result($result,0,"ircname"));
> printf("email: %sn", mysql_result($result,0,"email"));
> printf("realname: %sn", mysql_result($result,0,"realname"));
> printf("asl: %sn", mysql_result($result,0,"asl"));
> printf("info: %sn", mysql_result($result,0,"info"));
>
> ?>
>
>
>
>
>
> # 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]