i made this code but it shows result
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\VertrigoServ\www\sanjay\rlc\closing.php on line 14

<?

include("admin/include/conn.php");

$today=date("Y-m-d H:i:s",strtotime("+5 hours, +30 minutes")); 
$c_closing="select * from member_information where child >=2";
$c_closing_query=mysql_query($c_closing);



while ($c_row=mysql_fetch_array($c_closing_query)) {
     	$c1_query="select * from member_information where Mem_sponsor_id=".$c_row['Id']." limit 0,1";
		$cl_result=mysql_query($c1_query);
		$c1_row=mysql_fetch_array($c1_result);
		$pair1=$c1_row['child'];
		
		
		$c2_query="select * from member_information where Mem_sponsor_id=".$c_row['Id']." limit 1,2";
		$c2_result=mysql_query($c2_query);
		$c2_row=mysql_fetch_array($c2_result);
		$pair2=$c2_row['29'];
		
		if($pair1>$pair2) {
			echo $pair=$pair2;
		}
		if($pair1<$pair2) {
			echo $pair=$pair1;
		}
		if($pair1==$pair2) {
			echo $pair=$pair2;
		}
		
		$binary_income=$pair*500;
		
		$b_query="insert into binary_income(reg_id,date,pair,binary_income) values (".$c_row['Id'].",'$today','$pair'.'$binary_income')"; 
		$b_result=mysql_query($b_query);
		
		$b_update="update member_information set child=0 where Id=".$c_row['Id']."";
		$b_result=mysql_query($b_update);
		
} ?>

please tell me where is the error

Recommended Answers

All 3 Replies

try

$c_closing_query=mysql_query($c_closing) or die(mysql_error());

Looks like your query returns an error. This will display it (assuming the connection to mysql succeeded).

can u give the table structure member_information or can u be sure that the column Mem_sponsor_id is present in the member_information table?

go with pritaeas suggestion

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.