[PHP] Please help with Array..
Hi all how are yas? I have one question for which I could not find the answer: How do I remove an element of an array with a specific key or index? To be clearer: Lets say I have an array $shoppingCart[] (quite a lot of them) I want to delete $shoppingCart[345] (which is not the last or the first) How do I do it? I have checked the PHP manual... it has array_pop, array_shift which are for the last element and the first element. But what about specific elements in between the first and the last? Please help out... I'm really in a rush to finish my project... :( Thanks s much in advance for your time. Yours, Wee Keat Chin --- "Man is only truly great when he acts from his passions."
RE: [PHP] Translatting php to binary...
[snip] PHP is a scripting language I am pretty much aware of that... But is there a way to translate php into binary/machine code or would one have to write a translator program? [/snip] PHP has an underlying binary translator, but I don't think that the source code is available from Zend. Are you looking for a way to compile PHP scripts? If so, is the reason so that others will not have access to your code? If that is the Case you could always look at the Zend Encoder. If notignore me, it's Friday! :^] Jay "Todays mighty oak is just yesterdays nut" * * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/* * No developer is an island ... * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Speed Question
thx "Jason Wong" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thursday 18 July 2002 19:32, JJ Harrison wrote: > > if I do this: > > > > if(validate($_POST['password'], $_POST['username']) != 0) > > echo validate($_POST['password'], $_POST['username']); > > > > will it execute the function twice or use the same result twice? > > Function executes twice. > > > would it be (slightly) faster to do this: > > > > $uid = validate($_POST['password'], $_POST['username']) > > if($uid != 0) > > echo $uid); > > Probably. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > If fifty million people say a foolish thing, it's still a foolish thing. > -- Bertrand Russell > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Translatting php to binary...
PHP is a scripting language I am pretty much aware of that... But is there a way to translate php into binary/machine code or would one have to write a translator program? Kondwani... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Arrays and Regs
Firstly, many thanks to Richard and Dan... >>A quick test script in PHP would have been faster than asking... :-)<< It was just one of those questions that I had burning in my mind at the time, and since I don't have access to PHP at work (As if the Government would allow that!), I had to ask :o) And to Dan: I would love to change the line margins of my email client, but unfortunately Novell Groupwise sucks, and the government will not, without exception, allow customization of any software, whatsoever. So I'm stuck with it. Thanks again guys! Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] systematic "glitch" in pages due to cache?
hello everybody, I have a real problem, and a vague description to it (can you guess?: newbie). I've created a site which retrieves a word from a database and displays it. The user enters another word (a translation) which is checked against the solution and feedback is given. These words are passed around in sessionvariables. Systematically after a while, I get a very slow loading of the page (and therefor the word i got from the database). In the end, i get my data, but it's slow and always with the same interval. I have a feeling this might be related to some garbage retrieval, or cache problem with the browser, but I can't figure it out. Does anybody has some suggestions? I'd really appreciate it! cheers, Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Searching...
In article <[EMAIL PROTECTED]>, php- [EMAIL PROTECTED] says... > On Friday 19 July 2002 14:08, David Robley wrote: > > > You might consider running the first query just to get a COUNT(), rather > > than extracting all the resulting rows and using mysql_numrows to > > determine how many were returned > > Am I missing something? If you do a COUNT() in the query then, in general, > it'll only return 1 row. You then use this row to determine the result of the > COUNT(). IE using mysql_numrows() on this result is inappropriate. > > Nope. The OP sounded like he was pulling the entire query and doing a mysql_num_rows on it, then running the query again. Of course, I may have misunderstood what he was saying... Cheers -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Speed Question
On Thursday 18 July 2002 19:32, JJ Harrison wrote: > if I do this: > > if(validate($_POST['password'], $_POST['username']) != 0) > echo validate($_POST['password'], $_POST['username']); > > will it execute the function twice or use the same result twice? Function executes twice. > would it be (slightly) faster to do this: > > $uid = validate($_POST['password'], $_POST['username']) > if($uid != 0) > echo $uid); Probably. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* If fifty million people say a foolish thing, it's still a foolish thing. -- Bertrand Russell */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Speed Question
if I do this: if(validate($_POST['password'], $_POST['username']) != 0) echo validate($_POST['password'], $_POST['username']); will it execute the function twice or use the same result twice? would it be (slightly) faster to do this: $uid = validate($_POST['password'], $_POST['username']) if($uid != 0) echo $uid); -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with sockets
1) you use whats called an "Itterative Server Model". That is to say you create an list of all the sockets you are using and pass them to "socket_select" (http://www.php.net/manual/en/function.socket-select.php) and it will tell you which ones are ready to be read from, which can be written to and which have exceptions. 2) I am not too sure what you mean here but using the select you can find out which socket have info in their buffers and then read it so there will be no blocking on I/O -- -- Stephen Brewster Email: [EMAIL PROTECTED] Tel: 0116 2335545 Mobile: 07776 475849 ICQ: 383095 -- UNIX SEX unzip; strip; touch; finger; mount; fsck; more; yes; umount; sleep "Jeremy" <[EMAIL PROTECTED]> wrote in message 004401c22edc$a848a090$0202a8c0@L5">news:004401c22edc$a848a090$0202a8c0@L5... > How can I do the following with PHP? > > 1) Accept more than 1 connections without forking > 2) socket_read and fgets from 2 connections at the same time > > please help! > thanks in advance > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ErrorDocument 404 & Form
Peter a écrit : > If you removed the > ErrorDocument 404 /phpinfo.php > from the apache conf (or reset it to original value), what happens? Do you > get a standard 404 not found error page? Sure. But it's an apache problem, it drops the body as soon as you do have a 404 error. Sux :p -- Fabien Penso <[EMAIL PROTECTED]> | LinuxFr a toujours besoin de : http://perso.LinuxFr.org/penso/ | http://linuxFr.org/dons/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't this work?
Eh.. probably should be: $result = mysql_query("SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'"); $row=mysql_fetch_row($result) print $row['id']; René René Moonen wrote: > Well if you *know* your query only returns one row or you are just > interessed in the first row, just forget about the while construction > > $result = mysql_query("SELECT id FROM ma_users WHERE > user='$PHP_AUTH_USER'"); > $id=mysql_fetch_row($result) > print $id; > > Good luck > > René > > > John Wulff wrote: > >> Didn't work, but its a great place for me to start from. >> As far as the difference between a looping query and a non looping >> query, >> i understand the difference but not exactly how to go about writing a >> non >> looping query. This bit of code is looping, and i assume it dosen't >> need >> to be, how do i fix this? >> $result = mysql_query("SELECT id FROM ma_users where >> user='$PHP_AUTH_USER'"); >> while(list($id) = mysql_fetch_row($result)) >> { >> print($id); >> } >> >> >> >>> hmm... seems a MySQL topic. >>> I suppose that your table is filled with correct data at some other >>> point. So what you need is a count query that returns >>> *one* result and not all records in that table. You do not want a >>> *while* loop in your PHP script, because that would show a list of >>> unique ips. So my gues would be: >>> >>> $result = mysql_query("SELECT COUNT(DISTINCT IP) AS ips FROM >>> ma_counter"); $ips = mysql_fetch_row($result); >>> pintf("Visitors = %d",$ips); >>> >>> Disclaimer: code not tested. You might want to check the MySQL manual >>> for syntax details of the query. >>> >>> Good luck >>> >>> René >>> >>> >>> John Wulff wrote: >>> >>> >>> You're a savior, don't know how i missed that. Thanks a bunch. Now, one more quick question if you don't mind. I've got this query at the bottom of my page for the purpose of a counter. But naturally i don't want a list of all the ips logged, i just want a count of how many unique ips there are in the table. How do i go about this?>>> $result = mysql_query("SELECT distinct ip from ma_counter"); while(list($ip) = mysql_fetch_row($result)) { print ("$ip"); } ?> > > > > > > >> $mode = "entrance"; >> if ($mode == "entrance") { >> >> >> >> > > > I suppose you added the first line ($mode = "entrance"; ) for testing > purposes during debugging, but in order for the script to work you > should now remove it, because now $mode will always have the value > "entrance" > > good luck > > > René > > > >>> >> >> >> >> >> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't this work?
Well if you *know* your query only returns one row or you are just interessed in the first row, just forget about the while construction $result = mysql_query("SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'"); $id=mysql_fetch_row($result) print $id; Good luck René John Wulff wrote: >Didn't work, but its a great place for me to start from. >As far as the difference between a looping query and a non looping query, >i understand the difference but not exactly how to go about writing a non >looping query. This bit of code is looping, and i assume it dosen't need >to be, how do i fix this? >$result = mysql_query("SELECT id FROM ma_users where user='$PHP_AUTH_USER'"); >while(list($id) = mysql_fetch_row($result)) >{ >print($id); >} > > > >>hmm... seems a MySQL topic. >>I suppose that your table is filled with correct data at some other >>point. So what you need is a count query that returns >>*one* result and not all records in that table. You do not want a >>*while* loop in your PHP script, because that would show a list of >>unique ips. So my gues would be: >> >>$result = mysql_query("SELECT COUNT(DISTINCT IP) AS ips FROM >>ma_counter"); $ips = mysql_fetch_row($result); >>pintf("Visitors = %d",$ips); >> >>Disclaimer: code not tested. You might want to check the MySQL manual >>for syntax details of the query. >> >>Good luck >> >>René >> >> >>John Wulff wrote: >> >> >> >>>You're a savior, don't know how i missed that. Thanks a bunch. Now, >>>one more quick question if you don't mind. I've got this query at the >>>bottom of my page for the purpose of a counter. But naturally i don't >>>want a list of all the ips logged, i just want a count of how many >>>unique ips there are in the table. How do i go about this?>>$result = mysql_query("SELECT distinct ip from ma_counter"); >>>while(list($ip) = mysql_fetch_row($result)) >>>{ >>>print ("$ip"); >>>} >>>?> >>> >>> >>> >>> >>> >>> > $mode = "entrance"; > if ($mode == "entrance") { > > > > > I suppose you added the first line ($mode = "entrance"; ) for testing purposes during debugging, but in order for the script to work you should now remove it, because now $mode will always have the value "entrance" good luck René >>> >>> >>> >>> > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to Detect File in a Specifc Directory on Window Env?
Johan Holst Nielsen wrote: >> > //DATEFORMAT MMDD >> if($dir=@opendir("/yourdirwithpdf")) { >> echo "Found following files:" >> while(($file=readdir($dir))!==false) { >> if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) { >> echo ''.$file.'<\n>'; >> } >> } >> } >> ?> > > > UPS > > if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf", $file)) > > The ereg line should look like this :) > Wow, I also forgot to close the dir handle! Well I will let you do that :) Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why won't this work?
> From: René Moonen [mailto:[EMAIL PROTECTED]] > Sent: Friday, July 19, 2002 11:01 AM > $result = mysql_query("SELECT COUNT(DISTINCT IP) AS ips FROM ma_counter"); You _might_ need to add "GROUP BY ip" (without quotes) to the end of that query. > Disclaimer: code not tested. You might want to check the MySQL manual Still not tested :-) Regards Joakim Andersson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to Detect File in a Specifc Directory on Window Env?
> //DATEFORMAT MMDD > if($dir=@opendir("/yourdirwithpdf")) { > echo "Found following files:" > while(($file=readdir($dir))!==false) { > if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) { > echo ''.$file.'<\n>'; > } > } > } > ?> UPS if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf", $file)) The ereg line should look like this :) Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to Detect File in a Specifc Directory on Window Env?
Jack wrote: > Dear all > I had a folder which contains a lot of pdf file, the name format of the pdf > files are : x.dateformat.pdf (eg : abcdefg.20020718.pdf). > Now i want to use the php script to detect what files it got in a specific > folder. > i want to make a user input form which will let user to input the date and > then i will look for the pdf report from this specific folder base on the > Date given! > > I think one of the quickest way is to ask php to check the filename from > "Right to Left" which is the Date format! > > But i don't know which php function will perform this task (Check filename > from Right to Left). > > If you have any other suggestion, pls help me! I think I would do something like this: '.$file.'<\n>'; } } } ?> Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to Detect File in a Specifc Directory on Window Env?
I'd use something like: to retrieve dir listing. If you make a function from it, which you'll give a path for argument you can make the script index an entire dir struct. With is_file() you can check to see if the dirlist entry is a file. Then, you can split every filename in different parts with something like $parts = split(".", $filename); $parts[0] will then have the "abcdefg" part of the filename $parts[1] will have the timestamp $parts[2] will have the extension. I hope that this answers your question. You may want to insert the file data in a database for easy searching, and run a script to index the dir every now and then. Greetz, Wouter -- Alle door mij verzonden email is careware. Dit houdt in dat het alleen herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid. All email sent by me is careware. This means that it can only be reread and kept if you are good for all the life here on earth and beyond. If you don't agree to these terms, you should return this email in no more than 24 hours stating the reason of disagreement. -Oorspronkelijk bericht- Van: Jack [mailto:[EMAIL PROTECTED]] Verzonden: vrijdag 19 juli 2002 11:00 Aan: [EMAIL PROTECTED]; [EMAIL PROTECTED] Onderwerp: [PHP] How to Detect File in a Specifc Directory on Window Env? Dear all I had a folder which contains a lot of pdf file, the name format of the pdf files are : x.dateformat.pdf (eg : abcdefg.20020718.pdf). Now i want to use the php script to detect what files it got in a specific folder. i want to make a user input form which will let user to input the date and then i will look for the pdf report from this specific folder base on the Date given! I think one of the quickest way is to ask php to check the filename from "Right to Left" which is the Date format! But i don't know which php function will perform this task (Check filename from Right to Left). If you have any other suggestion, pls help me! -- Thx a lot! Jack [EMAIL PROTECTED] -- 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] How to Detect File in a Specifc Directory on Window Env?
Dear all I had a folder which contains a lot of pdf file, the name format of the pdf files are : x.dateformat.pdf (eg : abcdefg.20020718.pdf). Now i want to use the php script to detect what files it got in a specific folder. i want to make a user input form which will let user to input the date and then i will look for the pdf report from this specific folder base on the Date given! I think one of the quickest way is to ask php to check the filename from "Right to Left" which is the Date format! But i don't know which php function will perform this task (Check filename from Right to Left). If you have any other suggestion, pls help me! -- Thx a lot! Jack [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't this work?
hmm... seems a MySQL topic. I suppose that your table is filled with correct data at some other point. So what you need is a count query that returns *one* result and not all records in that table. You do not want a *while* loop in your PHP script, because that would show a list of unique ips. So my gues would be: $result = mysql_query("SELECT COUNT(DISTINCT IP) AS ips FROM ma_counter"); $ips = mysql_fetch_row($result); pintf("Visitors = %d",$ips); Disclaimer: code not tested. You might want to check the MySQL manual for syntax details of the query. Good luck René John Wulff wrote: >You're a savior, don't know how i missed that. Thanks a bunch. Now, one >more quick question if you don't mind. I've got this query at the bottom >of my page for the purpose of a counter. But naturally i don't want a >list of all the ips logged, i just want a count of how many unique ips >there are in the table. How do i go about this?$result = mysql_query("SELECT distinct ip from ma_counter"); >while(list($ip) = mysql_fetch_row($result)) >{ >print ("$ip"); >} >?> > > > > >> >> >> >> >>> $mode = "entrance"; >>> if ($mode == "entrance") { >>> >>> >>> >> >>I suppose you added the first line ($mode = "entrance"; ) for testing >>purposes during debugging, but in order for the script to work you >>should now remove it, because now $mode will always have the value >>"entrance" >> >>good luck >> >> >>René >> >> > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pdflib
Hello, can you tell me what i have to do to generate more than one pdf document with pdflib. At the moment i am not able to do this. the only thing i can do is actually to make one pdf. It is really important for me to bring more sites in one document. the problem is not solved if i just make more than one doc. thx Joey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't this work?
> $mode = "entrance"; > if ($mode == "entrance") { > I suppose you added the first line ($mode = "entrance"; ) for testing purposes during debugging, but in order for the script to work you should now remove it, because now $mode will always have the value "entrance" good luck René -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] best way to delete char# 4-7 from a string?
> From: Justin French [mailto:[EMAIL PROTECTED]] > Sent: Friday, July 19, 2002 7:39 AM > To: php > Subject: [PHP] best way to delete char# 4-7 from a string? > > > Hi, > > Let's say I have the following string: > > $str = 'abcdefghijklmnop'; > > ...and I want to strip out char #'s 4 through to 7 (d,e,f,g) > > $strip_start = 4; > $strip_end = 7; > > ($str would now be 'abchijklmnop';) > > THEN I want to plug a new string $filler at position 4 > > $filler = '4567'; > > ($str would now be 'abc4567hijklmnop') Hi, substr_replace() does exactly what you want. $newstring = substr_replace($str, "4567", 4, 4); Regards Joakim Andersson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't this work?
En réponse à Mantas Kriauciunas <[EMAIL PROTECTED]>: Hi You use = instead of == So, the first condition is always true Regards Julien > Hello John, > > Friday, July 19, 2002, 12:25:12 AM, you wrote: > > JW> Any ideas on why this won't work? It will only > include("inc/entrance.php") > JW> It never, no matter what the value of $mode, displays > collection.php. > > thinking logicaly: > > JW> JW>$mode = "entrance"; $mode is "entrance" > JW>if ($mode = "entrance") { looks if mode is > "entrance" which is > JW> include("inc/entrance.php");if was true so it > includes entrance > JW>} > JW>else if ($mode = "collection") { looking again if for > same $mode if it is "collection" but it was in first line "entrance" > JW> include("inc/collection.php"); if was false it never > executes this part! > JW>} > > JW>?> > > so what are you trying to get? both included? > if yes this will include both: > > $mode = "entrance"; >if ($mode = "entrance") { > include("inc/entrance.php"); >} >$mode = "collection"; >if ($mode = "collection") { > include("inc/collection.php"); >} > >?> > > >sorry if i didn't understood the question! > > -- > Best regards, > Mantasmailto:[EMAIL PROTECTED] > > > -- > 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
Re: [PHP] Re: Searching...
On Friday 19 July 2002 14:08, David Robley wrote: > You might consider running the first query just to get a COUNT(), rather > than extracting all the resulting rows and using mysql_numrows to > determine how many were returned Am I missing something? If you do a COUNT() in the query then, in general, it'll only return 1 row. You then use this row to determine the result of the COUNT(). IE using mysql_numrows() on this result is inappropriate. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Keep up the good work! But please don't ask me to help. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: get line from file
On Friday 19 July 2002 15:43, Peter wrote: > You can try this. > > > $datafile = file("..."); // Here comes your filename > > for ($k=0; $k<=count($datafile)-1; $k++) { > > echo "$datafile[$k]"; // Display each line read from datafile > > } > > ?> foreach ($datafile as $line) { echo "$line"; } is a lot simpler and easier to understand. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I stick my neck out for nobody. -- Humphrey Bogart, "Casablanca" */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: get line from file
I think more info is probably needed here. Is it always the literal string "line3" that you want to catch, or always the second last line? Some kind of regular expression solution is probably what you need. Michael On Fri, 19 Jul 2002, Peter wrote: > You can try this. > > > $datafile = file("..."); // Here comes your filename > > for ($k=0; $k<=count($datafile)-1; $k++) { > > echo "$datafile[$k]"; // Display each line read from datafile > > } > > ?> > > > "Yamin Prabudy" <[EMAIL PROTECTED]> schreef in bericht > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I got a file line like this > > > > > > This is a line1 > > this is a line2 > > this is a line3 > > this is a line4 > > > > > > > > > > how can i grep out the line1,line2,line3 ?? > > do anyone out there have any idea ? > > > > > > -- n i n t i . c o m php-python-perl-mysql-postgresql Michael Hall [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting name of referenced variable into string
Is there a way to get and store the name of a referenced variable into another variable? Example... $varname = "blah"; checkit($varname); function checkit(&$name) { ...code... } In the function above, I'd like to find out the name of the referenced variable (pointed to by $name) which should equal "varname" so I can store this string in another variable (i.e., $thename = "varname"). Is there a way to do this in PHP?? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: get line from file
You can try this. "; // Display each line read from datafile } ?> "Yamin Prabudy" <[EMAIL PROTECTED]> schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I got a file line like this > > > This is a line1 > this is a line2 > this is a line3 > this is a line4 > > > > > how can i grep out the line1,line2,line3 ?? > do anyone out there have any idea ? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sablotron confusion
I've just downloaded a bunch of stuff from www.gingerall.org, which I hope will set up Sablotron on my RH7.2/Apache1.3.24/PHP4.2.1 box. Can I just use the rpms?: sablotron-0.95-1.i386.rpm sablotron-devel-0.95-1.i386.rpm There is also a "Sablot-0.95-PHP.patch" in there, plus a Sablot-0.95.tar.gz package that won't untar which I guess is the source. I found the directions about what packages I needed pretty confusing. Any advice anyone? I know I need to recompile PHP when Sablotron is installed. TIA Michael Hall [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Why won't this work?
Hello Rasmus, Friday, July 19, 2002, 12:26:45 AM, you wrote: RL> You need == instead of = there RL> On Fri, 19 Jul 2002, John Wulff wrote: >> Any ideas on why this won't work? It will only include("inc/entrance.php") >> It never, no matter what the value of $mode, displays collection.php. >> >>>$mode = "entrance"; >>if ($mode = "entrance") { >> include("inc/entrance.php"); >>} >>else if ($mode = "collection") { >> include("inc/collection.php"); >>} >> >>?> oh yea, didn't look closely and didn't understand question clearly :/ guess im tired:( good night...sorry about my letter:/ thnx -- Best regards, Mantasmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't this work?
You probably do not have a background of C / C++ programming ;-) assignments:single equal sign comparison:dual equal sign The *assignments* in your if statements are always TRUE, so it will always execute the statements after the first *if* So use if ($mode == "entrance") { and else if ($mode == "collection") { And all works well... René -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Why won't this work?
Well, first thing I see is that you need to change this: if ($mode == "entrance") You need the double equal signs for string comparison. > From: [EMAIL PROTECTED] (John Wulff) > Newsgroups: php.general > Date: Fri, 19 Jul 2002 00:25:12 -0700 > To: [EMAIL PROTECTED] > Subject: Why won't this work? > > Any ideas on why this won't work? It will only include("inc/entrance.php") > It never, no matter what the value of $mode, displays collection.php. > > $mode = "entrance"; > if ($mode = "entrance") { > include("inc/entrance.php"); > } > else if ($mode = "collection") { > include("inc/collection.php"); > } > > ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't this work?
You need == instead of = there On Fri, 19 Jul 2002, John Wulff wrote: > Any ideas on why this won't work? It will only include("inc/entrance.php") > It never, no matter what the value of $mode, displays collection.php. > >$mode = "entrance"; >if ($mode = "entrance") { > include("inc/entrance.php"); >} >else if ($mode = "collection") { > include("inc/collection.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
Re: [PHP] Why won't this work?
Hello John, Friday, July 19, 2002, 12:25:12 AM, you wrote: JW> Any ideas on why this won't work? It will only include("inc/entrance.php") JW> It never, no matter what the value of $mode, displays collection.php. thinking logicaly: JW>$mode = "entrance"; $mode is "entrance" JW>if ($mode = "entrance") { looks if mode is "entrance" which is JW> include("inc/entrance.php");if was true so it includes entrance JW>} JW>else if ($mode = "collection") { looking again if for same $mode if it is "collection" but it was in first line "entrance" JW> include("inc/collection.php"); if was false it never executes this part! JW>} JW>?> so what are you trying to get? both included? if yes this will include both: sorry if i didn't understood the question! -- Best regards, Mantasmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why won't this work?
Any ideas on why this won't work? It will only include("inc/entrance.php") It never, no matter what the value of $mode, displays collection.php. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php