Thanks very much!
Marek Kilimajer wrote:
bob pilly wrote:
Hi All
I am new to classes and are trying to work out whether
they will make my coding experience easier. I have
written the following test class which is trying to
take three variables from a mssql query and add them
as variables in a new class. This isnt working as i
keep getting an error that says ;
Warning: Missing argument 1 for app() in
/var/www/htdocs/temp3.php on line 13
Warning: Missing argument 2 for app() in
/var/www/htdocs/temp3.php on line 13
Warning: Missing argument 3 for app() in
/var/www/htdocs/temp3.php on line 13
the code .
//a basic class to store basic appointment details in
class App {
var $name;
var $the_date;
var $result;
//add values to the variables
This is the function's constructor, it's called when you create a
class instance using new operator:
function App($app1name,$appdate,$appresult){
$this-name=$app1name;
$this-the_date=$appdate;
$this-result=$appresult;
}
}
$query=select app1name,appdate,appresult from
appresult where appdate 'jun 01 2004';
$qresult=mssql_query($query,$numero);//get the number
of rows returned
$numrow=mssql_num_rows($qresult);
if($row=mssql_fetch_array($qresult)){
$i=0;
do{
$j=$i;
So instead of:
$j= new App;
$j-App($row[app1name],$row['appdate'],$row['appresult']);
you have to suply the arguments to the contructor this way:
$j= new App($row[app1name],$row['appdate'],$row['appresult']);
}
while($row=mssql_fetch_array($qresult));
}
?
Is there a syntax problem with the way im trying to
pass the value of the $row array cells into the class
function?
I have looked at the online manual for classes but
find it a bit confusing on how to input and extract
variables data in classes. Any help or pointing in the
direction of some good docs would be greatly
appreciated!
thanks for any help in advance.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php