You are here: Re: newbie help with mysql_fetch_array « PHP Programming Language « IT news, forums, messages
Re: newbie help with mysql_fetch_array

Posted by The Natural Philosopher on 01/14/08 19:52

Jerry Stuckle wrote:
> sixstringsin@yahoo.co.in wrote:
>> On Jan 14, 11:31 pm, Michael Fesser <neti...@gmx.de> wrote:
>>> .oO(sixstring...@yahoo.co.in)
>>>
>>>
>>>
>>>> ##in the mysql query below, i am selecting a few fields from the masks
>>>> table:-
>>>> $mask_query = "SELECT mask_id, mask_name, mask_dynamic FROM masks
>>>> where mask_project = $project_id AND mask_parent = $phase_id";
>>>> ##next i am storing the return value to a variable (on executing the
>>>> script, I donot get any mysql error so i assume the query ran fine:-
>>>> $mask_res = mysql_query($mask_query) or die("can't run query
>>>> [$mask_query]: ".mysql_error());
>>>> ##now i intend to print the field called mask_name on the browser:-
>>>> $tc_array = mysql_fetch_array($mask_res, MYSQL_ASSOC);
>>>> $tc_name = $tc_array["mask_name"];
>>>> print "mask Name:".$tc_array['mask_name'] . " ";
>>>> ##However, what is printed is the string mask Name, followed by a
>>>> blank. The mask_name field from the db is ##not retrieved. Where am i
>>>> going wrong? Appreciate any help!
>>> Make sure that error_reporting is set to E_ALL|E_STRICT in your php.ini
>>> and display_errors is enabled. Do you get any notices when you run the
>>> code? Does the query actually return anything? What does a
>>>
>>> var_dump($tc_array);
>>>
>>> show?
>>>
>>> Micha
>>
>> thanks a lot for the help. Indeed var_dump($tc_array)
>> prints:bool(false). So is it that the mysql query is going wrong?
>>
>
> No, it just means the request didn't return any rows.
>
> echo your $mask_query to see if it contains what you think it does.
>
And then if you have command line access., cut and paste it into a
command line mysql window.

About 85% of my issues show up that way..fix it till it works there,
then edit the source.

 

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

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