Jump to content

Recommended Posts

I don't know what's wrong with this code. I think this code should work. I'm about to store number of each query in array

 

$antecedent=array();

for($i=0;$i<=$index;$i++){
if(isset($period[$i])|| isset($gpa[$i]) || isset($antecedent[$i])){
	echo $period[$i]." ";
	echo $gpa[$i]."<br/>";
  $queryAntecedent=mysql_query("SELECT * FROM mytable WHERE  study_period='$period[$i]' AND ipk='$gpa[$i]'") or die (mysql_error());	

	$antecedent[$i]=mysql_num_rows($queryAntecedent);
	}//endif
}//endfor

print_r ($antecedent);

 

when i print_r $antecedent, its output is all zero for every element. i've tried to run the query in phpmyadmin and the result is not zero..i got some rows of result.

 

i've echo $period[$i] and $gpa[$i], it printed the results.So, i think there's no problem with the the values of those two array.

 

So, why can't i get the total rows of query? why all element in antecedent array only gives me 0 number?Please help!

 

Thank you  :D

I tried to put only one array in query sintax...it works!!

 

 $queryAntecedent=mysql_query("SELECT * FROM mytable WHERE  study_period='$period[$i]'") or die (mysql_error());

 

what happen? how to solve this? I need to put two arrays in the query

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.