I can`t get this block of code to work. I think there is something wrong with my syntax, but I can`t figure out what it is.
source code look like this:
[php]$stemmer=array(
array('stemme'=>'$ftenor', 'ref'=>'1.tenor', 'patch'=>'$ft'),
array('stemme'=>'$atenor', 'ref'=>'2.tenor', 'patch'=>'$at'),
array('stemme'=>'$fbass', 'ref'=>'1.bass'), 'patch'=>'$fb',
array('stemme'=>'$abass', 'ref'=>'2.bass'), 'patch'=>'$ab'); foreach($stemmer as $klasser) {
$query = "SELECT * FROM kor WHERE stemme=' ".$klasser['ref']." ' ";
$klasser['stemme'] = mysql_query($query) or die(mysql_error());
while( $klasser['patch']= mysql_fetch_array($klasser['stemme'])) {
[/php] etc.
when i try to use my "$klasser['stemme']" later in the script, i get:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource
Im new to PHP and MySQL so for all i know, the error might be fundamental. Is it even possible to use MySQL inside a foreach loop?