$getonewordresultsl = mysql_db_query("$mysql_database", "SELECT * FROM `News` WHERE Name LIKE '%$text%' OR Description LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 10");
$countthem = mysql_num_rows($getonewordresultsl);
¿Veis algun error? ¿No?, yo tampoco, y phpmyadmin tampoco lo ve, me da el resultado pero lo pongo dentro de una archivo php y falla. El error que me da no sirve de mucho:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a5590850/public_html/search2.php on line 31 (la del mysql_num_rows)
Gracias
P.D.: Si quereis ver el script completo (no esta terminado):
Cita:
Nota: No se porque al menos yo veo adde d en lugar de added, esta junto. <?
include("config.php");
?>
<h1>Search</h1>
<p><form id="formsearchlol" name="formsearchlol" method="post" action="index.php?open=search2&action=yes">
<label>
<input name="busquedaquery" type="text" id="busquedaquery" size="60" />
</label>
<label>
<input type="submit" name="Submit" value="Go" />
</label>
</form></p>
<?
function search($text,$data,$module,$string1,$string2,$adde d) {
$countwords = explode(" ", $text);
$countwords2 = count($countwords);
if($countwords2 == "1") {
if($string2 !== "") {
$getonewordresults = mysql_db_query("$mysql_database", "SELECT * FROM `News` WHERE Name LIKE '%$text%' OR Description LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 99999999");
$getonewordresultsl = mysql_db_query("$mysql_database", "SELECT * FROM `News` WHERE Name LIKE '%$text%' OR Description LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 10");
}
else {
$getonewordresults = mysql_db_query("$mysql_database", "SELECT * FROM `$data` WHERE $string1 LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 9999");
$getonewordresultsl = mysql_db_query("$mysql_database", "SELECT * FROM `$data` WHERE $string1 LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 10");
}
$countthem = mysql_num_rows("$getonewordresults");
$results = $countthem;
if($countthem == "0") {}
else {
while($row = mysql_fetch_array($getonewordresultsl)) {
echo"<a href=\"index.php?open=$module&show=$row[id]\">$row[$string1]</a><br>";
}
}
}
else {
}
}
if($_POST[busquedaquery] && $_GET[action] == "yes") {
search("$_POST[busquedaquery]","News","news","Name","Description","");
}
?>
include("config.php");
?>
<h1>Search</h1>
<p><form id="formsearchlol" name="formsearchlol" method="post" action="index.php?open=search2&action=yes">
<label>
<input name="busquedaquery" type="text" id="busquedaquery" size="60" />
</label>
<label>
<input type="submit" name="Submit" value="Go" />
</label>
</form></p>
<?
function search($text,$data,$module,$string1,$string2,$adde d) {
$countwords = explode(" ", $text);
$countwords2 = count($countwords);
if($countwords2 == "1") {
if($string2 !== "") {
$getonewordresults = mysql_db_query("$mysql_database", "SELECT * FROM `News` WHERE Name LIKE '%$text%' OR Description LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 99999999");
$getonewordresultsl = mysql_db_query("$mysql_database", "SELECT * FROM `News` WHERE Name LIKE '%$text%' OR Description LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 10");
}
else {
$getonewordresults = mysql_db_query("$mysql_database", "SELECT * FROM `$data` WHERE $string1 LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 9999");
$getonewordresultsl = mysql_db_query("$mysql_database", "SELECT * FROM `$data` WHERE $string1 LIKE '%$text%' ORDER BY Id DESC LIMIT 0, 10");
}
$countthem = mysql_num_rows("$getonewordresults");
$results = $countthem;
if($countthem == "0") {}
else {
while($row = mysql_fetch_array($getonewordresultsl)) {
echo"<a href=\"index.php?open=$module&show=$row[id]\">$row[$string1]</a><br>";
}
}
}
else {
}
}
if($_POST[busquedaquery] && $_GET[action] == "yes") {
search("$_POST[busquedaquery]","News","news","Name","Description","");
}
?>