Re: php with mysql - multiple tables
| From: | Shahmat Dahlan | Date: | Mon, 16 Apr 2001 05:59:51 +0000 |
| Subject: | Re: php with mysql - multiple tables | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8591@lists.php.net to get a copy of this message | ||
printf("%s ", $myrow["equip_type"]); //no table name
did not work, and did not display the content
But if I apply the extract on $myrow, it worked..
extract($myrow);
printf("%s ", $equip_type);
Thanks
regards
CC Zona wrote:
> In article <3ADA7528.48F9485D@sains.com.my>,
> shahmatd@sains.com.my ("Shahmat Dahlan") wrote:
>
> > $result=mysql_query($sqlstmt);
> >
> > I know the $sqlstmt query does work. But if I do a mysql_fetch_array and
> > assign it to a variable called $myrow,
> >
> > while ($myrow=mysql_fetch_array($result)) {
> > ...
> > }
> >
> > how do I display the content array $myrow? When I do a,
> >
> > printf("%s ", $myrow["equip.equip_type"]);
> >
> > nothing is visible.
>
> $result=mysql_query($sqlstmt) or die("Oops! MySQL error: " .
> mysql_error()); //"know" the query is valid
>
> if(mysql_num_rows($result)) //"know" the query gave you something to fetch
> {
> while ($myrow=mysql_fetch_array($result))
> {
> ...
> }
> }
>
> Where "..." is:
>
> printf("%s ", $myrow["equip_type"]); //no table name
>
> or:
>
> extract($myrow);
> printf("%s ", $equip_type); //no table name and easier to read ;-)
>
> --
> CC
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net