I'm using mysql_fetch_object
in my code, and am getting an error because the object I am trying to create an instance of has a constructor.
The error is as follows: Warning: Missing argument 1 for Ratio::__construct() in /Users/Alex/Sites/All Good Things/_manage/c/c_ratio.php on line 9
Which I can understand; here's the code for the Ratio
constructor:
function __construct($new_name, $new_x, $new_y)
{
$this->name = $new_name;
$this->x = $new_x;
$this->y = $new_y;
}
Anyway, how do I pass variables from the result I have just created to the function, ie, What I what to do is something like this:
while ($currentRatio = mysql_fetch_object(
$ratio_rs,
'Ratio',
array(
<VALUE OF NAME>,
<VALUE OF X>,
<VALUE OF Y>)))
I can't find any examples of the syntax required for this third parameter.
name
is a column, first the data will be fetched from the database, then the constructor will be called with your parameters and thenname
will be overwritten by your constructor code. Probably that's already intended, just saying.