note 66751 added to language.oop
| From: | phenixcm at hotmail dot com | Date: | Sat, 27 May 2006 23:26:02 +0000 |
| Subject: | note 66751 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-112420@lists.php.net to get a copy of this message | ||
##PG2##
#######################################
Here is how to execute those classes, and to display results :
[...]
$helps=new Helps();
$helps->constraint(" WHERE help_pid='".$_GET["pid"]."' LIMIT
".$beg.",10");
$helps->read();
$hs=new Helps();
$hs->constraint(" WHERE help_pid='".$_GET["pid"]."'");
$hs->read();
$total=$hs->size();
if($helps->size()>0) {
if(($beg-10)<0) $debmin=-1;
else $debmin=$beg-10;
foreach($helps->hlp as $h) {
echo"<b>".$h->question."</b><blockquote>".$h->answer
."</blockquote>".BR;
$beg++;
}
if($beg>=$total) $debmax=-1;
else $debmax=$beg;
}
else {
echo"<i>.../i>";
$debmin=$debmax=-1; }
[...]
## ($debmin/$debmax/$beg are used only to manage 'previous/next' page;
## BR is an 'housemande' equal to "<br /><br />")
#######################################
AND here is how to used classes to manage the DB :
[...]
if($_GET["act"]=="add") {
$q=new Help("",$_POST["aid"],writ($_POST["question"]),
writ($_POST["answer"]));
$q->add();
}
elseif($_GET["act"]=="up") {
$q=new Help($_POST["id"],$_POST["aid"],
writ($_POST["question"]),writ($_POST["answer"]));
$q->update();
}
elseif($_GET["act"]=="del") {
$q=new HelpId($_POST["id"]);
$q->del();
}
[...]
## (writ() is an "homemade" function)
Hope u will like this way to script php4 classes.
It looks very powerfull to me ... but still looking for optimisation
(reducing time processing, size (octets) of files transmitted, better,
quicker and more secured way to access data)
If any comment, question or information to exchange,
dont hesitate to contact me on my email address phenixcm at hotmail dot com ...
----
Server IP: 217.174.203.10
Probable Submitter: 81.56.15.249
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.oop.php
Edit -- http://master.php.net/note/edit/66751
Del: integrated -- http://master.php.net/note/delete/66751/integrated
Del: useless -- http://master.php.net/note/delete/66751/useless
Del: bad code -- http://master.php.net/note/delete/66751/bad+code
Del: spam -- http://master.php.net/note/delete/66751/spam
Del: non-english -- http://master.php.net/note/delete/66751/non-english
Del: in docs -- http://master.php.net/note/delete/66751/in+docs
Del: other reasons-- http://master.php.net/note/delete/66751
Reject -- http://master.php.net/note/reject/66751
Search -- http://master.php.net/manage/user-notes.php