|
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean
$z = "Model LIKE '%" . $name . "%' AND";
$f = "Condition =$coni AND";
$v = "Country =$country AND";
$g = "length BETWEEN $L1 AND $L2";
$s = "AND powerplant='$powerplant'";
if ($country == "0")
{$v = "";}
if ($powerplant == "a")
{$s = "";}
$sql = "select * FROM boats WHERE $z $f $v $g $s LIMIT $startpoint,$perpage;";
$result =mysql_query($sql);
echo "<table width = '60%' border='0' cellspacing = '0' >
<tr>
<th>Model</th>
<th>Length</th>
<th>Engine</th>
<th>Powerplant</th>
<th>Price</th>
<th>Country</th>
<th>Boat ID</th>
<th>CONDITION</th></th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Model'] . "</td>";
echo "<td>" . $row['length'] . "</td>";
echo "<td>" . $row['engine'] . "</td>";
echo "<td>" . $row['powerplant'] . "</td>";
echo "<td>" . $row['price'] . "</td>";
{$c=$row['Country'];
$sql2 = "select * FROM countries WHERE CountryID = $c";
$result2=mysql_query($sql2);
while($row2 = mysql_fetch_array($result2)){
echo "<td>" . $row2['countrylist'] . "</td>";}}
echo "<td>" . $row['BoatID'] . "</td>";
echo "<td>" . $row['Condition'] . "</td>";
$joe = $row['BoatID'];
echo "<td> <form method='get' action='details.php?go' id='searchform2'><input type='hidden' name='hideID' value = '$joe'/><input type='submit' name='submit' value='more info'/></form></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan = '8'> " . '<hr />' . "</td>";
echo "</tr>";
}
echo "</table>";
This code worked fine. However when I included $f in the search query the following error resulted:Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean in .... What is the problem pls?
5 Answers
<a href=https://market-casino.ru/articles/90-kak-kupit-bonusnuyu-igru-v-kazino>как покупать бонусные игры в казино</a>
Posted: VeleneGop 0 of 0 people found this answer helpful. Did you? Yes No
<a href=https://market-casino.ru/articles/93-kak-zarabatyvat-na-igrovyh-avtomatah>постоянный заработок играя в игровые автоматы</a>
Posted: VeleneGop 0 of 0 people found this answer helpful. Did you? Yes No
<a href=https://market-casino.ru/articles/88-kak-vyigrat-v-bonusnoj-igre-kazino>бонусная игра в казино</a>
Posted: VeleneGop 0 of 0 people found this answer helpful. Did you? Yes No
your problem from \'\' please use the code of Gamal exactly seee Condition = on must be Condition = \'on\'
Posted: MacOS 1 of 1 people found this answer helpful. Did you? Yes No
this is the best way to do that
$reords = array();
if(isset($name)){
$reords[] = \"Model LIKE \'%\" . $name . \"%\'\";
}
if(isset($coni)){
$reords[] = \"Condition = \'$coni\'\";
}
if(isset($country)){
$reords[] = \"Country = \'$country\'\";
}
if(isset($L1) and isset($L2)){
$reords[] = \"length BETWEEN \'$L1\' AND \'$L2\'\";
}
if(isset($powerplant)){
$reords[] = \"powerplant=\'$powerplant\'\";
}
$sql = \"select * FROM boats WHERE
\".implode(\' and \', $reords).\"
LIMIT $startpoint,$perpage;\";
Posted: Gamal 1 of 1 people found this answer helpful. Did you? Yes No thanks will try it out... Hi, I've tried this out... but the problem still persists!!! :-( this mean the problem from the sending the variables let me see the echo $sql;
The above is the echo $sql... it looks ok...but it still won't work!!!! |
© Advanced Web Core. All rights reserved


ok use echo $sql; and let me see what will return
September 21, 2011
select * FROM boats WHERE Model LIKE '%%' AND Condition = AND length BETWEEN 0 AND 900000 LIMIT 0,4;
September 21, 2011
the error is 'Condition = ' there is no value of it
September 21, 2011
September 21, 2011
When I add any other queries, I get the same error code... Warning: Mysql_fetch_array() Expects Parameter 1 To Be Resource, Boolean In .... Can't understand why!!!!!
September 21, 2011