Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 30th, 2006, 10:14 PM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble understing code

Here is the code that i got from "Beginning PHP5,Apache, MySQL. Web Development" book.

function get_director(){
         global $movie_director;
     global $director;

$query_d = "SELECT people_fullname FROM people WHERE people_id = '$movie_director'";

     $results_d = mysql_query($query_d)
             or die(mysql_error());
     $row_d = mysql_fetch_array($results_d);
     extract($row_d);
     $director = $people_fullname;
 }

My question are where did $people_fullname's value come from and if the value is from "extract($row_d), then how did $people_fullname get the value from "extract($row) ?

 
Old July 13th, 2006, 01:29 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

Your query statement is to get values for fieldname people_fullname from table people. The values could be an array of rows retrieve for the query statement or just one row. extract($row_d); is the same as listing of record values from your statement which in this case is only one column/field that is people_fullname.
hope this helps,
jmaronilla





Similar Threads
Thread Thread Starter Forum Replies Last Post
If Else Trouble Cibressus Beginning PHP 0 May 1st, 2007 02:04 PM
Please i have had a Trouble hurted Wrox Book Feedback 1 June 28th, 2004 02:18 AM
Trouble with Chapter 3 mickmo2000 BOOK: Professional Crystal Reports for VS.NET 0 February 13th, 2004 05:16 PM
trouble databass Classic ASP Databases 2 August 16th, 2003 10:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.