Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<!DOCTYPE html PUBLIC ">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<title>Enter details</title>
	<link href="fonts.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="css/textBoxStyle.css" />
	<style type="text/css">
		<!--
		table.menu {
			font-size:100%;
			position:absolute;
			visibility:hidden;
			width: 177px;
			background-color: #E5E5E5;
		}
		-->
	</style>


	<script type="text/javascript">
		function showmenu(elmnt)
		{
			document.getElementById(elmnt).style.visibility="visible"
		}
		function hidemenu(elmnt)
		{
			document.getElementById(elmnt).style.visibility="hidden"
		}
	</script>

	<SCRIPT LANGUAGE="JavaScript">

		function put()
		{
			var x, y, z,e,f;
			x = document.form['En_no'].value;
			e='.jpg';
			z='Images/';
			document.form['img'].value =  z+x+e;

		}


	</script>

	<link href="../fonts.css" rel="stylesheet" type="text/css" />
</head>

<html>
	<style type = "text/css">
		body{background-image :url(bag.jpg);}
	</style>
<?php <br mode="hold" /?>

	$dtbase=$_POST["dtbase"];
	$exam=$_POST["exn"];

	$conn = mysql_connect("localhost","root", "");
	mysql_select_db($dtbase,$conn);
	if(is_resource($conn))
	$sqlname="SELECT * from examnames WHERE  name= '$exam'";
	$resultname=mysql_query($sqlname, $conn);
	$sqldel="DROP TABLE passstud"."_"."$exam";
	$resultdel=mysql_query($sqldel, $conn);

	$sqlall="CREATE TABLE passstud"."_"."$exam(id integer,total integer,percent float)";
	$resultall=mysql_query($sqlall, $conn);



	$conn = mysql_connect("localhost","root", "");
	mysql_select_db($dtbase,$conn);
	$sqlqa="SELECT * from $exam";
	$resultqa=mysql_query($sqlqa, $conn);
	$num=mysql_num_rows($resultqa);

	$sqlmarks="SELECT maxmarks,passmarks from examnames WHERE name= '$exam'";
	$resultmarks=mysql_query($sqlmarks, $conn);


	$conn = mysql_connect("localhost","root", "");
	mysql_select_db($dtbase,$conn);
	$sql12= "DROP TABLE del";
	$resultdb=mysql_query($sql12, $conn);


	$conn = mysql_connect("localhost","root", "");
	mysql_select_db('result_analysis',$conn);
	$sql23="DROP TABLE del";
	$result23=mysql_query($sql23, $conn);


	function avg($count,$num)
	{
		$av=($count/$num)*100;
	
		echo"Total Passing %=$av";
		return $av;

	}

	function per($tt,$mm)
	{
		$mm1=$mm*5;
		$re=($tt/$mm1)*100;
		return $re;
	}

	function total($m1,$m2,$m3,$m4,$m5)
	{
		$sum=0;
		$sum=$sum+$m1;
		$sum=$sum+$m2;
		$sum=$sum+$m3;
		$sum=$sum+$m4;
		$sum=$sum+$m5;
		echo"Total=$sum";
		return $sum;
	}

	function pass($s11,$s12,$s13,$s14,$s15,$pm)
	{

	$count=0;
	if($s11<$pm)
		{
		$count++;
		}
	if($s12<$pm)
		{
		$count++;
		}
	if($s13<$pm)
		{
		$count++;
		}
	if($s14<$pm)
		{
		$count++;
		}
	if($s15<$pm)
		{
		$count++;
		}
	return $count;
	}
	?>

<body>
	<center>
		<table>
			<tr>
				<th>

					<img src="m.jpg" height="100" width="100" alt="logo"  />

				</th>

				<th>

					<img src="resultan.jpg" height="90" width="700" alt="logo"  />
				</th>
			</tr></table></center>

			<hr />
			<hr />

			<div align="center"></div>
			<table width="754" border="0" align="center" cellpadding="0" cellspacing="2">
				<table width="99%" border="0" align="center" cellpadding="5" cellspacing="0">
					<tr>
					</tr>
				</table>

				<div class="form-style-6" style="max-width: 747px; margin:1px 305px;">
					<h1> OverAll Batch Report For <?php echo"$exam"; ??></h1>
					&lt;form id="form" name="form" method="post" action= "in1.php" >
						<div>



							<table border="border" width="600">

								<?php     <br mode="hold" /?> $row = mysql_fetch_assoc('$resultmarks',MYSQL_ASSOC) ?>

								<?php $mm= $row['maxmarks'];  ??>

								<?php $pm= $row['passmarks']; ??>

								<tr>

									<br><br>


									<table border="border" width="600" cellspacing="2" cellpadding="5" style="border: 3px limegreen solid; color: darkgreen; background-color: buttonface;">

										<?php <br mode="hold" /?>		 $row = mysql_fetch_assoc('$resultname',MYSQL_ASSOC) ?>
										<tr>
											<td><h3><?php echo"ID"; ??></h3> </td>
											<td> <h3><?php echo $row['s1']; ??></h3> </td>
											<?php $s11= $row['s1']; ??>
											<td> <h3><?php echo $row['s2']; ??> </h3></td>
											<?php $s12= $row['s2']; ??>
											<td><h3> <?php echo $row['s3']; ??> </h3></td>
											<?php $s13= $row['s3']; ??>
											<td><h3> <?php echo $row['s4']; ??></h3> </td>
											<?php $s14= $row['s4']; ??>
											<td><h3> <?php echo $row['s5']; ??> </h3></td>
											<?php $s15= $row['s5']; ??>
											<td><h3><?php echo"Total";??></h3></td>
											<td><h3><?php echo"Total Failed Subjects";??></h3></td>

										</tr>

										<?php $count=0;<br mode="hold" /?>		 while($row = mysql_fetch_assoc('$resultqa',MYSQL_ASSOC)) { ?>
										<tr>
											<td><h4> <?php echo $row['id']; ??> </h4></td>
											<?php $id1=$row['id']; ??>
											<td> <h4><?php echo $row[$s11]; ??></h4> </td>
											<?php $m1=$row[$s11]; ??>
											<td><h4> <?php echo $row[$s12]; ??> </h4></td>
											<?php $m2=$row[$s12]; ??>
											<td><h4> <?php echo $row[$s13]; ??></h4> </td>
											<?php $m3=$row[$s13]; ??>
											<td> <h4><?php echo $row[$s14]; ??> </h4></td>
											<?php $m4=$row[$s14]; ??>
											<td><h4> <?php echo $row[$s15]; ??> </h4></td>
											<?php $m5=$row[$s15]; ??>
											<td><h4> <?php $tt=total($m1,$m2,$m3,$m4,$m5);??></h4></td>
											<?php $co=pass($m1,$m2,$m3,$m4,$m5,$pm); ??>
											<?php  if($co==0)<br mode="hold" /?>                                                                   {
											$perc=per($tt,$mm);
											$count++;
											$conn = mysql_connect("localhost","root", "");
											mysql_select_db($dtbase,$conn);
											$sqlall1="INSERT into passstud"."_"."$exam values('$id1','$tt','$perc')";
											$resultall1=mysql_query($sqlall1, $conn);

											}?>
											<td><h4><?php echo"$co";??></h4></td>

											<?php } ??>
										</tr>
									</table></br></br></tr>





								</table>
								<br>

								<h3><?php echo"Total No of Students Appeared:   $num";??></h3>
								<h3><?php echo"Total No of Students passed:   $count";??></h3>
								<h3><?php avg($count,$num); ??></h3>


								<a href="repeortmenu3.php">&lt;input type="button" name="id" value="Main Page"></a>

							&lt;/form>

						</br></div></div></table>
					</body>

				</html>


What I have tried:

changing mysql_fetch_array() to mysql_fetch_assoc() but then it says ,resouce has to be used, string used
Posted
Updated 8-May-16 4:26am
v3
Comments
Mohibur Rashid 8-May-16 19:00pm    
In simple words, your query failed. Write your query into a log file, copy that query and run from console and see what happens.

We usually complain that there is too little information in the questions, but this is too much. And badly formatted as well.

Make a small test PHP file with the relevant lines of code, and see if you can solve the problem yourself. Go to for example PHP mysqli_fetch_array() Function[^] to learn about fetch_array.

If you still have problems, update your question with a relevant, well formatted code snippet and tell us what you expected to happen and what really happened.

Remember, you are the one that needs help so make it easy for people to help you.
 
Share this answer
 
Comments
Member 12509939 8-May-16 9:36am    
i have a complete project with same errors, and i cannot solve it,will u please help me with it. i know its too much to ask. but plz can u help me
George Jonsson 8-May-16 10:27am    
Did you create a small PHP test file?
Instead of trying to find the error in a big chunk of code, it is usually easier to do something that focuses on the the area you have problems with.
Search for some examples for how to use the fetch_array() function and apply the method on you data table, make simple print outs and see what kind of results you get.
I formatted your code, it is a mess.
It is impossible to help you.
Use Improve question to update your question !

HTML
<!DOCTYPE html PUBLIC ">

The html page is not well formed
HTML
;<html>
is at wrong place
Put comment at lines with errors so we can spot the problems.
Extensive reformatting barely help to read that code.
As George Jonsson said, it is also a good idea to reduce code size.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900