samedi 25 avril 2015

mysql_query() expects parameter 2 to be resource, boolean given, on line 9


I have used an ajax script to get some data from my sql database and put them on a table. After some tries I have managed to get it to a point that I have the following problem. I know its common and I have searched some other posts here but no luck in finding a solution.

The problem is the following: Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/ak118043/public_html/ajax/name.php on line 9 Error

<?php 
if( isset($_POST['DEPID']) === true && empty($_POST['DEPID']) ===false){
    require'../db/connect.php';
$query = mysql_query("SELECT * FROM Flights WHERE DEPID ='DEPID'");                          
$result = mysql_query($mysql_connect,$query)or die ("Error");     //Line 9                   
echo "<table><tr><th>Flight ID</th><th>Departure Airport</th><th>Arrival Airport</th><th>Distance</th></tr>";

while($row = mysql_fetch_array($result)) {
    echo "<tr><td>" . $row['FLID'] . "</td><td>" . $row['DEPID'] . "</td><td>" . $row['ARRID'] . "</td><td>" . $row['Distance'] . "</td></tr>";
}
echo "</table>";                             
    }

?>


Aucun commentaire:

Enregistrer un commentaire