You are here: Re: mysql_num_rows HELP « All PHP « IT news, forums, messages
Re: mysql_num_rows HELP

Posted by Jerry Stuckle on 04/03/06 15:46

Dejan wrote:
> Hi
>
> Sorry for my terreble english.
>
> On my local (win) comp i have apache+mysql+php 4.05
> I'm counting rows using mysql_num_rows function, and everything works fine.
> When i upload php file on server it says:
>
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
> resource in /home/optikara/public_html/crosun/izn/insert_form.php on line 80
> Server runs php 5.0.5
>
> Code is:
> --------------------------
> //connect to database code goes here
>
> $result_v_smjestaj = mysql_query("select * from v_smjestaja order by
> v_smjestaja_naziv ASC", $db);
> // some other html code goes here
>
> if (mysql_num_rows($result_v_smjestaj)) {
> print "<select name=\"v_smjestaja\">\n";
> while ($qry = mysql_fetch_array($result_v_smjestaj)) {
> print "<option
> value=\"$qry[id_smjestaja]\">$qry[v_smjestaja_naziv]</option>";
> }
> print "</select>\n";
> }
> --------------------------
>
> On my local comp this works. Plz any solution, in plain simple code:)))
> tnx in advance.
> Dejan
>
>
>

1. Always check the result from mysql_query (and all similar mysql_ calls).
2. When it fails, check the error message with mysql_error().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация