I have a class and a function and what I want to do is to “return” the value and input into another function.
Class test1 {
public function a($x) {
$runquery = "Select * FROM testdb where color_id = '{$x}'";
$result = mysql_query($runquery) or die(mysql_error());
$base_results = mysql_fetch_array($result);
$red = $base_results['red'];
}
public function c($red) {
$runsecond_query = "SELECT * test2db where $color = '{$red}'";
// write additional code
}
OK, so really what I would LIKE to do is to get the results from function “a” and input the result in function “c”. I hope that makes sense. Thanks to anyone in advance.
Since both functions are members of the same class, you can create a class property to store them: