You are here: Re: code checking « All PHP « IT news, forums, messages
Re: code checking

Posted by Steve on 11/10/06 03:14

| The db.class.php file - I am using Zend and it reports that there is
syntax
| errors on lines 4 & 5
|
| static private $_instance = null;
| static private $_lastStatement = '';

the above is only supported in php 5. if using php < 5, then you'd declare
your variables as:

var $_instance = null;
var $_lastStatement = '';

also, you'll need the replace instances of self::<whatever> to
$this-><whatever>. when you use the db::execute or db::describe, you'll need
to change that too. first, you'll need to:

$db = new db();

and then change those calls to:

$db->execute

and

$db->describe

also, you'll need to change the __construct to:

function db();

i'm trying to remember what else come into play, off the top of my head.
anyway, the good news is that i wrote the report class prior to php 5 and
have yet to convert it...so you won't have to do anything to it.

i don't use zend nor do i use pear...too much bloat for me. anyway, you can
do away with all the db class stuff and use pear db to do the query. just
make sure the records are returned in a similar format at what the
db::execute method does:

$record[] => array(fieldNames => values);


| I haven't tried running the code yet so I'm not sure if they will parse -
| just wondering why it doesn't like it.

probably version problems.

| As I said right in my first message ... I code with an open book in one
hand
| ... So this is going to sound real stupid ... How do I pass your
| db.class.php my connections details ... I am reading but getting into a
| deeper and deeper hole
| @tm I am going with:
| require_once('./inc/dbc.inc.php');
| @mysql_query($sql);
| To replace
| db::execute($sql);

the php 5 way to get a connection would be:

db::connect('localhost', 'userName', 'password', 'catalog/dbName');

the php < 5 way is to create an instance of the class and then use the
instance:

$db = new db();
$db->connect('localhost', 'userName', 'password', 'catalog/dbName');

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация