Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional PHP6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional PHP6
This is the forum to discuss the Wrox book Professional PHP6 by Edward Lecky-Thompson, Steven Nowicki; ISBN: 9780470395097
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 31st, 2011, 05:39 AM
Registered User
 
Join Date: Mar 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Post 6章中的 public function __call() {}

第六章:abstract class DataBoundObject
$arArguments 用 $strArguments=NULL替换是不是更好呢?

public function __call($strFunction, $strArguments=NULL)
{
$strMethodType = substr($strFunction, 0, 3);
$strMethodMember = substr($strFunction, 3);
if($strMethodType == 'set') {
return ($this->SetAccessor($strMethodMember, $strArguments));
}
else if($strMethodType == 'get') {
return ($this->GetAccessor($strMethodMember));
}
else {
return false;
}
}
  #2 (permalink)  
Old March 31st, 2011, 05:50 AM
Registered User
 
Join Date: Mar 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Post 第6章中的 public function load() {}的PRIMARY KEY (`id`)问题

第6章中的 public function load() {}的PRIMARY KEY (`id`)问题

if table's PRIMARY KEY is user_id now your load(); is not very General
and other table's PRIMARY KEY is sq_id and so on load(); need change it every different PRIMARY KEY

and second
if i want return like this
[SELECT u.`ipaddress`, s.`title` FROM `u_user` u, `subject` s WHERE u.`id`=s.`rid` order by ......]
now this load(); and this function can not use it

public function load()
{
if(isset($this->ID)) {
$strQuery = "SELECT ";
foreach($this->arrRelationMap as $key=>$value) {
$strQuery .= "`".$key."`,";
}
$strQuery = substr($strQuery, 0, strlen($strQuery) -1);
$strQuery .= " FROM ".$this->strTableUse." WHERE `id` = :zid";
$objState = $this->objPDO->prepare($strQuery);
$objState->bindParam(':zid', $this->ID, PDO::PARAM_INT);
$objState->execute();
$arrRow = $objState->fetch(PDO::FETCH_ASSOC);
foreach($arrRow as $key=>$value) {
$strMember = $this->arrRelationMap[$key];
if(property_exists($this, $strMember)) {
if(is_numeric($value)) {
eval('$this->' . $strMember . ' = ' . $value . ';');
}
else {
eval('$this->' . $strMember . ' = "' . $value . '";');
}
}
else {
}
}
$this->blIsLoaded = true;
}
else {
}

}
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
public article - public articledetails _keysersoze_ BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 8th, 2007 08:38 AM
public sub or function ? kscase Visual Basic 2005 Basics 3 May 20th, 2007 03:14 PM
Public classes myousman ASP.NET 1.0 and 1.1 Professional 4 October 23rd, 2006 01:18 PM
public function execute = HELP! Return value ? davidkwang VS.NET 2002/2003 0 April 28th, 2004 12:18 PM



All times are GMT -4. The time now is 10:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.