Re: [PHP] Class Syntax Help or Globals issue

2004-06-04 Thread Bob Pillford
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


[PHP] syntax for printing multi-dimensional arrays

2004-03-23 Thread Bob Pillford
Hi all

I am having problems printing members of an array that has two 
dimensions and am wondering if someone can help me with the syntax 
required to do this.

If i have the follwing code:
?php
$test=array('test1'='a','test2'='b');
print $test[test1];
?
I get 'a' echoed to the screen as expected. But if i make the array 2 
dimensional like this:

?php
$test[0]=array('test1'='a','test2'='b');
print $test[0][test1];
?
I would expect to get 'a' echoed to the screen again but instead i get this:
Array[test1].
Has anyone seen this before and can help or point me to some goods docs 
on it?

Thanks in advance for any help

Cheers

Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] syntax for printing multi-dimensional arrays

2004-03-23 Thread Bob Pillford
Just found the answer so please disregard this.

Cheers

Bob

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] problem with mssql_query

2003-11-11 Thread bob pillford
Hi all i have the following code which isnt working correctly and i cant work out why. 
Any help would be greatly appreciated as its sending me crazy!

$query = select refno from campaign where appdate between 'nov 07 2003' and 'nov 08 
2003' ; 
$result=mssql_query($query,$numero);
$numrows=mssql_num_rows($result);
$row=mssql_fetch_row($result);
echo $numrows;
print_r($row);


Now this returns: 23
Array ( [0] = 1044998 ) 

which is 23 for number of rows the query returns but it only ever stores the 1st 
element of the returned array in $row.. Can someone tell me where i am going wrong as 
i need access to the other 22 rows that this query returns I have echoed the query 
and run the out put under freetds tsql and get the correct result (this is what i use 
to access the ms sql server 2000).

Any help would be greatly appreciated.!

Cheers

Bob