You are here: Re: Strange class OOP behavior « PHP SQL « IT news, forums, messages
Re: Strange class OOP behavior

Posted by nithin on 08/29/07 05:57

Hi i tried with your coding in my local server its working fine for
me..

I thing you may gone wrong some other part of the coding...


test using the following code:
create a database: testdb
A table users add a field 'username'

then try with this coding bellow

<?php
$con = mysql_connect('localhost','root','');
$db = mysql_select_db('testdb');
class test {
private $_result;
private $_record;
public function __construct($result) {
$this->_result = $result;
}
public function show() {
while($this->_record = mysql_fetch_array($this->_result)) {
echo $this->_record['username'].'<br />';
}
}
}

# usage
# sql statement dat artikels ophaald uit cartal database
$sql = "SELECT * FROM users";
# uitvoeren van dit statement
$RESULT = mysql_query($sql);
$t = new test($RESULT);

$t->show();
?>

 

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

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