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:

 $sql = "select p_id, project from proj where uid=$uid";
 $result = mysql_db_query($database,$sql);

 (the resulting table in mysql is as follows:
   +--+---+
   | p_id | project   |
   +--+---+
   |0 | Undefined |
   |1 | Work  |
   |2 | Personal  |
   +--+---+
   3 rows in set (0.00 sec)

 ...yes, that 'Undefined' IS a valid project, and the p_id's don't
 necessarily start at 0 either.)

 I need that result into the following:
 $items = array(0 = "Undefined", 1 = "Work", 2 = "Personal");

 Reason is, I pass that $items variable to the following function:

   function MakeSelect($items, $selected) {
 $str = "";
 while(list($value, $name) = each($items)) {
   $str .= "option value=\"$value\"" . ($value != $selected ? \
   "" : " selected") . "$name\n";
 }
 return $str;
   }

 ...which then creates (assuming the person had 'Work' previously
 selected):

 select name=whatever_i_specify
 option value="0"Undefined
 option value="1" selectedWork
 option value="2"Personal
 /select

 How do I create that $items array?

 AMK4

 --
 W |
   |  I haven't lost my mind; it's backed up on tape somewhere.
   |
   ~
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
   SysAdmin / Websmith   . 800.441.3873 x130
   Photo Craft Laboratories, Inc. .eFax 248.671.0909
   http://www.pcraft.com  . 3550 Arapahoe Ave #6
   .. .  .  . .   Boulder, CO 80303, USA

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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 | Home  |
 |  2 | Work  |
 |  3 |   Family  |
 |  4 |Misc.  |
 |  . |  ...  |
 |  . |  ...  |
 ++---+

 ...which I want to convert into:

 Array(1 = "Home", 2 = "Work", 3 = "Family", 4 = Misc.", etc);

 What's the best way to do this.

 AMK4

 --
 W |
   |  I haven't lost my mind; it's backed up on tape somewhere.
   |
   ~
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
   SysAdmin / Websmith   . 800.441.3873 x130
   Photo Craft Laboratories, Inc. .eFax 248.671.0909
   http://www.pcraft.com  . 3550 Arapahoe Ave #6
   .. .  .  . .   Boulder, CO 80303, USA

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Including a URL for mailing..

2001-04-11 Thread Rodney J. Woodruff

What have you tried so far?

-- Rodney

Chad Day wrote:

 What I'm trying to do is specify a URL in a form, and then take that URL,
 put its contents into a variable, and mail it out in an e-mail message with
 the body of the message being that URL.  I haven't gotten anywhere so far,
 just getting blank messages for the body..   can anyone point me in the
 right direction on saving the contents of a page to a variable?  I've ran
 across a few examples, but nothing has worked for me yet. :(

 Thanks,
 Chad

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Count function. (Newbie Question)

2001-04-09 Thread Rodney J. Woodruff

Look here as a starting point:

http://www.php.net/manual/en/function.mysql-num-rows.php

I don't know the exact answer to your question but I hope that this helps.

-- Rodney

Michael O'Neal wrote:

 Hi,

 I'm trying to display a record count of some sort on a page I'm working
 on.  For example, "Record 1 of 15".  I can display the 1st number ok, but
 I'm a bit confused on what the count function should look like for the
 2nd number (15, in this case).  Here is my current (not working) code.

   ?php
 
$query = "SELECT count(*) FROM mango_pr";
$result = mysql_query($query);
$record_count = mysql_fetch_row($result);
 
 
 ?

 And then I'm calling the code with an "echo"  later on:

 b?php echo $record_count ? /b/font

 This obviously isn't right...can anyone offer any suggestions?

 Thanks,

 mto

 Michael O'Neal
 Web Producer/ Autocrosser
 ST 28 '89 Civic Si
 -
  M   A   N   G   O
 B  O  U  L  D  E  R
 -
 http://www.thinkmango.com
 [EMAIL PROTECTED]
 p-303.442.1821
 f-303.938.8507

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Copy data from one mysql table to another?

2001-03-28 Thread Rodney J. Woodruff

Which database are you using?

-- Rodney

Bob Stone wrote:

 Dear PHP Helpers,

 I cannot find any documentation on how to copy the
 data from one mysql table to another, i.e. table1,
 columnx to table2, columnx.

 Can you recommend a way?

 Here is the situation.

 I have one table called "phone" with two columns. The
 first column is called "key_svt_members," the second
 is called "phone."

 I have a second table called "svt_members." This table
 has 17 columns including "key_svt_members" and
 "phone." The phone column in this table is currently
 empty.

 I wish to copy the data that is in phone, phone into
 svt_members.

 Can you recommend a method?

 Thanks in advance,

 Bob Stone

 __
 Do You Yahoo!?
 Get email at your own domain with Yahoo! Mail.
 http://personal.mail.yahoo.com/?.refer=text

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]