php-general Digest 2 Jan 2003 17:55:50 -0000 Issue 1799 Topics (messages 129918 through 129966):
help with script!! 129918 by: Karl James 129919 by: Michael J. Pawlowsky 129920 by: Justin French help with script 129921 by: Karl James 129922 by: Michael J. Pawlowsky Re: How To Delete Multiple Items Of Multiple Tables Using PHP and MySQL 129923 by: . Nilaab Re: loading a db table into a php array from mysql 129924 by: Rick Widmer 129926 by: Rick Widmer Re: Using mail() for mailist list app 129925 by: Rick Widmer 129940 by: Manuel Lemos Re: creating a .doc file in php 129927 by: Chris Hewitt Re: send page with https and php sessions problem 129928 by: Chris Hewitt prevent session_replay 129929 by: scott 129934 by: Michael J. Pawlowsky 129941 by: Marek Kilimajer 129945 by: Michael J. Pawlowsky 129953 by: Chris Shiflett Re: makeing an array 129930 by: Sean Malloy 129939 by: Ford, Mike [LSS] 129942 by: Gerald Timothy Quimpo 129947 by: Ford, Mike [LSS] mail attachments 129931 by: Edward Peloke 129932 by: Marco Tabini 129933 by: Edward Peloke 129935 by: Michael J. Pawlowsky 129936 by: Manuel Lemos 129937 by: Adam Voigt 129943 by: Michael J. Pawlowsky Re: Text repeating problem 129938 by: Ford, Mike [LSS] killing child process 129944 by: gamin 129946 by: Michael J. Pawlowsky 129952 by: Marek Kilimajer 129955 by: Michael J. Pawlowsky Index page 129948 by: thkiat 129949 by: Michael J. Pawlowsky Re: receiving XML stream as server via PHP 129950 by: Kristopher Yates 129951 by: Kristopher Yates 129954 by: Kristopher Yates phpinfo() and HTTP_RAW_POST_DATA 129956 by: Kristopher Yates 129957 by: Chris Shiflett Multidimensional Array manipluation... 129958 by: Dhaval Desai 129963 by: Chris Shiflett 129964 by: Dhaval Desai 129965 by: Chris Shiflett 129966 by: Dhaval Desai Re: accelerator and Apache 2 129959 by: Gyozo Papp 129960 by: Gyozo Papp Re: func_get_args() and call-by-reference? 129961 by: Atahualpa Jones Re: mcrypt 129962 by: J Smith Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message ---HYPERLINK "http://host.makethewebsecure.com/~admin12/do_adduser.phps"http://host.m akethewebsecure.com/~admin12/do_adduser.phps can someone take a look at this and see why this wont work. karl --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002--- End Message ---
--- Begin Message ---Without the error message you are making it kind of tough. What's the response that you get. Also you should use long <?php and not just <? Single quote your arrays as in $_POST['f_name'] and not $_POST[f_name] This will help if you ever move to a serve that's not so lax. *********** REPLY SEPARATOR *********** On 01/01/2003 at 12:54 PM Karl James wrote: >HYPERLINK >"http://host.makethewebsecure.com/~admin12/do_adduser.phps"http://host.m >akethewebsecure.com/~admin12/do_adduser.phps > > >can someone take a look at this >and see why this wont work. > >karl > >--- >Outgoing mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002--- End Message ---
--- Begin Message ---on 02/01/03 7:54 AM, Karl James ([EMAIL PROTECTED]) wrote: > can someone take a look at this > and see why this wont work. why don't you start by telling us what's wrong, or HOW it "doesn't work"? Justin--- End Message ---
--- Begin Message ---Sorry guys!!! Well im trying to add the form to my database table. Which is this link!! HYPERLINK "http://host.makethewebsecure.com/~admin12/show_adduser.html"http://host .makethewebsecure.com/~admin12/show_adduser.html then when I hit add user!!! I get this error message Added to auth_users: Access denied for user: 'kjames@localhost' to database ' ultimatefootballleague_com' Which is this site HYPERLINK "http://host.makethewebsecure.com/~admin12/do_adduser.php"http://host.ma kethewebsecure.com/~admin12/do_adduser.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002--- End Message ---
--- Begin Message ---There's your answer... You do not have permission to insert into the database with that user. Contact your DBA! :-) and if that's you read the MySQL manual. Especially about the mysql.user table *********** REPLY SEPARATOR *********** On 01/01/2003 at 1:19 PM Karl James wrote: > >Access denied for user: 'kjames@localhost' to database ' >ultimatefootballleague_com'--- End Message ---
--- Begin Message ---Hey, that's right! I forgot about that. So here's what I did to fix my problem. I separated everything and called the queries separately, except this time I didn't call the mysql_close() function to close the connection after each query. Initially I had called the mysql_close() on function I made called db_connect(). This was a big no-no, as it would have put a big strain on my application. I forgot that the connection closes itself after the script ends. Thanks Thomas, Stephen, Jason, and Tom Henry for all your help on this. I greatly appreciate it. > -----Original Message----- > From: Thomas Seifert [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 01, 2003 6:29 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] How To Delete Multiple Items Of Multiple Tables Using > PHP and MySQL > > > there is no need to close and open the connection for every query. > just run the mysql_query again and again and again on the open connection. > Still Stephen's quote is true, you can't run more than one query > by one call to mysql_query. > > > Thomas > > On Tue, 31 Dec 2002 16:30:38 -0600 [EMAIL PROTECTED] (@ Nilaab) wrote: > > > I was hoping for better news. Thanks for the suggestion, but it > will put a > > very big strain on my application since every DELETE query will open and > > close the mysql connection everytime. Think about deleting 100s > of records > > one at a time. Surely someone has thought of a better way to do > this with > > MySQL 3.23. Also, I don't want to run persistent connections, > as I only have > > a limited number of simultaneous connections to the database > currently. Is > > there a better way to do all this? Anyone? > > > > > -----Original Message----- > > > From: Stephen [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, December 31, 2002 1:10 PM > > > To: @ Nilaab > > > Cc: PHP List > > > Subject: Re: [PHP] How To Delete Multiple Items Of Multiple > Tables Using > > > PHP and MySQL > > > > > > > > > From experience, I don't think you can run more then one SQL > statement at > > > once in a single time. Try assigning each variable with > delete, then query > > > them all seperately. I also don't think you need the ; in the SQL > > > statement... > > > > > > > > > ----- Original Message ----- > > > From: "@ Nilaab" <[EMAIL PROTECTED]> > > > To: "Php-General" <[EMAIL PROTECTED]> > > > Sent: Tuesday, December 31, 2002 1:36 PM > > > Subject: [PHP] How To Delete Multiple Items Of Multiple Tables > > > Using PHP and > > > MySQL > > > > > > > > > : Hello Everyone, > > > : > > > : I want to DELETE multiple items of multiple TABLES in a MySQL > > > database. My > > > : version of MySQL is 3.23, which means this version doesn't > support the > > > : DELETE functionality on multiple tables. The following is > my PHP code, > > > where > > > : $item_id is a multi-dimensional array containing the ids of > the items I > > > want > > > : to delete from the table. > > > : > > > : # DELETE records > > > : for ($i = 0; $i < count($item_id); $i++) { > > > : $query_item2 .= "DELETE QUICK FROM item_dimension > WHERE item_id = > > > : '".$item_id[$i][0]."'; "; > > > : $query_item2 .= "DELETE QUICK FROM item_popup WHERE item_id = > > > : '".$item_id[$i][0]."'; "; > > > : } > > > : > > > : When I run this through the database using PHP, it returns a > > > syntax error > > > in > > > : the SQL. So what I did was echo out $query_item2, then > copied and pasted > > > the > > > : SQL into the MySQL application manually, and ran it > through. Well the > > > exact > > > : same SQL statement that I used in PHP worked when I entered it > > > manually in > > > : MySQL. In other words it didn't work doing it through PHP, > but it worked > > > in > > > : MySQL directly. What gives? Is there a better way to delete > > > multiple items > > > : from multiple tables with one SQL string? I don't want to > > > separate the two > > > : DELETE functions and run them through two separate times because of > > > overhead > > > : concerns. I tried looking on the MySQL and PHP website for > > > better ways of > > > : using DELETE syntax on multiple tables, but I had no luck > > > finding anything > > > : useful with my version of MySQL. Any help would be greatly > appreciated. > > > : > > > : > > > : -- > > > : PHP General Mailing List (http://www.php.net/) > > > : To unsubscribe, visit: http://www.php.net/unsub.php > > > : > > > : > > > : > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >--- End Message ---
--- Begin Message ---% different ways of connecting tables with LEFT JOIN. USING( fieldname ) % connects the table being joined, with the table listed right before it, % using the same fieldname in both. The ON syntax allows you to use % differently named fields, and/or a different table. I still don't get what a left or right or outer or inner join is...When looking up values in a second table, LEFT JOIN has two properties that make it my choice: o It lets me specify exactly how the tables are linked together. o It returns results for the first table even if there are no entries in the second table. For example, if one of my classes did not yet have a room assigned, the rest of the data will still be returned. > I've read the mysql docs for the syntax and some examples, but this is > a place where I'll need to go to outside tutorials. Do you know of > any (on the web) which will give me the background? http://www.devshed.com/Server_Side/MySQL/Join/page5.html http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=sql+join+tutorial--- End Message ---
--- Begin Message ---At 06:32 AM 1/1/03 -0500, David T-G wrote:The reason I chose LEFT JOIN are:I still don't get what a left or right or outer or inner join is...
o You get better control over how the query is executed.
o Values from the first table are returned even if there is no associated entry in the second table. For eaxample if no building or room was set on an entry in my previous query, the rest of the data will still be returned.
Do you know of any (on the web) which will give me the background?http://www.devshed.com/Server_Side/MySQL/Join/page1.html http://www.devshed.com/Server_Side/MySQL/Normal http://www.devshed.com/Server_Side/MySQL/SQLJoins/page1.html--- End Message ---
--- Begin Message ---At 06:33 PM 1/1/03 -0500, Michael J. Pawlowsky wrote:Personally I simply get the e-mail addresses spit out to me from the database and then I input them into a application made just for bulk mailingt.
You can also easily write a quick perl or shell script to send it out from a file of names and this way you can "nice" the process so as not to bog down the machine.
PHP now offers a command line SAPI that lets you write these programs with PHP. Leave the names in the database, and use PHP's mail() to send the messages. It works very well. I've been using PHP at the command line for quite a while now. 4.3.0 is the first version that creates the CLI version of PHP by default.
Rick
--- End Message ---
--- Begin Message ---Hello, On 01/01/2003 08:46 PM, Monty wrote:Sure, it just calls sendmail, so it is just as robust as sendmail as long as you configure it properly.Is the PHP mail() command robust enough to use in a little mailing list app?
Since you used RedHat Linux, the default mailer is sendmail so you need to configure the deliveries to just queue a single message without attempting to deliver them right away. You need to put all recipients in Bcc: to just need to queue a single message. It is very fast, think about just a few seconds. You probably take more than that extracting the addresses from the database.The app will basically send an HTML or Text e-mail to the member database of about 6,000 people. I'm using RedHat Linux 7.2 with PHP 4.2.2, by the way. I'm concerned I'll bog down my server if I issue the mail() command 6,000 times on our server, but, maybe it won't be a problem?
Yes, but HTML messages need to have an alternative text part or else spam filters may reject it. So it is always recommended that you build your system on existing components that have been throughly tested to compose messages adequately.Also, although I'm sending HTML e-mail, I'm not including attachments or inline graphics (only direct hotlinks to graphics on a web server). Will mail() still work okay for this, or do I need to use one of the various PHP e-mail classes available to send HTML e-mail?
In that case you may want to try this class that lets you compose and send messages not only with alternative text and HTML parts but also embedded images for the HTML part if you want and attachments.
Since you need to use sendmail, there is also a sub-class to make deliveries using sendmail program directly so you can set delivery mode SENDMAIL_DELIVERY_DEFERRED to eliminate the queue time.
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---Edward Peloke wrote:If most of your document is going to be the same each time, I would create the basic document in MS Word, saving it as an rtf file. Then manually edit it with a text editor (e.g. NotePad) and put in replaceable parameters marked with starting and ending tags (e.g. ##). Then your php code need only parse the file and replace dummy names (e.g. ##name##) with the actual data (e.g. Fred Bloggs).Thanks Marco, So I would just create the .rtf file with php, then store it on the server and attach it to the e-mail?
This is what I do for an application. It is a lot less work than trying to write rtf itself.
Hope this helps
Chris
--- End Message ---
--- Begin Message ---Kocnr Peter wrote:I have seen you post this question before and I have not seen an answer. When nobody answers it usually means that nobody has had the problem you are encountering, or that they do not know a solution.I have problem with sending pages directly(by Send->Page by E-mail...) from browser(ie6) with Outlook 2002. It tells:"The current document type can not be sent as mail.Would you like to send a Short cut instead?". The pages use php sessions and https with 128 bit encryption. I found that it is caused by the combination of https and php session. Is there a solution?
You may get a better result by asking on a more appropriate mailing list. This appears to be an Outlook problem rather than PHP.
Sorry I don't know anything which might help.
Chris
--- End Message ---
--- Begin Message ---hi I'm running PHP 4.2.3 as module with Apache 1.3.26 on OpenBSD 3.2 with the chroot turned off (as it stopped the php_mail() funtion working, but if anyone has the fix for that I will re-implement the jail again :o) I'm having some problems with sessions. I am not using cookies, as many people don't allow them to be set The main page starts a session, takes username and password, and if they are ok, it registers the users id from the db as a session variable using the $_SESSION['user_id'] = $user_id it then does a header redirect to another page, which at the moment for testing just displays the SID and all $_SESSION[vars] as the SID is being passed in the url, I am able to copy the http://url?SID from the browser window if I close the browser (which from reading the docs on sessions should end the session) and then re-open another browser (admittedly on the same machine/ip address) and post the http://url?SID back in, I get the page, and the $SESSION[vars] are still there !! it is reading them back out of the files in /tmp (if I edit these directly and paste the url?SID in, I get the new values I mannually put in !) :o( is there a official/approved method to prevent this from being done ? thankyou _scott--- End Message ---
--- Begin Message ---It's called Session Hijacking. And that is the normal behaviour. Since you are supplying the session id it still thinks you are on the same session until it has expired. (expiry time set in php.ini) Mike *********** REPLY SEPARATOR *********** On 02/01/2003 at 12:48 PM scott wrote: >hi > >I'm running PHP 4.2.3 as module with Apache 1.3.26 on OpenBSD 3.2 with the >chroot turned off (as it stopped the php_mail() funtion working, but if >anyone has the fix for that I will re-implement the jail again :o) > >I'm having some problems with sessions. I am not using cookies, as many >people don't allow them to be set > >The main page starts a session, takes username and password, and if they >are >ok, it registers the users id from the db as a session variable using the >$_SESSION['user_id'] = $user_id > >it then does a header redirect to another page, which at the moment for >testing just displays the SID and all $_SESSION[vars] > >as the SID is being passed in the url, I am able to copy the http://url?SID >from the browser window > >if I close the browser (which from reading the docs on sessions should end >the session) and then re-open another browser (admittedly on the same >machine/ip address) and post the http://url?SID back in, I get the page, >and >the $SESSION[vars] are still there !! > >it is reading them back out of the files in /tmp (if I edit these directly >and paste the url?SID in, I get the new values I mannually put in !) > > :o( is there a official/approved method to prevent this from being done ? > >thankyou > >_scott > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message --- This is how it works, but you can tie session to a specific IP (still not 100% safe)
scott wrote:
hi
I'm running PHP 4.2.3 as module with Apache 1.3.26 on OpenBSD 3.2 with the
chroot turned off (as it stopped the php_mail() funtion working, but if
anyone has the fix for that I will re-implement the jail again :o)
I'm having some problems with sessions. I am not using cookies, as many
people don't allow them to be set
The main page starts a session, takes username and password, and if they are
ok, it registers the users id from the db as a session variable using the
$_SESSION['user_id'] = $user_id
it then does a header redirect to another page, which at the moment for
testing just displays the SID and all $_SESSION[vars]
as the SID is being passed in the url, I am able to copy the http://url?SID
from the browser window
if I close the browser (which from reading the docs on sessions should end
the session) and then re-open another browser (admittedly on the same
machine/ip address) and post the http://url?SID back in, I get the page, and
the $SESSION[vars] are still there !!
it is reading them back out of the files in /tmp (if I edit these directly
and paste the url?SID in, I get the new values I mannually put in !)
:o( is there a official/approved method to prevent this from being done ?
thankyou
_scott
--- End Message ---
--- Begin Message ---The problem with that is, if you have a proxy farm you never know which IP might be used. For instance, if the user is on AOL, every request to the server will probably have a different IP. Mike *********** REPLY SEPARATOR *********** On 02/01/2003 at 3:25 PM Marek Kilimajer wrote: >This is how it works, but you can tie session to a specific IP (still >not 100% safe) > >scott wrote: >--- End Message ---
--- Begin Message ---Scott, I think it is safe to say that there is no "official" way to prevent session hijacking like this, nor is there any way to provide absolute assurance that it cannot be done. There are several methods, however, that can make a hijack much more difficult to accomplish without adversely affecting your legitimate users. To get you going (since you are the best person to decide what extra measures to take), consider that you could store the user agent in a session variable. If you check that variable on each page (many people include a common module such as security.inc or session.inc at the top of each script or use a parent script), it will at least prevent your test of using a different browser. Of course, an attacker can still hijack the session by passing the same user agent (either by using the same browser or manually sending the HTTP erquest), but the difficulty is a bit more. Your method of testing is actually a good one. The IP address is a terrible metric for identification, so using the same IP will prevent you from trying to use that to distinguish good guy from bad guy. Just use your creativity, and you will probably be fine. The goal is to make things hard for the bad guys and easy for the good guys. Good luck. Chris --- "scott" <[EMAIL PROTECTED]> wrote: > as the SID is being passed in the url, I am able to > copy the http://url?SID from the browser window if I > close the browser (which from reading the docs on > sessions should end the session) and then re-open > another browser (admittedly on the same machine/ip > address) and post the http://url?SID back in, I get > the page, and the $SESSION[vars] are still there !! > :o( is there a official/approved method to prevent > this from being done ?--- End Message ---
--- Begin Message ---see example 2. > -----Original Message----- > From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 1 January 2003 11:00 PM > To: Sean Malloy; [EMAIL PROTECTED] > Subject: Re: [PHP] makeing an array > > > Your example of: > > for ($i = 0; $i < count($comment); $i++) > > Is very bad as the count will be parsed each loop. > > The count as I had it gets parsed only once. > > > Timothy Hitchens (HiTCHO) > [EMAIL PROTECTED] > > > HiTCHO | Open Platform Web Development > Consulting - Outsourcing - Training - Support > > > ----- Original Message ----- > From: "Sean Malloy" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, January 01, 2003 9:40 PM > Subject: RE: [PHP] makeing an array > > > > why the $x variable aswell?! > > > > for ($i = 0; $i < count($comment); $i++) > > { > > echo $comment[$i].'<br />'; > > } > > > > or even faster: > > > > $i = count($comment); > > while ($i--) > > { > > echo $comment[$i].'<br />'; > > } > > > > > -----Original Message----- > > > From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, 1 January 2003 4:41 PM > > > To: Philip J. Newman; [EMAIL PROTECTED] > > > Subject: Re: [PHP] makeing an array > > > > > > > > > Use the count like following inside to ensure that you don't > > > call on a non existent index. > > > > > > for ($i = 0, $x = count($comment); $i < $x; $i++) > > > { > > > echo $comment[$i].'<br />'; > > > } > > > > > > Why do you want to echo out $comment_1 ??? > > > > > > > > > > > > Timothy Hitchens (HiTCHO) > > > [EMAIL PROTECTED] > > > > > > > > > HiTCHO | Open Platform Web Development > > > Consulting - Outsourcing - Training - Support > > > > > > > > > ----- Original Message ----- > > > From: "Philip J. Newman" <[EMAIL PROTECTED]> > > > To: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>; > > > <[EMAIL PROTECTED]> > > > Sent: Wednesday, January 01, 2003 3:29 PM > > > Subject: Re: [PHP] makeing an array > > > > > > > > > > So in saything that I could do this ... > > > > > > > > $s = 10 > > > > > > > > $comment[1] = '$comment_1'; > > > > $comment[2] = '$comment_2'; > > > > $comment[3] = '$comment_2'; > > > > > > > > for($i = 0; $i <= $s; $i++) { > > > > > > > > echo $comment[$i]."<br>"; > > > > > > > > } > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]> > > > > To: "Philip J. Newman" <[EMAIL PROTECTED]>; > > > <[EMAIL PROTECTED]> > > > > Sent: Wednesday, January 01, 2003 6:12 PM > > > > Subject: Re: [PHP] makeing an array > > > > > > > > > > > > > Example of an Array: > > > > > > > > > > $my_first_array = array(1 => 'first', 2 => 'second', 3 => > 'third'); > > > > > > > > > > You can now access these like so: > > > > > > > > > > echo $my_first_array[1]; etc etc > > > > > > > > > > of if you had this: $my_first_array = array('first_name' => > 'Philip', > > > > > 'last_name' => 'Newman'); > > > > > > > > > > You could do this: > > > > > > > > > > echo $my_first_array['first_name']; > > > > > > > > > > The thing to remember is that array's start at 0 "see below!!" (I > > > started > > > > at > > > > > 1 at the top to make it easier). > > > > > > > > > > You can also make an array like so: > > > > > > > > > > $first[] = 'Philip'; > > > > > $first[] = 'John'; > > > > > $first[] = 'Paul'; > > > > > > > > > > Now you can simply do: > > > > > > > > > > echo $first[0]; // this could output 'Philip'; > > > > > > > > > > You can then look at multi dimensional etc... > > > > > > > > > > I trust this get's you on your way. > > > > > > > > > > > > > > > Timothy Hitchens (HiTCHO) > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > HiTCHO | Open Platform Web Development > > > > > Consulting - Outsourcing - Training - Support > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > From: "Philip J. Newman" <[EMAIL PROTECTED]> > > > > > To: <[EMAIL PROTECTED]> > > > > > Sent: Wednesday, January 01, 2003 2:57 PM > > > > > Subject: [PHP] makeing an array > > > > > > > > > > > > > > > > Can someone help me make an array ... > > > > > > > > > > > > I have $foo amount of loops to preform (1-20), and would > > > like to make > > > > the > > > > > > veriable work for me like $comment_1, $comment_2 etc etc. > > > > > > > > > > > > http://nz.php.net/manual/en/function.array.php makes no sence to > me > > > > after > > > > > i > > > > > > read it and read it ... > > > > > > > > > > > > help me please > > > > > > > > > > > > --- > > > > > > Philip J. Newman. > > > > > > Head Developer. > > > > > > PhilipNZ.com New Zealand Ltd. > > > > > > http://www.philipnz.com/ > > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > Mob: +64 (25) 6144012. > > > > > > Tele: +64 (9) 5769491. > > > > > > > > > > > > VitalKiwi Site: > > > > > > Philip J. Newman > > > > > > Internet Developer > > > > > > http://www.newman.net.nz/ > > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > ***************************** > > > > > > Friends are like Stars, > > > > > > You can't always see them, > > > > > > But you know they are there. > > > > > > > > > > > > ***************************** > > > > > > > > > > > > ICQ#: 20482482 > > > > > > MSN ID: [EMAIL PROTECTED] > > > > > > Yahoo: [EMAIL PROTECTED] > > > > > > AIM: newmanpjkiwi > > > > > > > > > > > > > > > > > > -- > > > > > > PHP General Mailing List (http://www.php.net/) > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > > > > -- > > > > > PHP General Mailing List (http://www.php.net/) > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >--- End Message ---
--- Begin Message ---> -----Original Message----- > From: Sean Malloy [mailto:[EMAIL PROTECTED]] > Sent: 02 January 2003 13:35 > To: Timothy Hitchens (HiTCHO); [EMAIL PROTECTED] > Subject: RE: [PHP] makeing an array > > > see example 2. But that produces the elements in reverse order -- no use if you want them in their proper order! In whioch case, Hitcho's solution is the right and proper one (and I like the elegance of the two parallel assignments in the loop initializer clause!). > > > > -----Original Message----- > > > > From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] > > > > Sent: Wednesday, 1 January 2003 4:41 PM > > > > To: Philip J. Newman; [EMAIL PROTECTED] > > > > Subject: Re: [PHP] makeing an array > > > > > > > > > > > > Use the count like following inside to ensure that you don't > > > > call on a non existent index. > > > > > > > > for ($i = 0, $x = count($comment); $i < $x; $i++) > > > > { > > > > echo $comment[$i].'<br />'; > > > > } Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211--- End Message ---
--- Begin Message ---On Wednesday 01 January 2003 01:41 pm, Timothy Hitchens (HiTCHO) wrote: > Use the count like following inside to ensure that you don't > call on a non existent index. > > for ($i = 0, $x = count($comment); $i < $x; $i++) > { > echo $comment[$i].'<br />'; > } > > Why do you want to echo out $comment_1 ??? i think he wanted to print the value of $comment_1. he had variables as $comment_# where # is in (1...n, n==20 in his example). the $comment_#s are probably fields in an HTML form and as has been discussed many times on this list, using array variables directly is better. Philip, in your HTML, instead of saying name=comment_1, you would instead say name=comment[1]. that way, you can access the variables in your PHP script as $comment[1] (depending on register_globals and other settings). alternatively, if you don't want to change to array syntax, you can use variable variables. e.g., $variable_name="comment_".nIndex; // now comment_1, for example. // assume that $comment_1 is "xxx111" echo $$variable_name ; // prints xxx111 what you did was, form the variable name as a string, then take the string and, using the variable variable syntax, ask PHP what the value was of the string which was contained in the variable "variable_name". this is a neat feature and helpful in many situations, but for readability i'd go with naming the fields as array entries "comment[1]". tiger -- Gerald Timothy Quimpo tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78" Veritas liberabit vos. Doveryai no proveryai.--- End Message ---
--- Begin Message ---> -----Original Message----- > From: Gerald Timothy Quimpo [mailto:[EMAIL PROTECTED]] > Sent: 02 January 2003 14:12 > > alternatively, if you don't want to change to array syntax, > you can use > variable variables. e.g., > > $variable_name="comment_".nIndex; // now comment_1, for example. > // assume that $comment_1 is "xxx111" > echo $$variable_name ; // prints xxx111 echo ${'comment'.$nIndex} works just as well. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211--- End Message ---
--- Begin Message ---I hope you all had a great New Year. Is attaching a document to an e-mail simply a matter of adding a new header in the mail function? Thanks, Eddie--- End Message ---
--- Begin Message ---Nope--it's a bit more complicated than that. However, there are a number of classes out there that can help you out with that. Cheers, Marco -- ---------------- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com!--- Begin Message ------ End Message ---I hope you all had a great New Year. Is attaching a document to an e-mail simply a matter of adding a new header in the mail function? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---Thanks Marco, I grabbed a few samples online yesterday, they had much more than just the mail attachements so I was just trying to sift through what I needed. Thanks, Eddie -----Original Message----- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 8:29 AM To: Edward Peloke Cc: [EMAIL PROTECTED] Subject: Re: [PHP] mail attachments Nope--it's a bit more complicated than that. However, there are a number of classes out there that can help you out with that. Cheers, Marco -- ---------------- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com!--- End Message ---
--- Begin Message ---Yes and no.... You need to add a "Content-type: multipart/mixed; boundary="Some_unique_string_here)" But then you also need to encode the documants and send them in the "message" of Mail. Look for multipart MIME types on the net to get an idea. Also if you find a nice class to encode bin files let us know about it. Maybe take a look at SquirrelMail or something. They must have that class. Mike *********** REPLY SEPARATOR *********** On 02/01/2003 at 9:07 AM [EMAIL PROTECTED] wrote: >I hope you all had a great New Year. Is attaching a document to an e-mail >simply a matter of adding a new header in the mail function? > >Thanks, >Eddie > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---Hello, On 01/02/2003 12:07 PM, Edward Peloke wrote:No, but if you try this class it becomes much easier than it is doing it manually:I hope you all had a great New Year. Is attaching a document to an e-mail simply a matter of adding a new header in the mail function?
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
--- End Message ---
--- Begin Message --- I use this mail class here:
http://www.phpguru.org/downloads/html.mime.mail/
Very, very good PHP class, I highly recommend it.
(And no I didn't write it.) =)
On Thu, 2003-01-02 at 09:14, Edward Peloke wrote:Thanks Marco,
I grabbed a few samples online yesterday, they had much more than just the
mail attachements so I was just trying to sift through what I needed.
Thanks,
Eddie
-----Original Message-----
From: Marco Tabini [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 8:29 AM
To: Edward Peloke
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] mail attachments
Nope--it's a bit more complicated than that. However, there are a number
of classes out there that can help you out with that.
Cheers,
Marco
--
----------------
php|architect - The Monthly Magazine for PHP Professionals
Come check us out on the web at http://www.phparch.com!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc--- End Message ---
signature.asc
Description: This is a digitally signed message part
--- Begin Message ---While on the subject of Multi-part Mime Type... I use to use it alot in the past in C cgi's (only Netscape supported at the time) to give status reports when doing long processes etc. This was back in the days when Netscaped ruled.... It was nice, since you could have a status message updated on the center of the page. Looked elegant as opposed to having messages continually listed. Anyways I tried the other day for a bit and still could not get it to work in IE. I guess they decided never to implement Mutli-part MIME into their browser. Or is there some other MIME type it's looking for to accomplish the same thing? If you have Netscape run this in and take a look to see what I mean. <?php $num = 10; $TMP = 'sdvdsvadsvasdvadsvwvadsvadsvadsvadsvadsvdsavsadvasdv'; Header( "Content-type: multipart/mixed; boundary=$TMP"); for($i=1; $i<=$num; $i++){ print "--$TMP\n"; print "Content-Type: text/html\n"; print "\n"; print "<table width=\"100%\" height=\"100%\">\n"; print "<tr><td align=\"center\" valign=\"middle\">\n"; print "$i\n"; print "</td></tr></table>\n\n\n\n"; flush(); sleep(1); } print "--$TMP--\n"; ?>--- End Message ---
--- Begin Message ---> -----Original Message----- > From: Simon Hay [mailto:[EMAIL PROTECTED]] > Sent: 30 December 2002 12:49 > > I have several PHP web applications which have large text boxes (Wiki > sites etc.). Usually, they work fine, but sometimes, if a large-ish > amount of text is entered, the server seems to receive a mangled mess > which includes the full text but with a second copy of part of it > inserted somewhere at the end. You can edit the page again, > remove the > extra content and save, but it'll just get added back... I originally > suspected this must be a problem with the PHP scripts themselves, but > now find that it happens with several different independent things so > can't be that simple. Furthermore, it worked happily on my previous > setup with Apache 1.3 and a slightly older PHP. AFAIR, there have been a few bug reports of similar behaviour, and in each case it's been put down to Apache 2. I'd suggest trying Apache 1 with latest PHP 4.3.0, and see if that solves your problem -- if so, it looks like it's another PHP4/Apache2 instability. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211--- End Message ---
--- Begin Message ---Hello, Running PHP 4.0.6 on RedHat 7.2. I'm writing a command line script (called scirpt.php) and am using the backtick operator to start other processes from my script. $com_response = `./other_script.php` ; or #com_response = `wget ....`; I can kill scirpt.php easily but that wont kill other_script.php, there would be no problem killing one process manually, but i could have many scirpts starting from the main script. Killing them all would be a task. I could prefix their name them with 'ch_' and kill all these. But thats not the solution i'm looking for. Is there a way to make a process a child, so that when the parent termintaes/is terminated the child terminates also ? thx gamin.--- End Message ---
--- Begin Message ---Actually to kill all of them would not be hard.... Try something like ps -eaf | grep httpd | awk '{print $2}' That will give you all the httpd processes... pipe that into kill Mike *********** REPLY SEPARATOR *********** On 02/01/2003 at 8:26 PM gamin wrote: >Hello, > > Running PHP 4.0.6 on RedHat 7.2. > > I'm writing a command line script (called scirpt.php) and am using the >backtick operator to start other processes from my script. > >$com_response = `./other_script.php` ; or #com_response = `wget ....`; > >I can kill scirpt.php easily but that wont kill other_script.php, there >would be no problem killing one process manually, but i could have many >scirpts starting from the main script. Killing them all would be a task. I >could prefix their name them with 'ch_' and kill all these. But thats not >the solution i'm looking for. > >Is there a way to make a process a child, so that when the parent >termintaes/is terminated the child terminates also ? >thx > >gamin. > > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---Michael J. Pawlowsky wrote:Actually to kill all of them would not be hard....actualy it will be named only other_script.php (it doesn't go through httpd).
Try something like
ps -eaf | grep httpd | awk '{print $2}'
You can execute the scripts with a dummy parameter that will be a random string and grep for
that in the above command.
That will give you all the httpd processes... pipe that into kill
Mike
*********** REPLY SEPARATOR ***********
On 02/01/2003 at 8:26 PM gamin wrote:
Hello,
Running PHP 4.0.6 on RedHat 7.2.
I'm writing a command line script (called scirpt.php) and am using the
backtick operator to start other processes from my script.
$com_response = `./other_script.php` ; or #com_response = `wget ....`;
I can kill scirpt.php easily but that wont kill other_script.php, there
would be no problem killing one process manually, but i could have many
scirpts starting from the main script. Killing them all would be a task. I
could prefix their name them with 'ch_' and kill all these. But thats not
the solution i'm looking for.
Is there a way to make a process a child, so that when the parent
termintaes/is terminated the child terminates also ?
thx
gamin.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---I was just giving you an example of how to get the listing of all processes. I didn't actually think you were going to kill all your httpd processes. I was taking it for granted you would change httpd to the name of your process. Mike *********** REPLY SEPARATOR *********** On 02/01/2003 at 4:51 PM Marek Kilimajer wrote: >Michael J. Pawlowsky wrote: > >>Actually to kill all of them would not be hard.... >> >>Try something like >> >>ps -eaf | grep httpd | awk '{print $2}' >> >> >actualy it will be named only other_script.php (it doesn't go through >httpd). >You can execute the scripts with a dummy parameter that will be a random >string and grep for >that in the above command.--- End Message ---
--- Begin Message ---Why by only typing http://localhost/ the index.php did not show up. I have to type http://localhost/index.php for the page to show up. How can I solve this problem?--- End Message ---
--- Begin Message ---in your http.conf file Add index.php in the list of default docs. Or if IIS in the IIS manager properties for that site. *********** REPLY SEPARATOR *********** On 02/01/2003 at 11:26 PM thkiat wrote: >Why by only typing http://localhost/ the index.php did not show up. I have >to type http://localhost/index.php for the page to show up. How can I solve >this problem? > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message --- Hi,
I thought there was only one XML standard (1.0)?
I guess my question should have been, when someone commits an HTTP POST sending me raw xml data to my PHP script, I imagine PHP would store it in some global variable. What variable is that?
Thanks,
Kris
Jimmy Brake wrote:
depends on which xml standard you are using .... the xml-rpc is what I
have been using to ACCEPT xml -- but it does have a server to accept xml
http://pear.php.net/package-search.php?pkg_name=xml&bool=AND&submit=Search
On Tue, 2002-12-31 at 13:20, Kristopher Yates wrote:
Hi,
Using PHP with cURL, I am currently able to dynamically create XML documents and HTTP POST to a remote server, receive an XML response, and parse XML as needed.
What I am having trouble finding information on is doing the reverse. Basically, I am trying to create a PHP script that acts as a server, so that a remote computer can HTTP POST XML to said script and then I parse and respond in XML. Again, I already have the reverse working using CURL - so basically I have created a client and now I need to create the server.
The only part I need help understanding is how do I get the XML into an array/variable when my script is hit with someone using HTTP POST to pass XML to it. I have an idea below (vague)..
I had the server guy HTTP POST some XML to a script which just had
<? phpinfo(); ?>
I see in the HTTP Request Headers of the phpinfo() output that it received content type text/xml but nowhere do I see what was actually received (the actual xml that was sent). I thought maybe PHP would take the stuff after the header and push it into an array/variable but no such luck (argv?).
I am wondering if anyone has any helpful information. I imagine something like the following psuedo code:
if($HTTP_CONTENT_TYPE=="text/xml"){
//use some php function(s) to pass incoming xml stream to an array that I can then pass to my
//xml parser
}
I hope this gives you enough information to figure out my dilema. If someone can shed a little light on this subject it would be GREATLY appreciated.
Thanks,
Kris
[EMAIL PROTECTED]
.
--- End Message ---
--- Begin Message --- AH! That is my ticket! Thanks. Yes, my client was posting to my "wanna be server script" with mime type text/xml. I should be able to easilly take $HTTP_RAW_POST_DATA and pass it straight on to my XML parser. I imagine, when someone posts xml, $HTTP_RAW_POST_DATA will appear as an array. Just what I need.
Thanks,
Kris
Timothy Hitchens (HiTCHO) wrote:
You can post to your server with a mimetype of "text/xml"
and in your script pickup the raw post as:
$HTTP_RAW_POST_DATA
Then just process this string as XML and return to buffer or not.
Have fun.
Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]
HiTCHO | Open Platform Web Development
Consutling - Outsourcing - Training - Support
----- Original Message ----- From: "Kristopher Yates" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 01, 2003 7:20 AM
Subject: [PHP] receiving XML stream as server via PHP
Hi,.
Using PHP with cURL, I am currently able to dynamically create XML documents and HTTP POST to a remote server, receive an XML response, and parse XML as needed.
What I am having trouble finding information on is doing the reverse. Basically, I am trying to create a PHP script that acts as a server, so that a remote computer can HTTP POST XML to said script and then I parse and respond in XML. Again, I already have the reverse working using CURL - so basically I have created a client and now I need to create the server.
The only part I need help understanding is how do I get the XML into an array/variable when my script is hit with someone using HTTP POST to pass XML to it. I have an idea below (vague)..
I had the server guy HTTP POST some XML to a script which just had
<? phpinfo(); ?>
I see in the HTTP Request Headers of the phpinfo() output that it received content type text/xml but nowhere do I see what was actually received (the actual xml that was sent). I thought maybe PHP would take the stuff after the header and push it into an array/variable but no such luck (argv?).
I am wondering if anyone has any helpful information. I imagine something like the following psuedo code:
if($HTTP_CONTENT_TYPE=="text/xml"){
//use some php function(s) to pass incoming xml stream to an array that I can then pass to my
//xml parser
}
I hope this gives you enough information to figure out my dilema. If someone can shed a little light on this subject it would be GREATLY appreciated.
Thanks,
Kris
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message --- Hi Chris,
Long time no talk to! Hope you had a good new year.
Thanks for the info. My development is basically similar to SOAP and XML-RPC like that used for RSS. I'll probably get more into it [SOAP] when they [PEAR gurus] get past the beta testing stage.
I am happy with what I have to work with as is for now (PHP with cURL for client side scripts and reuse all that code to create server side scripts) but definitely interested in the alternatives.
Can you email me the URL to NuSOAP and the PEAR SOAP pages?
Also, do you (or anyone) have any comparative information on these two methods/classes?
Thanks again Chris. Good to hear from ya.
Kris
Boget, Chris wrote:
> Using PHP with cURL, I am currently able to dynamically > create XML documents and HTTP POST to a remote server, > receive an XML response, and parse XML as needed. > What I am having trouble finding information on is doing > the reverse. Basically, I am trying to create a PHP script > that acts as a server, so You might want to look into SOAP. It sounds like it will fit your needs very well. PEAR has a SOAP implementation that's still in testing and there is a class out there called NuSOAP that's supposedly very good. I just started toying around with it recently and it seems to work very well. Chris--- End Message ---
--- Begin Message --- Hi,
I was just curious, is there a reason $HTTP_RAW_POST_DATA isn't included in the phpinfo() function? I would imagine one could see all globals via phpinfo().. Is $HTTP_RAW_POST_DATA global or is it only global if globals are registered (php.ini setting)? From what I can tell, this var is not global, regardless of the registered_globals setting in php.ini.
Not an important issue, but curious what ye creators of PHP language opinion/thoughts on this is.
Regards
Kris
Timothy Hitchens (HiTCHO) wrote:
You can post to your server with a mimetype of "text/xml"
and in your script pickup the raw post as:
$HTTP_RAW_POST_DATA
Then just process this string as XML and return to buffer or not.
Have fun.
Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED]
HiTCHO | Open Platform Web Development
Consutling - Outsourcing - Training - Support
----- Original Message ----- From: "Kristopher Yates" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 01, 2003 7:20 AM
Subject: [PHP] receiving XML stream as server via PHP
Hi,.
Using PHP with cURL, I am currently able to dynamically create XML documents and HTTP POST to a remote server, receive an XML response, and parse XML as needed.
What I am having trouble finding information on is doing the reverse. Basically, I am trying to create a PHP script that acts as a server, so that a remote computer can HTTP POST XML to said script and then I parse and respond in XML. Again, I already have the reverse working using CURL - so basically I have created a client and now I need to create the server.
The only part I need help understanding is how do I get the XML into an array/variable when my script is hit with someone using HTTP POST to pass XML to it. I have an idea below (vague)..
I had the server guy HTTP POST some XML to a script which just had
<? phpinfo(); ?>
I see in the HTTP Request Headers of the phpinfo() output that it received content type text/xml but nowhere do I see what was actually received (the actual xml that was sent). I thought maybe PHP would take the stuff after the header and push it into an array/variable but no such luck (argv?).
I am wondering if anyone has any helpful information. I imagine something like the following psuedo code:
if($HTTP_CONTENT_TYPE=="text/xml"){
//use some php function(s) to pass incoming xml stream to an array that I can then pass to my
//xml parser
}
I hope this gives you enough information to figure out my dilema. If someone can shed a little light on this subject it would be GREATLY appreciated.
Thanks,
Kris
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---That data is only populated when always_populate_raw_post_data is on (check your php.ini). Chris --- Kristopher Yates <[EMAIL PROTECTED]> wrote: > I was just curious, is there a reason $HTTP_RAW_POST_DATA > isn't included in the phpinfo() function? I would > imagine one could see all globals via phpinfo().. Is > $HTTP_RAW_POST_DATA global or is it only global if > globals are registered (php.ini setting)? From what I > can tell, this var is not global, regardless of the > registered_globals setting in php.ini.--- End Message ---
--- Begin Message --- Hello ppl,
I was trying to do something with an array...I guess you could see what I mean from the code below:
$test[0] = "hey";
$test[1] = "hi";
$test[2] = "hello";
Now I want to hold various values in $test[0]["hey"] = "1" and $test[1]["hi"] = "2" and $test[2]["hello"] = "3"
and then I want to use the function let's say in_array("hey", $test) and if it's found in the array I want to update the value in that array from 1 to 1+1 or anything...
All of the above would be done dynamically from database, the above is just to get the Logic..I hope it's possible...I am keeping my fingers crossed...
Thank You
Best Regards,
Dhaval
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
--- End Message ---
--- Begin Message ------ Dhaval Desai <[EMAIL PROTECTED]> wrote: > $test[0] = "hey"; > $test[1] = "hi"; > $test[2] = "hello"; > > Now I want to hold various values in $test[0]["hey"] = > "1" and $test[1]["hi"] = "2" and $test[2]["hello"] = "3" Try this instead: $test["0"]["hey"] = 1; $test["1"]["hi"] = 2; $test["2"]["hello"] = 3; Also, remember that you can often learn these types of things with trial and error by using the print_r() function: print_r($test); Chris--- End Message ---
--- Begin Message ---Hi, Thanx for the reply, well but what about the second part or my mail.. I want to use in_array("value", $array); and if found, I want to update the value of that variable...I want to update $test["0"]["hey"] and set it as 1+1;$test["0"]["hey"] = 1; $test["1"]["hi"] = 2; $test["2"]["hello"] = 3;
I think it's possible using splice()m I don't know exactly how to use it with Multi Dimensional arrays....
Also is there any idea on how can we count() the values in a multi dimensional arrays...
Thanx
From: Chris Shiflett <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Dhaval Desai <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject: Re: [PHP] Multidimensional Array manipluation... Date: Thu, 2 Jan 2003 09:04:27 -0800 (PST) --- Dhaval Desai <[EMAIL PROTECTED]> wrote: > $test[0] = "hey"; > $test[1] = "hi"; > $test[2] = "hello"; > > Now I want to hold various values in $test[0]["hey"] = > "1" and $test[1]["hi"] = "2" and $test[2]["hello"] = "3" Try this instead: $test["0"]["hey"] = 1; $test["1"]["hi"] = 2; $test["2"]["hello"] = 3; Also, remember that you can often learn these types of things with trial and error by using the print_r() function: print_r($test); Chris
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
--- End Message ---
--- Begin Message ---> >$test["0"]["hey"] = 1; > >$test["1"]["hi"] = 2; > >$test["2"]["hello"] = 3; > > I want to update $test["0"]["hey"] and set it as 1+1; If you just want to increment the value: $test["0"]["hey"]++; > Also is there any idea on how can we count() the values > in a multi dimensional arrays... The function array_count_values() might give you what you want. What are you wanting to count exactly? A good reference for you online is: http://www.php.net/manual/en/ref.array.php Chris--- End Message ---
--- Begin Message --- Hi,
Well, I will be having something like this:
$se5f2254321s65s32s65[] will hold various valus like jan_1,jan-2,jan_3,jan_4 etc and then jan_1 will hold 1, jan_2=2,, jan_3=1 etc etc...
Depending on certain conditions, I want to increment the values of certain values in the array...like...
for($i=0; $i<=count($se5f2254321s65s32s65); $i++)
{
$se5f2254321s65s32s65[$i]["jan_1"] = 1
}
I want to increment it with 1 and so on for the various other values....
Thanx
Best Regards,
Dhaval
From: Chris Shiflett <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Dhaval Desai <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: [PHP] Multidimensional Array manipluation... Date: Thu, 2 Jan 2003 09:30:43 -0800 (PST) > >$test["0"]["hey"] = 1; > >$test["1"]["hi"] = 2; > >$test["2"]["hello"] = 3; > > I want to update $test["0"]["hey"] and set it as 1+1; If you just want to increment the value: $test["0"]["hey"]++; > Also is there any idea on how can we count() the values > in a multi dimensional arrays... The function array_count_values() might give you what you want. What are you wanting to count exactly? A good reference for you online is: http://www.php.net/manual/en/ref.array.php Chris
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
--- End Message ---
--- Begin Message ---Jochen Kaechelin wrote:I don't know whether PHP Accelator depends on the version of Apache (I mostly doubt it), but it's free and seems to be well maintained. Try it:Is there a free php accelerator out there which runs under Apache 2?
http://php-accelerator.co.uk/
gerzson
--- End Message ---
--- Begin Message ---Jochen Kaechelin wrote:I don't know whether PHP Accelator depends on the version of Apache (I mostly doubt it), but it's free and seems to be well maintained. Try it:Is there a free php accelerator out there which runs under Apache 2?
http://php-accelerator.co.uk/
gerzson
--- End Message ---
--- Begin Message ---Hi again, Now I did a different approach using an array as parameter and giving an array back. Strangely though it doesnt really work. Following "hack" solution works as expected: $num = pg_numrows($result); for ($i = 0; $i < $num; $i++) { $ret_arr[$i] = pg_fetch_array($result); $ret_arr[$i]["name"] = utf8_decode($ret_arr[$i]["name"]); $ret_arr[$i]["title"] = utf8_decode($ret_arr[$i]["title"]); $ret_arr[$i]["message"] = utf8_decode($ret_arr[$i]["message"]); } return $ret_arr; Following solution does not: $num = pg_numrows($result); for ($i = 0; $i < $num; $i++) { $ret_arr[$i] = pg_fetch_array($result); $ret_arr[$i] = unicode_dec($ret_arr[$i]); } return $ret_arr; function unicode_dec($arr) { foreach($arr as $key => $val) { $arr[$key] = utf8_decode($val); } return $arr; } Why does the 2nd solution not do what it is supposed to? The 2nd solution works in that it outputs correctly what is in the database but it does not do unicode decoding on the output, wheras the first solution does! I really do not know why this does not work properly! I am using php 4.2.1 TIA, Ata ----- Original Message ----- From: "Atahualpa Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 02, 2003 1:27 AM Subject: [PHP] func_get_args() and call-by-reference? Hi, I try to do a function called unicode_enc() which takes a number of parameters that differ between calls. It should encode all parameters to unicode using utf8_encode($arglist[$i]). I am using Variable-length argument lists as described in the manual and tried to call the function this way: unicode_enc(&$text); but to no success. Is call-by-reference possible when using func_get_args? TIA, Ata--- End Message ---
--- Begin Message ---As I've said a bunch of times, I hate plugging my own software, but you can try cryptopp-php, which should provide all the encryption you need, and it works on both UNIX and Windows. http://www.tutorbuddy.com/software/ J Alex Piaz wrote: > As far as I know, there is no mcrypt windows version. Youīll have to try > to compile it yourself. And donīt ask me how because I donīt know:-) > > A sugestion: If you can, change to linux. Itīs better and itīs Free. > > Regards > > Alex > >--- End Message ---