View Single Post
Old 07-13-2008, 09:54 PM   #2 (permalink)
drewbee
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

It is a good start! A few things:

You dont have the class instance variables x and y defined.

Code:
$this->x = $x;
$this->y = $y;
Below your database constant variables, put this
PHP Code:
var $x;
var 
$y
Now your assignments above can actually place these variables, and if you wanted to access what you recently put through the last function call:

PHP Code:
$class = new math;

try {
    echo 
$class->plus(2255);
    echo 
'We added ' $class->' + ' $class->y;
}
catch(
exception $e) {
    echo 
$e->getMessage();
}

?> 

MysqlI rules, doesn't it? :D

PHP Code:
$db = new mysqli('localhost''user''pass''database');
$query $db->query("SELECT col1, col2, col3 FROM table WHERE foo = 'bar'");

if (
$query->num_rows 0)
{
    while (
$row $query->fetch_array())
    {
        echo 
$row['col1'] . ' ' $row['col2'] . ' ' $row['col3'];
     }
}
else
{
    echo 
'no records found';

__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote