i am getting this warning
Warning: mysql_fetch_field() expects parameter 1 to be resource, boolean given in :\wamp\www\phpclasses\inserttestdetails.php on line 62
my code is
please help me in finding mistake
Expand|Select|Wrap|Line Numbers
- <?php
- //connection
- $con = mysql_connect("localhost", "", "");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- $db_selected = mysql_select_db("labreporter",$con);
- //getting selected check box fields into an array from an html page
- $testselection1 = $_POST['testselection'];
- //my array $alltestsarray=array("urinaryproteines","AEC","bgrhtype", "aia","agr","apt","cmbsd","ama");
- //checking whether selected check box selected or not
- if(empty($testselection1))
- {
- echo("You didn't select any tests.");
- }
- else
- {
- //counting selected text boxes
- $N = count($testselection1);
- //counting my array
- $n1= count($alltestsarray);
- for($i=0; $i < $N; $i++)
- {
- for($j=0; $j<$n1; $j++)
- {
- if($testselection1[$i]==$alltestsarray[$j])
- {
- echo("You selected $N tests: ");
- $result=mysql_query("select t.tid from
- testmaster t where
- t.testname=
- '$testselection1[$i]'",
- $con);
- if($result>0)
- {
- while($myrow =mysql_fetch_field($result))
- {
- print "<br>".$myrow['t.tid']."";
- echo($testselection1[$i] . ", ");
- }
- }
- }
- }
- }
- }
- ?>