RE: [PHP] Creating arrays using results from MySQL query

2002-03-18 Thread Mark Heintz PHP Mailing Lists
I should have been more exact in my original reply. The second query isn't necessary. Try this: File: login.php # if $employee_1, query db workgroups table to check if $emp_login_id belongs to any groups $sql_2 = "SELECT * FROM workgroups WHERE emp_id='$emp_login_id'"; $result_2 = @mysql_query

RE: [PHP] Creating arrays using results from MySQL query

2002-03-18 Thread Mullin, Reginald
: > Array ( [0] => 222 [1] => 333 ). For some reason, it seems to be skipping > the first record. > > O From Now 'Till Then, > \->Reginald Alex Mullin > /\ 212-894-1690 > > -Original Message- > From: Mullin, Reginald > Sent: Monday, March 18,

RE: [PHP] Creating arrays using results from MySQL query

2002-03-18 Thread Mullin, Reginald
>Reginald Alex Mullin /\ 212-894-1690 > -Original Message- > From: Mark Heintz PHP Mailing Lists [SMTP:[EMAIL PROTECTED]] > Sent: Monday, March 18, 2002 1:26 PM > To: Mullin, Reginald > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Cre

Re: [PHP] Creating arrays using results from MySQL query

2002-03-18 Thread Mark Heintz PHP Mailing Lists
You have to call mysql_fetch_array for each record in your result set... $emp_login_wkgrp_id = array (); $emp_login_grp_id = array (); $emp_login_role_id = array (); $i = 0; while($employee_2 = mysql_fetch_array($result_2)){ $emp_login_wkgrp_id[$i] = $employee_2["wkgrp_id"]; $emp_login_grp_i

Re: [PHP] Creating Arrays

2001-04-12 Thread Jeffrey Greer
[posted and emailed] On 12 Apr 2001 12:48:52 -0700, [EMAIL PROTECTED] (Jeffrey Greer) wrote: > >// putting the values in an array is trivial, but you should do it >like this >// or you will confuse your numeric ids with the ids that php >puts in an array automatically Whoops. I was wrong a

Re: [PHP] Creating Arrays

2001-04-12 Thread Jeffrey Greer
[posted and emailed] If you're looking for a simple way to work with databases I would use phplib. Phplib is a db abstraction layer which supports over a dozen databases including mysql. You can get the libraries at http://phplib.netuse.de/download/phplib-7.2c.tar.gz You will need to use "db_

Re: [PHP] Creating Arrays

2001-04-12 Thread Rodney J. Woodruff
Do you understand the options that the other people have explained? -- Rodney "Ashley M. Kirchner" wrote: > "Rodney J. Woodruff" wrote: > > > http://www.php.net/manual/en/function.msql-fetch-array.php > > Okay, call me dense. I can't figure this out. This is what I'm trying to > do: > >

Re: [PHP] Creating Arrays

2001-04-11 Thread Matt McClanahan
On Wed, Apr 11, 2001 at 03:55:38PM -0600, Ashley M. Kirchner wrote: > "Rodney J. Woodruff" wrote: > > > http://www.php.net/manual/en/function.msql-fetch-array.php (snip) > I need that result into the following: > $items = array(0 => "Undefined", 1 => "Work", 2 => "Personal"); Here's a

Re: [PHP] Creating Arrays

2001-04-11 Thread Ashley M. Kirchner
"Rodney J. Woodruff" wrote: > http://www.php.net/manual/en/function.msql-fetch-array.php Okay, call me dense. I can't figure this out. This is what I'm trying to do: $sql = "select p_id, project from proj where uid=$uid"; $result = mysql_db_query($database,$sql); (the resulti

Re: [PHP] Creating Arrays

2001-04-11 Thread Morgan Curley
try "; print_r( $the_array_I_want ); echo ""; ?> Be aware that adding an element to $the_array_I_want will give it the next sequential number which would look like an ID but have nothing to do with the contents of your database. Unless it is absolutely necessary I would reco

Re: [PHP] Creating Arrays

2001-04-11 Thread Rodney J. Woodruff
http://www.php.net/manual/en/function.msql-fetch-array.php Hope this helps. "Ashley M. Kirchner" wrote: > I need to convert an MySQL result into an Array...somehow. The > query returns the following: > > ++---+ > | ID | Project | > ++---+ > | 1 |