I am just getting my head around classes, so forgive me if this is a
schoolboy error!
In order to learn I am re-writing my content management system and am in the
process of writing an HTML.class and a MYSQL.class.
so far so good. I spawn new instances of a table for example, sending
parameter,and a table is output.
now in my MYSQL.class- I want to send a query to my class which then returns
an array- my database row or rows.
the problem is that whilst my array is created- I only seem to be able to
manipulate it within my MYSQL class. This is not satisfactory as I really
want to be able to send it on to my HTML.class for formatting etc.
I obvioulsy do not want to format any 'echoed' output from within my
databasee class.
Here is a bit of sample code-
Once my database is open I call my query like this-
$TemplateTable = new DB;
$TemplateTable->mysql_query('SELECT * FROM template ORDER BY name ASC LIMIT
10');
This is the function within my MYSQL.class
function mysql_query($query){
$a= 0;
while($row=mysql_fetch_row($SQL)) {
$new_row = join('***',$row);
$result[] = $new_row;
echo $result[$a]."<br>";
$a++;
}
}
So here I am creating a string with each row in my database which is
delimted by *** -> $new_row.and am placing each row in anew array called
$result.
I can evaluate and format either $new_row or $result from within
mysql_query() but I really want to do is to send it on to another funtion or
even better another class- or access the values glabbally as variables.
Any ideas or am I missing something really obvious?
Thanks in advance
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php