[PHP-DB] Error? new set of eyes...
Hello all, I have an error and I will be darned if I know why. Here is the code: ?php require '/path/to/database/connection/class/db.php'; $table = portfolio; $portfolio = mysql_query(SELECT * FROM $table,$dbh); while ($sections = mysql_fetch_array($portfolio)) { list($id, $2d, $3d, $web, $prog, $tut, $proj) = $sections; // I think the error is on this line. } ? Then I just echo the contents of the database array like so. ?php echo $2d; ? // this is line 69 And this is the error I am recieving: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /localhost/portfolio.php on line 169 Any help would be great!! Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error? new set of eyes...
Why don't you try this instead: while(list($id, $2d, $3d, $web, $prog, $tut, $proj)=mysql_fetch_array($portfolio)) { do whatever.. } the list construct only works with numerical arrays and it might not like the $section array (doesn't it get stored as number indicies AND column names? That might generate that error). But if you need that section array later, we can try a different approach.. ed At 07:15 AM 5/28/2002 -0600, Jas wrote: Hello all, I have an error and I will be darned if I know why. Here is the code: ?php require '/path/to/database/connection/class/db.php'; $table = portfolio; $portfolio = mysql_query(SELECT * FROM $table,$dbh); while ($sections = mysql_fetch_array($portfolio)) { list($id, $2d, $3d, $web, $prog, $tut, $proj) = $sections; // I think the error is on this line. } ? Then I just echo the contents of the database array like so. ?php echo $2d; ? // this is line 69 And this is the error I am recieving: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /localhost/portfolio.php on line 169 Any help would be great!! Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Edmund Gorski Programmer / Analyst WWW Coordinator Dept. District Office 727-341-3181 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error? new set of eyes...
On Tuesday 28 May 2002 21:15, Jas wrote: Hello all, I have an error and I will be darned if I know why. Here is the code: ?php require '/path/to/database/connection/class/db.php'; $table = portfolio; $portfolio = mysql_query(SELECT * FROM $table,$dbh); while ($sections = mysql_fetch_array($portfolio)) { list($id, $2d, $3d, $web, $prog, $tut, $proj) = $sections; // I think the error is on this line. } ? Then I just echo the contents of the database array like so. ?php echo $2d; ? // this is line 69 And this is the error I am recieving: Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /localhost/portfolio.php on line 169 Any help would be great!! Variable names cannot start with a digit. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Peace cannot be kept by force; it can only be achieved by understanding. -- Albert Einstein */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php