Jump to content

Where am i going wrong here!


jkkenzie

Recommended Posts

The below part which is found in full code below it, causes my result on my page to disappear i.e no result come out at all. where am i going wrong? I have /* */ it so that it gives me results but i need this part of the code to work to complete my results. Does php dont go beyond this point?

/* while($rows13 = mysql_fetch_array($getresults2))
		 {
		 $sum=$sum+$rows13['Par_Value'];
		 $n++;
		 }*/

 

 

Full code here...

<?php
//get project id
$getproid = mysql_query("SELECT projectid FROM tblprojects WHERE projectname='".$_POST['project']."'");
$proidval = mysql_fetch_assoc($getproid);
$proid = $proidval['projectid'];
//get parameter id
$getparid = mysql_query("SELECT Par_Id FROM tblparameter WHERE strName='".$_POST['parametername']."'");
$paridval = mysql_fetch_assoc($getparid);
$parid = $paridval['Par_Id'];

//Get countries and their parameter values according to users Project
$getresults = mysql_query("SELECT DISTINCT strCountry FROM tblcountries WHERE Par_Id='$parid' AND projectid='$proid' ORDER BY strCountry");
$count=0;
        while($rows11 = mysql_fetch_array($getresults))
	{
	$countryname[]=$rows11['strCountry'];
	$count++;
	 }
echo "<table border='1' align='center'>
<tr>               
         <b>YOUR PROJECT DATA</b></tr>
<tr>";		 
$count2=0;		 
	while($count2<=$count)
	{
	echo "<th>".$countryname[$count2]."</th><th> A Values</th><th> C Values</th>";
	echo"</tr>";
	echo "<tr>";
	$getresults2 = mysql_query("SELECT Par_Value FROM tblcountries WHERE Par_Id='$parid' AND projectid='$proid' AND strCountry='$countryname[$count2]' ORDER BY strCountry");
            $n=0;
		$sum=0;
		/* while($rows13 = mysql_fetch_array($getresults2))
		 {
		 $sum=$sum+$rows13['Par_Value'];
		 $n++;
		 }*/
             while($rows12 = mysql_fetch_array($getresults2))
             { 			 
             echo "<tr><td>" . $rows12['Par_Value'] . "</td>";
		 $a2 = $rows12['Par_Value']*$rows12['Par_Value'];			
		 $A= sqrt(1/$n*$sum*$a2);
             echo "<td>".$A ."</td>";
		 echo "<td>C</td></tr>";
             }
		 echo "</tr>"; 
	$count2++;
	}

echo "</table>";

?>	

 

Thanks in advance...

 

Regards,

Joseph

Link to comment
https://forums.phpfreaks.com/topic/104990-where-am-i-going-wrong-here/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.