php-db | 2002091
Date: 09/13/02
- Next message: John Holmes: "RE: [PHP-DB] newbie help...parse error"
- Previous message: Rodrigo: "[PHP-DB] Need help.."
- In reply to: Rodrigo: "[PHP-DB] need help!!!!!"
- Next in thread: John Holmes: "RE: [PHP-DB] newbie help...parse error"
- Reply: John Holmes: "RE: [PHP-DB] newbie help...parse error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ok guys, this code gives me an error of
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in c:\program files\apache group\apache\htdocs\classroom.php on
line 17
What am I missing, I am sending a username from one screen and wanting to
grab the dbname from the table, then get data from the db that is specified
in dbname. I get the dbname fine but then I get errors.
Thanks,
Eddie
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("users",$db);
// display individual record
$result = mysql_query("SELECT dbname FROM users WHERE
username='$username'",$db);
$myrow = mysql_fetch_array($result);
printf("DBname: %s\n<br>", $myrow["dbname"]);
?>
<?php
$result=mysql_query("SELECT * from".$myrow["dbname"]."grades");
$myrow = mysql_fetch_array($result);
printf("Subject: %s\n<br>", $myrow["subject"]);
printf("Grade: %s\n<br>", $myrow["grade"]);
?>
</body>
</html>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: John Holmes: "RE: [PHP-DB] newbie help...parse error"
- Previous message: Rodrigo: "[PHP-DB] Need help.."
- In reply to: Rodrigo: "[PHP-DB] need help!!!!!"
- Next in thread: John Holmes: "RE: [PHP-DB] newbie help...parse error"
- Reply: John Holmes: "RE: [PHP-DB] newbie help...parse error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

