Devam Ediyor

489294 fix mysql php error mysql_numrows

I have this mysql query that I am using (see attachment):

$query="(SELECT * FROM ".$table." WHERE (locskew = '".$skew."') AND (locexact = 1) ORDER BY lr1 DESC LIMIT 5)";

$result=mysql_query($query);

$cnt=mysql_numrows($result);

The query works fine when locexact = 1, but if locexact != 1 then I get the following error:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 11

I know this error occurs because there are no results when locexact = 1.

I need my code modified so that if there are no results returned or $cnt < 5 , the query is run again this time with locexact = 0.

If there are still no results, then echo "No Results." If there are results, echo the results with locexact = 1 on top and locexact = 0 on bottom. I want the combined results limit still at 5.

See attachment for full file. Also with this project, I don't want to give ftp access. This code should not be that hard to fix/modify for an experienced php/mysql programmer.

Thanks.

Beceriler: Her şey Kabul, MySQL, PHP, Web Sitesi Yönetimi

Daha fazlasını görün: top query, this error, order programmer php, combined result, mysql query, MYSQL programmer, Mysql php, mysql index, fix mysql query, fix query, modify table php, mysql combined, ftp mysql, php unable access, error time, mysql query php, modify query, full fix, table error, mysql attachment, echo file php, php echo file, fix error php, mysql fix function, php warning

İşveren Hakkında:
( 67 değerlendirme ) Austin, United States

Proje NO: #2235205

Seçilen:

gutibs

But i'd like to do it as i proposed.

0 gün içinde 20$ USD
(48 Değerlendirme)
5.1