You are here: Re: array woes « PHP « IT news, forums, messages
Re: array woes

Posted by "Matt Monaco" on 11/26/05 00:10

Within grabQuotes(); if you do a var_dump($arg); (where $arg is $res[id]) is
your vehicle name displayed? If it is, and you're using it correctly, make
sure you're returning the value you'd like correctly. It might help to post
your grabQuotes function as well as the code that displays $cars[].


Matt


"blackwater dev" <blackwaterdev@gmail.com> wrote in message
news:34a9824e0511251321j5d53f8a0sfefc4f7ef81771e1@mail.gmail.com...
Hello all,

I have some array code driving me nuts.

I am pulling from a db:

select id, vehicle, has_quotes from cars where active=1

I then loop through these and build an array that contains the id's and
cars.

while($res){

$cars[$res[id]]=$res[vehicle];
//here is the problem, when has_quotes is 1, I call another function
to grab the quotes
if ($res[has_quotes]>1){
$cars[$res[id]]=grabQuotes($res[id]);
}

}

The grabQuotes function returns an array and works fine. THe problem
is when I go to display these, I cycle through the car array printing
id and vehicle name. I do a check so if vehicle name is an array, I
print out the quotes from the inner array, problem is I have lost the
vehicle name! How can I fix this?

 

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

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