Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional PHP6
|
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 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 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;
}
}
 
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 {
}

}





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





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