Skip navigation links

MySQL Forums :: Newbie :: multiple select and one insert?


Advanced Search

Warning: mysql_fetch_array() expects parameter 1 to be resource
Posted by: Abdo Boriz ()
Date: November 29, 2010 02:55AM

I am getting the following error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampplite\htdocs\schedule2.php on line 71

Line 71 is where the while loop starts. Please take a look at my code and see if the way I am trying to output the reult of select is correct.
------------------------
<?php

include'dbConnectionFile2.php';

$instudID=$_POST['inputstudID'];

if (!$_POST['submit']) {
echo "Please enter your student ID and click on Submit Query button to find out your schedule.";
}
else {


$query="SELECT e.studID, e.courseNum, e.facID, e.sessionID, e.classroomID
,s.studID
,s.fname
,s.lname
,c.courseNum
,c.days
,c.time
,c.description
,c.credits
,f.facID
,f.ffname
,f.flname
,t.sessionID
,t.session
,l.classroomID
,l.building
FROM student s
JOIN enrollment e
ON e.studID = s.studID
JOIN course c
ON c.courseNum = e.courseID
JOIN faculty f
ON f.facID = e.facID
JOIN term t
ON t.sessionID = e.sessionID
JOIN location l
ON l.classrooID = e.classroomID
WHERE s.studID='.$instudID.'";

$result=mysql_query($query);

echo "<h2> Schedule Details </h2>";

echo " <table border='1' cellpadding '10'>";

echo "<tr><th>Student ID</th>";
echo "<th>Student First Name</th>";
echo "<th>Student Last Name </th>";
echo "<th>Course Number</th>";
echo "<th>Description</th>";
echo "<th>Days</th>";
echo "<th>Time</th>";
echo "<th>Credits</th>";
echo "<th><th>Faculty ID</th>";
echo "<th>Faculty First Name</th>";
echo "<th>Faculty Last Name </th>";
echo "<th>Session ID</th>";
echo "<th>Session</th>";
echo "<th>Location ID</th>";
echo "<th>Building</th>";
echo "<th></th><th></th></tr>";

while($studentinfo=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $studentinfo['studID'] . "</td>";
echo "<td>" . $studentinfo['fname'] . "</td>";
echo "<td>" . $studentinfo['lname'] . "</td>";
echo "<td>" . $studentinfo['courseNum'] . "</td>";
echo "<td>" . $studentinfo['decription'] . "</td>";
echo "<td>" . $studentinfo['days'] . "</td>";
echo "<td>" . $studentinfo['time'] . "</td>";
echo "<td>" . $studentinfo['credits'] . "</td>";
echo "<td>" . $studentinfo['facID'] . "</td>";
echo "<td>" . $studentinfo['ffname'] . "</td>";
echo "<td>" . $studentinfo['flname'] . "</td>";
echo "<td>" . $studentinfo['sessionID'] . "</td>";
echo "<td>" . $studentinfo['session'] . "</td>";
echo "<td>" . $studentinfo['classroomID'] . "</td>";
echo "<td>" . $studentinfo['Building'] . "</td>";

echo "<td>" . "<a href=\"editstudentenrollment.php?id=". $studentinfo['studID']."\">Edit</a>" . "</td>";
echo "<td>" . "<a href=\"dropclass.php?id=". $studentinfo['studID']."\">Delete</a>" . "</td>";

echo "</tr>";
}
echo "</table>";
}

?>

Options: ReplyQuote


Subject Written By Posted
multiple select and one insert? Abdo Boriz 11/27/2010 01:15PM
Re: multiple select and one insert? Barry Galbraith 11/27/2010 04:37PM
Re: multiple select and one insert? Abdo Boriz 11/28/2010 12:57AM
Re: multiple select and one insert? Barry Galbraith 11/28/2010 01:49AM
Re: multiple select and one insert? Abdo Boriz 11/28/2010 03:40PM
Warning: mysql_fetch_array() expects parameter 1 to be resource Abdo Boriz 11/29/2010 02:55AM
Re: Warning: mysql_fetch_array() expects parameter 1 to be resource Barry Galbraith 11/29/2010 05:08AM
Re: Warning: mysql_fetch_array() expects parameter 1 to be resource Abdo Boriz 11/29/2010 03:11PM
Re: Warning: mysql_fetch_array() expects parameter 1 to be resource Barry Galbraith 11/29/2010 04:58PM
Re: Warning: mysql_fetch_array() expects parameter 1 to be resource Abdo Boriz 11/30/2010 12:38PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.