Results 31 to 40 of 42
-
6th Jul 2012, 08:08 AM #31MemberWebsite's:
imdber.org justpaste.me^What language is that, java?
-
6th Jul 2012, 08:10 AM #32Respected MemberWebsite's:
DL4Everything.com Soft2050.in
-
6th Jul 2012, 08:17 AM #33MemberWebsite's:
mytinydick.comCode:<b>hello world</b>
Bad bitch in my chevy.
-
6th Jul 2012, 02:59 PM #34OPRespected DeveloperWebsite's:
X4B.org
-
28th Jul 2012, 04:45 PM #35Trusted WebmasterWebsite's:
KWWHunction.comHope to see this thread continue its life span
-
28th Jul 2012, 04:48 PM #36OPRespected DeveloperWebsite's:
X4B.orgYour wish is my command, nothing special just a excerpt of a rarely used but useful pattern
PHP Code:abstract class System {
abstract function toUrl();
abstract function onReceived(Transaction $p);
abstract function onSuccess();
// [...]
}
class UpstreamSystem extends System {
private $u;
function __construct($u){
$this->u = $u;
}
function toUrl(){
return $this->u->toUrl();
}
function onReceived(Transaction $p){
return $this->u->onReceived($p);
}
function onSuccess(){
return $this->u->onSuccess();
}
-
29th Jul 2012, 04:00 PM #37MemberPHP Code:
<?php
class Database
{
var $con;
var $sel;
var $res;
var $assoc;
var $escape;
var $array;
var $row;
function connect()
{
$this->con = mysql_connect("localhost", "host", "") or die(mysql_error());
$this->sel = mysql_select_db("test") or die(mysql_error());
}
function close()
{
if (isset($this->connect)) {
mysql_close($this->connect());
unset($this->connect);
}
}
function query($sql)
{
$this->res = mysql_query($sql) or die(mysql_error());
return $this;
}
function fetch($type)
{
switch ($type) {
case 1:
$this->assoc = mysql_fetch_assoc($this->res);
return $this;
break;
case 2:
$this->array = mysql_fetch_array($this->res);
return $this;
break;
case 3:
$this->row = mysql_fetch_row($this->res);
return $this;
break;
}
}
function escape($escape)
{
$this->escape = mysql_real_escape_string($escape);
return $this->escape;
}
function get($num, $col)
{
switch ($num) {
case 1:
return ($this->assoc[$col]);
break;
case 2:
return ($this->array[$col]);
break;
case 3:
return ($this->row[$col]);
break;
}
}
}
//initiate the database class
$database = new Database();
//connect to the database
$database->connect();
//run a query
$database->query("SELECT * FROM table");
//runs, chooses the type of query, and what collumn
$database->query()->fetch(1)->get(1,'username');
//close the database
$database->close();
?>
-
30th Jul 2012, 05:24 AM #38MemberWebsite's:
tehMoviez.com 0Senes.com GeekFaceGames.coman abstract class i use to fill in objects properties from an array
PHP Code:abstract class AbstractModel
{
public function fromArray(array $data) {
foreach ($data as $key => $value) {
if (property_exists($this, $key)) {
$this->{$key} = $value;
}
}
}
}
JokerHacker Blog
JokerHacker PHP coding Service // back again!
CurlAxel PHP Download Accelerator
hardly remembering the milk :p
-
1st Aug 2012, 01:32 PM #39MemberWebsite's:
imdber.org justpaste.me
-
1st Aug 2012, 01:39 PM #40MemberPHP Code:
<?php echo '<p>Hello KWWHunction, My Name is MrOSX & I am a PHP Virgin</p>'; ?>
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Plz Help To Add A Php Snippet Into My DLE Index !
By JoomlaZ in forum Web Development AreaReplies: 0Last Post: 7th Jul 2011, 01:18 PM -
[C#] Tiny Web Server (snippet)
By Hyperz in forum Web Development AreaReplies: 6Last Post: 24th Jun 2010, 01:19 PM -
Image Upload in php. Code snippet #2
By SplitIce in forum Tutorials and GuidesReplies: 5Last Post: 31st Oct 2009, 07:40 AM -
See real OOP (Snippet from Litewarez V2) Webmasters CP
By litewarez in forum Tutorials and GuidesReplies: 21Last Post: 19th Sep 2009, 03:59 PM -
A Snippet from my latest project
By litewarez in forum Tutorials and GuidesReplies: 19Last Post: 21st Jun 2009, 05:17 PM
themaCreator - create posts from...
Version 3.55 released. Open older version (or...