Re: Ошибка

Paul Coldrey <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Organization Ensigma
Message-ID <[email protected]>
Hi Aleksej,

mysql_error(...) will display error information from the last 
mysql_query(...) call (if there was an error). mysql_fetch_row(...) 
returns the current row in a result set. It can return no rows even when 
the query was successful.

For example:

    select * from table1 where 1=0

is a valid query that returns no rows.

some code that might work better for you is:

if(!($qry = mysql_query('select * from blah'))) {
    echo mysql_error();
    exit;
}

while($row = mysql_fetch_row($qry)) {
    // do some stuff with $row
}

Cheers,

    Paul

Sanja Byelkin wrote:

>Hi, Aleksej!
>
>On Sun, Feb 15, 2004 at 11:38:09PM +0200, п╬я┌ п°я▀я│п╟п╨п╟ п░п╩п╣п╨я│п╣я▐ wrote:
>  
>
>>п╞ п╦я│п©п╬п╩я▄п╥я┐я▌ Windows2000 Professional.
>>п²п╣п╢п╟п╡п╫п╬, я▐ я┐я│я┌п╟п╫п╬п╡п╦п╩ я┐ я│п╣п╠я▐ MySQL4.0, п╢п╬ я█я┌п╬пЁп╬ я┐ п╪п╣п╫я▐ п╠я▀п╩ MySQL3.53. п╞ я┐я│я┌п╟п╫п╟п╡п╩п╦п╡п╟п╩ MySQL4.0 п╦п╥ mysql-4.0.18-win.zip, п╨п╬я┌п╬я─я▀п╧ п╥п╟пЁя─я┐п╥п╦п╩ я│ mysql.com. 
>>п·я┬п╦п╠п╨п╟ п╥п╟п╨п╩я▌я┤п╟п╣я┌я│я▐ п╡ я│п╩п╣п╢я┐я▌я┴п╣п╪.
>>п п╬пЁп╢п╟ я▐ п©п╦я┬я┐ п╡ php-я└п╟п╧п╩п╣ (PHP4)
>>
>>$row=mysql_fetch_row($query_select_needful_users_info);
>>if(!$row)
>>{
>>   echo "Error!";
>>   echo mysql_error();
>>   exit;
>>}
>>
>>я│п╨я─п╦п©я┌ п╡я▀п╡п╬п╢п╦я┌ п╫п╟ я█п╨я─п╟п╫ "Error!" п╦ п©я─п╣п╨я─п╟я┴п╟п╣я┌ я│п╡п╬п╣ п╢п╣п╧я│я┌п╡п╦п╣. п║я┌я─п╬п╨п╟ "echo mysql_error();" - п╦пЁп╫п╬я─п╦я─я┐п╣я┌я│я▐. 
>>Why??????
>>    
>>
>
>п▓п╬ п©п╣я─п╡я▀я┘, п©п╦я│я▄п╪п╟ п╡ я█я┌п╬я┌ я│п©п╦я│п╬п╨ я─п╟я│я│я▀п╩п╨п╦ п╢п╬п╩п╤п╫я▀ п©п╦я│п╟я┌я│я▐ п©п╬ п╟п╫пЁп╩п╦п╧я│п╨п╦.
>п▓п╬ п╡я┌п╬я─я▀я┘, п©я─п╬п╠п╩п╣п╪п╟ (я│я┐п╢я▐ п©п╬ п╬п©п╦я│п╟п╫п╦я▌) п╬я┌п╫п╦я│п╦я┌я│я▐ п╠п╬п╩я▄я┬п╣ п╨ php.
>
>п╞ п©п╣я─п╣п╡п╣п╩ (п╨п╟п╨ п╪п╬пЁ) п╡п╟я┬п╣ п©п╦я│я▄п╪п╬. п°п╬п╤п╣я┌ п╫п╟п╧п╢я┐я┌я│я▐ п╩я▌п╢п╦ п╨п╬я┌п╬я─я▀п╣
>п╠п╬п╩я▄я┬п╣ п╪п╬п╣пЁп╬ я─п╟п╥п╠п╦я─п╟я▌я┌я│я▐ п╡ php.
>
>п░ я█я┌п╬ п©п╣я─п╣п╡п╬п╢ п╫п╟ п╟п╫пЁп╩п╦п╧я│п╨п╦п╧ (п╢п╩я▐ п╦я│я┘п╬п╢п╫п╬пЁп╬ п©п╦я│я▄п╪п╟ - я┌п╬п╩я▄п╨п╬ я└п╟п╨я┌я▀):
>here is English translation (only facts for original message):
>
>  
>
>>I use Windows2000 Professional.
>>I have installed MySQL4.0.18 (mysql-4.0.18-win.zip from mysq.com), MySQL3.53
>>was used before it.
>>Following code return "Error!" and exit:
>>$row=mysql_fetch_row($query_select_needful_users_info);
>>if(!$row)
>>{
>>   echo "Error!";
>>   echo mysql_error();
>>   exit;
>>}
>>Why 'echo mysql_error();' is ignored?
>>    
>>
>
>First of all, messages to this e-mail list should be written in English.
>The problem look like php related.
>
>I have translated your letter (as I can). It is possible that this letter
>will be answered by some people who know php better then I.
>
>  
>



-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.