Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2002091

RE: [PHP-DB] newbie help...parse error From: Jim Hunter (jim <email protected>)
Date: 09/13/02

From what I can tell, you are missing a space after the keyword FROM in the
select statement.

> $result=mysql_query("SELECT * from".$myrow["dbname"]."grades");
                                                                    ^

Insert a space and the query should work fine, or at least you will be
closer to the truth.

Jim

 
-------Original Message-------
 
From: holmes072000 <email protected>
Date: Friday, September 13, 2002 14:06:32
To: 'Edward Peloke'; 'PHP'
Subject: RE: [PHP-DB] newbie help...parse error
 
That usually means your query failed, are you checking for errors using
mysql_error()?

---John Holmes...

> -----Original Message-----
> From: Edward Peloke [mailto:epeloke <email protected>]
> Sent: Friday, September 13, 2002 5:12 PM
> To: PHP
> Subject: [PHP-DB] newbie help...parse error
>
> 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



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

.