Re: [PHP] newbie question
* Thus wrote Eugene Lee ([EMAIL PROTECTED]): > On Sun, Oct 12, 2003 at 06:57:35PM +1000, Wang Feng wrote: > : > : If I get rid of the 0 and tried this: > : > : $price=.65; > : $f_price=sprintf("%1.2f",$price); > : > : It displays "0.65" in my Mozilla browser correctly. What do you say then? > > I say, "I dunno". :-) It seems to follow C's printf(3) conversion > specification. If a decimal point is needed for a float, it must also > have a digit in front of the decimal point. This is kind of annoying if > I want to print decimal-only values without preceding zeroes. Maybe > money_format() is a better solution. yep, and even "%0.2f" yields 0.65 Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question
On Sun, Oct 12, 2003 at 06:57:35PM +1000, Wang Feng wrote: : : If I get rid of the 0 and tried this: : : $price=.65; : $f_price=sprintf("%1.2f",$price); : : It displays "0.65" in my Mozilla browser correctly. What do you say then? I say, "I dunno". :-) It seems to follow C's printf(3) conversion specification. If a decimal point is needed for a float, it must also have a digit in front of the decimal point. This is kind of annoying if I want to print decimal-only values without preceding zeroes. Maybe money_format() is a better solution. : BTW, what's the 1 used for? Specifies the minimum character width of the conversion. See PHP's sprintf() docs for more details. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question
Hi, Eugene, If I get rid of the 0 and tried this: $price=.65; $f_price=sprintf("%1.2f",$price); It displays "0.65" in my Mozilla browser correctly. What do you say then? BTW, what's the 1 used for? cheers, feng - Original Message - From: "Eugene Lee" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, October 12, 2003 6:49 PM Subject: Re: [PHP] newbie question > On Sun, Oct 12, 2003 at 06:09:21PM +1000, Wang Feng wrote: > : > : This is the example from the php manual: > [...] > : $formatted = sprintf("%01.2f", $money);// my question comes here > : // echo $formatted will output "123.10" > [...] > : > : I don't understand the meaning of the 01 above, which follows the % sign. I > : tried the "%.2f" and "%1.2f", both work fine. So, what's the meaning of > : 01(especially what the 0 is for)? Seems very much the same as C anyway :-). > > The "01" part guarantees that your money always has a preceding "0" for > decimal-only amounts. For example, ".15" should be displayed as "0.15". > > -- > 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] newbie question
On Sun, Oct 12, 2003 at 06:09:21PM +1000, Wang Feng wrote: : : This is the example from the php manual: [...] : $formatted = sprintf("%01.2f", $money);// my question comes here : // echo $formatted will output "123.10" [...] : : I don't understand the meaning of the 01 above, which follows the % sign. I : tried the "%.2f" and "%1.2f", both work fine. So, what's the meaning of : 01(especially what the 0 is for)? Seems very much the same as C anyway :-). The "01" part guarantees that your money always has a preceding "0" for decimal-only amounts. For example, ".15" should be displayed as "0.15". -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question
Greetings, This is the example from the php manual: *** Example 6. sprintf(): formatting currency *** I don't understand the meaning of the 01 above, which follows the % sign. I tried the "%.2f" and "%1.2f", both work fine. So, what's the meaning of 01(especially what the 0 is for)? Seems very much the same as C anyway :-). Please explain. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php NEWBIE Question
Ok thank you very much -Ursprungliche Nachricht- Von: Chris Kay [mailto:[EMAIL PROTECTED] Gesendet: Montag, 25. August 2003 01:37 An: 'Dennis Dujan - Partycult.de' Betreff: RE: [PHP] php NEWBIE Question Try http://au.php.net/manual/en/function.fsockopen.php If your looking for a tutorial, goto google and search for "telnet with php" -- Chris Kay (CK) Eleet Internet Services M: 0415 451 372 P: 02 4620 5076 F: 02 4620 7008 E: [EMAIL PROTECTED] -Original Message- From: Dennis Dujan - Partycult.de [mailto:[EMAIL PROTECTED] Sent: Monday, 25 August 2003 9:34 AM To: [EMAIL PROTECTED] Subject: AW: [PHP] php NEWBIE Question Iam currently writing some Scripts in PHP for a Webappliance. And now I have the problem that I have to connect with a PHP Script to a Shell that is located on another Server. But I don't know how to do this... :-/ Perhaps you can help me with an example or a Page with a Tutorial. Greetz Dennis -Ursprungliche Nachricht- Von: Curt Zirzow [mailto:[EMAIL PROTECTED] Gesendet: Montag, 25. August 2003 01:22 An: [EMAIL PROTECTED] Betreff: Re: [PHP] php NEWBIE Question * Thus wrote Dennis Dujan - Partycult.de ([EMAIL PROTECTED]): > Hi, > can you tell me how is it possible to connect to a linux shell via PHP? Ok, i suppose I should reply to this before you ask the same question with less details, again. Please be a little more specific in your question, like what you are trying to achieve. Otherwise we will be just trying to guess at what you want to do, and most likley guess wrong. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- 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
AW: [PHP] php NEWBIE Question
Iam currently writing some Scripts in PHP for a Webappliance. And now I have the problem that I have to connect with a PHP Script to a Shell that is located on another Server. But I don't know how to do this... :-/ Perhaps you can help me with an example or a Page with a Tutorial. Greetz Dennis -Ursprungliche Nachricht- Von: Curt Zirzow [mailto:[EMAIL PROTECTED] Gesendet: Montag, 25. August 2003 01:22 An: [EMAIL PROTECTED] Betreff: Re: [PHP] php NEWBIE Question * Thus wrote Dennis Dujan - Partycult.de ([EMAIL PROTECTED]): > Hi, > can you tell me how is it possible to connect to a linux shell via PHP? Ok, i suppose I should reply to this before you ask the same question with less details, again. Please be a little more specific in your question, like what you are trying to achieve. Otherwise we will be just trying to guess at what you want to do, and most likley guess wrong. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- 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] php NEWBIE Question
* Thus wrote Dennis Dujan - Partycult.de ([EMAIL PROTECTED]): > Hi, > can you tell me how is it possible to connect to a linux shell via PHP? Ok, i suppose I should reply to this before you ask the same question with less details, again. Please be a little more specific in your question, like what you are trying to achieve. Otherwise we will be just trying to guess at what you want to do, and most likley guess wrong. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php NEWBIE Question
Hi, can you tell me how is it possible to connect to a linux shell via PHP? Greetz Dennis
Re: [PHP] Newbie Question
Hi Everyone, Thanks a lot for all your advice, I really appreciate it. PHP / mysql is new to me so excuse my ignorance of the subject.. I will go get phpMyAdmin and give it a whirl. Thanks again. Phil. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question
Whether you write the gui interface or someone else does doens't make a difference. Robbert van Andel -Original Message- From: Phil King [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 11:49 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question Hi Robbert, I beleive my ISP does not allow any GUI interface into mysql databases on the server. They have advised me that ALL functions, table creation, modification, loading data etc has to be done from PHP. It appears I have to use SQL statements within a PHP page to load the data. Phil. "Van Andel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] m... > Sorry, I did mean phpMyAdmin (no such thing as phpMySQL). Brain fart. > Won't happen again. > > Robbert van Andel > > > > -Original Message- > From: Dan Van Derveer [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 9:25 AM > To: '[EMAIL PROTECTED]' > Subject: RE: [PHP] Newbie Question > > > On the same note I recommend phpMyAdmin(www.phpmyadmin.net). Its interface > is quite useful especially when you have multiple DB's to manage on the same > server. > > Dan > > -Original Message- > From: Van Andel, Robbert [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 12:24 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question > > You can download PHPMySQL and locate it in a secure portion of your site. > It's an excellent gui interface into mySQL. This tool will allow you to > upload the script file and insert the data. I'm sorry, but I don't know the > URL where to get it. Check sourceforge. > > Robbert van Andel > > > -Original Message- > From: Phil King [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 7:40 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Newbie Question > > > Hi, > > I 'm in the process of modify one of my sites to use PHP/mysql instead of > ASP/Ms Access. > > The Access database has 200 records in it. > > I have PWS, mysql and PHP running on my local PC. > > I have used Navicat from mysqlstudio.com to import the access database into > mysql and then exported the data back out as an sql script. > The script consists of multiple sql statements like : > > INSERT INTO mydatabase > (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier) > VALUES > (1, "Bunting Plastic Union Jack 4m", "Flags & Bunting", "2.5", "JFB", > "Smiths"); > > Is there a way of "including" the sql script file into a PHP page or do I > have to copy and paste the statements into a PHP page with a "mysql_query" > statement after each sql statement, to load these records to my ISP's remote > server. > > p.s My ISP has no GUI interface into mysql so all manipulation is done via > PHP. > > Thanks very much for any guidence. > > Phil. > > > > > -- > 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
Re: [PHP] Newbie Question
> Hi Robbert, > > I beleive my ISP does not allow any GUI interface into mysql databases on > the server. > They have advised me that ALL functions, table creation, modification, > loading data etc has to be done from PHP. > > It appears I have to use SQL statements within a PHP page to load the data. It's web based, uses PHP to do everything. Pretty cool setup. Bryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
Even if they do know about it, it's functionality conforms to what they said you can do: use SQL statements within a PHP page to load the data *grin*. Cheers, Rob. On Thu, 2003-08-21 at 14:53, Curt Zirzow wrote: > * Thus wrote Phil King ([EMAIL PROTECTED]): > > Hi Robbert, > > > > I beleive my ISP does not allow any GUI interface into mysql databases on > > the server. > > They have advised me that ALL functions, table creation, modification, > > loading data etc has to be done from PHP. > > > > It appears I have to use SQL statements within a PHP page to load the data. > > Just go to phpMyAdmin.com, download the source code and install it on > the server. The hosting company doesn't need to know anything about > it. > > > Curt > -- > "I used to think I was indecisive, but now I'm not so sure." > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- .-. | Worlds of Carnage - http://www.wocmud.org | :-: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul.| `-' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
* Thus wrote Phil King ([EMAIL PROTECTED]): > Hi Robbert, > > I beleive my ISP does not allow any GUI interface into mysql databases on > the server. > They have advised me that ALL functions, table creation, modification, > loading data etc has to be done from PHP. > > It appears I have to use SQL statements within a PHP page to load the data. Just go to phpMyAdmin.com, download the source code and install it on the server. The hosting company doesn't need to know anything about it. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
Hi Robbert, I beleive my ISP does not allow any GUI interface into mysql databases on the server. They have advised me that ALL functions, table creation, modification, loading data etc has to be done from PHP. It appears I have to use SQL statements within a PHP page to load the data. Phil. "Van Andel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry, I did mean phpMyAdmin (no such thing as phpMySQL). Brain fart. > Won't happen again. > > Robbert van Andel > > > > -Original Message- > From: Dan Van Derveer [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 9:25 AM > To: '[EMAIL PROTECTED]' > Subject: RE: [PHP] Newbie Question > > > On the same note I recommend phpMyAdmin(www.phpmyadmin.net). Its interface > is quite useful especially when you have multiple DB's to manage on the same > server. > > Dan > > -Original Message- > From: Van Andel, Robbert [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 12:24 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question > > You can download PHPMySQL and locate it in a secure portion of your site. > It's an excellent gui interface into mySQL. This tool will allow you to > upload the script file and insert the data. I'm sorry, but I don't know the > URL where to get it. Check sourceforge. > > Robbert van Andel > > > -Original Message- > From: Phil King [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 7:40 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Newbie Question > > > Hi, > > I 'm in the process of modify one of my sites to use PHP/mysql instead of > ASP/Ms Access. > > The Access database has 200 records in it. > > I have PWS, mysql and PHP running on my local PC. > > I have used Navicat from mysqlstudio.com to import the access database into > mysql and then exported the data back out as an sql script. > The script consists of multiple sql statements like : > > INSERT INTO mydatabase > (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier) > VALUES > (1, "Bunting Plastic Union Jack 4m", "Flags & Bunting", "2.5", "JFB", > "Smiths"); > > Is there a way of "including" the sql script file into a PHP page or do I > have to copy and paste the statements into a PHP page with a "mysql_query" > statement after each sql statement, to load these records to my ISP's remote > server. > > p.s My ISP has no GUI interface into mysql so all manipulation is done via > PHP. > > Thanks very much for any guidence. > > Phil. > > > > > -- > 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
RE: [PHP] Newbie Question
Sorry, I did mean phpMyAdmin (no such thing as phpMySQL). Brain fart. Won't happen again. Robbert van Andel -Original Message- From: Dan Van Derveer [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 9:25 AM To: '[EMAIL PROTECTED]' Subject: RE: [PHP] Newbie Question On the same note I recommend phpMyAdmin(www.phpmyadmin.net). Its interface is quite useful especially when you have multiple DB's to manage on the same server. Dan -Original Message- From: Van Andel, Robbert [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 12:24 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question You can download PHPMySQL and locate it in a secure portion of your site. It's an excellent gui interface into mySQL. This tool will allow you to upload the script file and insert the data. I'm sorry, but I don't know the URL where to get it. Check sourceforge. Robbert van Andel -Original Message- From: Phil King [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7:40 AM To: [EMAIL PROTECTED] Subject: [PHP] Newbie Question Hi, I 'm in the process of modify one of my sites to use PHP/mysql instead of ASP/Ms Access. The Access database has 200 records in it. I have PWS, mysql and PHP running on my local PC. I have used Navicat from mysqlstudio.com to import the access database into mysql and then exported the data back out as an sql script. The script consists of multiple sql statements like : INSERT INTO mydatabase (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier) VALUES (1, "Bunting Plastic Union Jack 4m", "Flags & Bunting", "2.5", "JFB", "Smiths"); Is there a way of "including" the sql script file into a PHP page or do I have to copy and paste the statements into a PHP page with a "mysql_query" statement after each sql statement, to load these records to my ISP's remote server. p.s My ISP has no GUI interface into mysql so all manipulation is done via PHP. Thanks very much for any guidence. Phil. -- 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
RE: [PHP] Newbie Question
On the same note I recommend phpMyAdmin(www.phpmyadmin.net). Its interface is quite useful especially when you have multiple DB's to manage on the same server. Dan -Original Message- From: Van Andel, Robbert [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 12:24 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question You can download PHPMySQL and locate it in a secure portion of your site. It's an excellent gui interface into mySQL. This tool will allow you to upload the script file and insert the data. I'm sorry, but I don't know the URL where to get it. Check sourceforge. Robbert van Andel -Original Message- From: Phil King [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7:40 AM To: [EMAIL PROTECTED] Subject: [PHP] Newbie Question Hi, I 'm in the process of modify one of my sites to use PHP/mysql instead of ASP/Ms Access. The Access database has 200 records in it. I have PWS, mysql and PHP running on my local PC. I have used Navicat from mysqlstudio.com to import the access database into mysql and then exported the data back out as an sql script. The script consists of multiple sql statements like : INSERT INTO mydatabase (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier) VALUES (1, "Bunting Plastic Union Jack 4m", "Flags & Bunting", "2.5", "JFB", "Smiths"); Is there a way of "including" the sql script file into a PHP page or do I have to copy and paste the statements into a PHP page with a "mysql_query" statement after each sql statement, to load these records to my ISP's remote server. p.s My ISP has no GUI interface into mysql so all manipulation is done via PHP. Thanks very much for any guidence. Phil. -- 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
RE: [PHP] Newbie Question
You can download PHPMySQL and locate it in a secure portion of your site. It's an excellent gui interface into mySQL. This tool will allow you to upload the script file and insert the data. I'm sorry, but I don't know the URL where to get it. Check sourceforge. Robbert van Andel -Original Message- From: Phil King [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7:40 AM To: [EMAIL PROTECTED] Subject: [PHP] Newbie Question Hi, I 'm in the process of modify one of my sites to use PHP/mysql instead of ASP/Ms Access. The Access database has 200 records in it. I have PWS, mysql and PHP running on my local PC. I have used Navicat from mysqlstudio.com to import the access database into mysql and then exported the data back out as an sql script. The script consists of multiple sql statements like : INSERT INTO mydatabase (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier) VALUES (1, "Bunting Plastic Union Jack 4m", "Flags & Bunting", "2.5", "JFB", "Smiths"); Is there a way of "including" the sql script file into a PHP page or do I have to copy and paste the statements into a PHP page with a "mysql_query" statement after each sql statement, to load these records to my ISP's remote server. p.s My ISP has no GUI interface into mysql so all manipulation is done via PHP. Thanks very much for any guidence. Phil. -- 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] Newbie Question
Hi, I 'm in the process of modify one of my sites to use PHP/mysql instead of ASP/Ms Access. The Access database has 200 records in it. I have PWS, mysql and PHP running on my local PC. I have used Navicat from mysqlstudio.com to import the access database into mysql and then exported the data back out as an sql script. The script consists of multiple sql statements like : INSERT INTO mydatabase (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier) VALUES (1, "Bunting Plastic Union Jack 4m", "Flags & Bunting", "2.5", "JFB", "Smiths"); Is there a way of "including" the sql script file into a PHP page or do I have to copy and paste the statements into a PHP page with a "mysql_query" statement after each sql statement, to load these records to my ISP's remote server. p.s My ISP has no GUI interface into mysql so all manipulation is done via PHP. Thanks very much for any guidence. Phil. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question regarding Syntax
Thank you Curt. Works great and your right I makes more sense to do it that way. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:45 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > Sorry guys.It think there is a bit of confusion. > > I miss typed what I need to do. > > > HREF=mailto:'.$row_rep_RS['repEmail'].'>'.$row_rep_RS['repEmail'].''; ?> You should make sure to quote your html values ( href="value" ), it will lead to trouble if you don't. I would still do it like this: Email: Curt -- "I used to think I was indecisive, but now I'm not so sure." -- 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] Newbie Question regarding Syntax
* Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > Sorry guys.It think there is a bit of confusion. > > I miss typed what I need to do. > > > HREF=mailto:'.$row_rep_RS['repEmail'].'>'.$row_rep_RS['repEmail'].''; ?> You should make sure to quote your html values ( href="value" ), it will lead to trouble if you don't. I would still do it like this: Email: Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question regarding Syntax
Sorry guys.It think there is a bit of confusion. I miss typed what I need to do. $row_rep_RS['repEmail'] is actually the email address I want to turn into a link. So I guess it would look something like. '.$row_rep_RS['repEmail'].''; ?> Whewthink I made a mess of that Is that any more clear? Thanks for the very quick responses guys! Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > HREF="mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].''; ?> > > Obviously this isn't working. What is the proper syntax when you have to use > double quotes inside the tag? I usually prefer this method, its a style choice and others might argue using it.: Email: mailto:[EMAIL PROTECTED]"> A lot easier/cleaner than to trying to concat and escape everything. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- 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] Newbie Question regarding Syntax
* Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): > HREF="mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].''; ?> > > Obviously this isn't working. What is the proper syntax when you have to use > double quotes inside the tag? I usually prefer this method, its a style choice and others might argue using it.: Email: mailto:[EMAIL PROTECTED]"> A lot easier/cleaner than to trying to concat and escape everything. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question regarding Syntax
I would encourage you to use double quotes instead of single quotes inside the PHP code. After this, you must comment HTML double quotes so the PHP engine does not consider these as part of its code. I would type your example like this: mailto:[EMAIL PROTECTED]">".$row_rep_RS['repEmail'].""; ?> Note how the only concatenated string (using periods) is the variable $row_rep_RS[] and the double quotes inside the HTML link were commented using a backslash. HTH, Cesar Aracena www.icaam.com.ar > -Mensaje original- > De: Creative Solutions New Media [mailto:[EMAIL PROTECTED] > Enviado el: Domingo, 17 de Agosto de 2003 08:08 p.m. > Para: [EMAIL PROTECTED] > Asunto: [PHP] Newbie Question regarding Syntax > > HREF="mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].''; ?> > > Obviously this isn't working. What is the proper syntax when you have to > use > double quotes inside the tag? > > Thx > > Tim Winters > Manager, Creative Development > Sampling Technologies Incorporated (STI) > [EMAIL PROTECTED] > [EMAIL PROTECTED] > W: 902 450 5500 > C: 902 430 8498 > > > > > -- > 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] Newbie Question regarding Syntax
mailto:[EMAIL PROTECTED]">'.$row_rep_RS['repEmail'].''; ?> Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? Thx Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie question
[snip] I just setup php on my linux box and have been messing with a tutorial, and have had some issues. The tutorial says any name=value pairs in the querystring "automatically creates a variable with the name and value the querystring indicated". This does not seem to be happening. I have installed: RedHat 9.0 Mysql 4.0.13 PHP 4.3.2 [/snip] It is because the tutorial is pre PHP 4.x where register_globals = off in php.ini. Your form variables will be in either $_GET['variablename'] or $_POST['variablename'], or you can turn register_globals 'on' HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question
I just setup php on my linux box and have been messing with a tutorial, and have had some issues. The tutorial says any name=value pairs in the querystring "automatically creates a variable with the name and value the querystring indicated". This does not seem to be happening. I have installed: RedHat 9.0 Mysql 4.0.13 PHP 4.3.2 I have connected to databases, displayed info from database but cannot get data from the form into the database. I have also not been able to get $PHP_SELF* to display anything. Here is a sample code I have been using: $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); // display individual record if ($id) { $result = mysql_query("SELECT * FROM employees WHERE id=$id",$db); $myrow = mysql_fetch_array($result); printf("First name: %s\n", $myrow["first"]); printf("Last name: %s\n", $myrow["last"]); printf("Address: %s\n", $myrow["address"]); printf("Position: %s\n", $myrow["position"]); } else { // show employee list $result = mysql_query("SELECT * FROM employees",$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf("%s %s\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo "Sorry, no records were found!"; } } ?> Thanks for any help. *-- Blake Schroeder [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question
you have 2 functions named DBField. This was ok until 4.3. After 4.3 you couldn't re-declare a function like this. PHP does not allow for overloading like Java and C++ (It looks like that's what you are trying to do) Check the docs for overloading. There is some support for it but it's a bit of a kludge. (IMHO, etc.) =C= * Cal Evans * Stay Plugged Into Your Audience * http://www.christianperformer.com -Original Message- From: Greg Luce [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 9:47 PM To: [EMAIL PROTECTED] Subject: [PHP] Newbie Question Can someone explain why this code works on the hosting company's server, but won't run on my local server? I'm not sure what version is on the host server, but I'm running 4.0.5 locally on winXP Pro. The error says: Fatal error: Cannot redeclare dbfield() in c:\inetpub\wwwroot\livinginnaples\database.php on line 30 7.class DBField 8.{ 9. var $name; 10. var $type; 11. var $table; 12. var $title; 13. 14. var $size; 15. var $rows; 16. var $maxlength; 17. var $value; 18. var $prefix; 19. var $postfix; 20. var $display; 21. 22. function DBField() 23. { 24. $name = ""; 25. $table = ""; 26. 27. $this->display = true; 28. } 29. 30. function DBField( $name, $table, $size, $value ) 31. { 32. if( $size == "" ) $size=20; 33. $this->display = true; $this->name = $name; $this->table = $table; $this->size = $size; $this->rows = 5; $this->value = $value; $this->title = ucwords( $name ); } function display() { if( !$this->display ) return; $prefix = str_replace( "[TITLE]", $this->title, $this->prefix ); echo $prefix; switch( $this->type ) { case "blob": ?> value ?>value != "" ) $time = strtotime( $this->value ); else $time = strtotime( "now" ); ?> ">/">/"> postfix . "\r\n"; } } -- 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] Newbie Question
Can someone explain why this code works on the hosting company's server, but won't run on my local server? I'm not sure what version is on the host server, but I'm running 4.0.5 locally on winXP Pro. The error says: Fatal error: Cannot redeclare dbfield() in c:\inetpub\wwwroot\livinginnaples\database.php on line 30 7.class DBField 8.{ 9. var $name; 10. var $type; 11. var $table; 12. var $title; 13. 14. var $size; 15. var $rows; 16. var $maxlength; 17. var $value; 18. var $prefix; 19. var $postfix; 20. var $display; 21. 22. function DBField() 23. { 24. $name = ""; 25. $table = ""; 26. 27. $this->display = true; 28. } 29. 30. function DBField( $name, $table, $size, $value ) 31. { 32. if( $size == "" ) $size=20; 33. $this->display = true; $this->name = $name; $this->table = $table; $this->size = $size; $this->rows = 5; $this->value = $value; $this->title = ucwords( $name ); } function display() { if( !$this->display ) return; $prefix = str_replace( "[TITLE]", $this->title, $this->prefix ); echo $prefix; switch( $this->type ) { case "blob": ?> value ?>value != "" ) $time = strtotime( $this->value ); else $time = strtotime( "now" ); ?> ">/">/"> postfix . "\r\n"; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question
Hi Hacook, > I have a mySQL database called "srchresult" in a "srchresult" base. > In it, i have 9 fields. Everything works perfectly. > I would like to know how can i list in a HTML table 30 results for example > but only with 7 columns (7 fields only) ? Try this: ; // loop through the results while ($r = mysql_fetch_array($q)) { // echo a table row ?> "; ?> It's untested - shout if it doesn't work. Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question
Hi all, I have a mySQL database called "srchresult" in a "srchresult" base. In it, i have 9 fields. Everything works perfectly. I would like to know how can i list in a HTML table 30 results for example but only with 7 columns (7 fields only) ? I 've tried some scripts but i can't work this out (i'm a newbie) Thanks a lot, Hacook -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Newbie question
Steps: 1. Install PHP. Already installed? 2. make a file accessible via browser and call it test.php 3. put this into it: "; phpinfo(); ?> 4. Now, access that file. If you see "Hello World" outputted followed by a long blue-gray table with lots of server data - means everything worked and you could go to the sites like PHP Beginner (www.phpbeginner.com) or many others to read some tutorials and still code to keep testing. If you get asked to download a .php file then make sure you installed your PHP with Apache right (requires some editing of httpd.conf, read the manual) Cheers, -- Maxim Maletsky [EMAIL PROTECTED] Bryan Cassidy <[EMAIL PROTECTED]> wrote... : > This might sound stupid but what the hell. I am running Red Hat 8.0 > with Apache. I have apache working fine right now. I am wanting to > learn some php but really don't know where to start/look or anything > to tell the truth. I do "everything" from my FreeBSD 4.6.2 box but > Apache runs on Red Hat. With me? Could someone give me a very "basic" > PHP script or whatever they are called, tell me where I "should" or > "need" to put it on my Red Hat 8.0 box and what else I need to do to > see the script on my webpage? Put it like this. I will make a html > file in /var/www/html/ called php and inside php i will make a file > named php.ini ( i think it should be .ini right?) and I will edit my > index.html file, add a link and point it to the php.ini file and see > what happens. I just want to get a very basic idea of php, what it > does, where to put the php file and how to get started on the web. I > really hope this e-mail doesn't get ignored so could someone just help > me out a lil bit here? I would appreciate it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Newbie question
http://www.php.net/manual/en/tutorial.php Bryan Cassidy wrote: This might sound stupid but what the hell. I am running Red Hat 8.0 with Apache. I have apache working fine right now. I am wanting to learn some php but really don't know where to start/look or anything to tell the truth. I do "everything" from my FreeBSD 4.6.2 box but Apache runs on Red Hat. With me? Could someone give me a very "basic" PHP script or whatever they are called, tell me where I "should" or "need" to put it on my Red Hat 8.0 box and what else I need to do to see the script on my webpage? Put it like this. I will make a html file in /var/www/html/ called php and inside php i will make a file named php.ini ( i think it should be .ini right?) and I will edit my index.html file, add a link and point it to the php.ini file and see what happens. I just want to get a very basic idea of php, what it does, where to put the php file and how to get started on the web. I really hope this e-mail doesn't get ignored so could someone just help me out a lil bit here? I would appreciate it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Newbie question
This might sound stupid but what the hell. I am running Red Hat 8.0 with Apache. I have apache working fine right now. I am wanting to learn some php but really don't know where to start/look or anything to tell the truth. I do "everything" from my FreeBSD 4.6.2 box but Apache runs on Red Hat. With me? Could someone give me a very "basic" PHP script or whatever they are called, tell me where I "should" or "need" to put it on my Red Hat 8.0 box and what else I need to do to see the script on my webpage? Put it like this. I will make a html file in /var/www/html/ called php and inside php i will make a file named php.ini ( i think it should be .ini right?) and I will edit my index.html file, add a link and point it to the php.ini file and see what happens. I just want to get a very basic idea of php, what it does, where to put the php file and how to get started on the web. I really hope this e-mail doesn't get ignored so could someone just help me out a lil bit here? I would appreciate it. msg86190/pgp0.pgp Description: PGP signature
[PHP] newbie question: need a script
hi all, I got a html page, on which I put a form, with quit a lot of questions (all kinds: textboxes, dropdowns, check, radiobuttons, ...). Its for an online survey Im doing. Now Im looking for a php script that puts all the data in a textfile, the moment someone clicks on Submit. It should write all data (also the values of the radiobuttons and stuff) in one line in a textfile, the fields seperated by ; eg. If there is a field left blank, there should also be a blank field in the txtfile. (reason: i want to be able to import it in some other programs). The next time someone fills in the form, id like the script to open the file again and simply add a line, with the answers of this next person. Ive been looking everywhere, but didnt find nething that was of much use; mainly there are a lot of scritps out there to mail the results to an emailadress, but I want it in a txtfile. I dont know how to write php, so perhaps someone could help me by telling me where to find it... (Cant even read php, so configuration should be very easy and clear) Thanks a lot Tharkis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question, open file error
Give it a try, that's the way I do it. jennifer villany wrote: hi, thanks for your feedback. chmod is greyed out in my ftp client. im using smart ftp. can i make these changes at the command line? thanks again, jennifer "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... You might be able to solve this yourself, connect using ftp and try "chmod o+w directory", where directory is the directory that you want to write to. [EMAIL PROTECTED] wrote: hi, i hope im sending this to the correct place. im getting this error (below) when i run a script on my server. Im assuming I need to communicate with my admin about permissions, but im not 100% sure what the permission is. I'm basically trying to create an html file. if anyone can give me some advice as to where the error lies, i would greatly appreciate it. thanks, jennifer Warning: fopen("1037202617.html","w+") - Permission denied in /home/villany2k1/www.villany2k1.com/htdocs/ecards/index.php3 on line 157 · · · jv : www.whitenoisemachine.net : 201-776-8511 : visual energy specialist - Do you Yahoo!? HotJobs - Search new jobs daily now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question, open file error
hi, i hope im sending this to the correct place. im getting this error (below) when i run a script on my server. Im assuming I need to communicate with my admin about permissions, but im not 100% sure what the permission is. I'm basically trying to create an html file. if anyone can give me some advice as to where the error lies, i would greatly appreciate it. thanks, jennifer Warning: fopen("1037202617.html","w+") - Permission denied in /home/villany2k1/www.villany2k1.com/htdocs/ecards/index.php3 on line 157 · · · jv : www.whitenoisemachine.net : 201-776-8511 : visual energy specialist - Do you Yahoo!? HotJobs - Search new jobs daily now
Re: [PHP] newbie question, open file error
You might be able to solve this yourself, connect using ftp and try "chmod o+w directory", where directory is the directory that you want to write to. [EMAIL PROTECTED] wrote: hi, i hope im sending this to the correct place. im getting this error (below) when i run a script on my server. Im assuming I need to communicate with my admin about permissions, but im not 100% sure what the permission is. I'm basically trying to create an html file. if anyone can give me some advice as to where the error lies, i would greatly appreciate it. thanks, jennifer Warning: fopen("1037202617.html","w+") - Permission denied in /home/villany2k1/www.villany2k1.com/htdocs/ecards/index.php3 on line 157 · · · jv : www.whitenoisemachine.net : 201-776-8511 : visual energy specialist - Do you Yahoo!? HotJobs - Search new jobs daily now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question, open file error
hi, i hope im sending this to the correct place. im getting this error (below) when i run a script on my server. Im assuming I need to communicate with my admin about permissions, but im not 100% sure what the permission is. I'm basically trying to create an html file. if anyone can give me some advice as to where the error lies, i would greatly appreciate it. thanks, jennifer Warning: fopen("1037202617.html","w+") - Permission denied in /home/villany2k1/www.villany2k1.com/htdocs/ecards/index.php3 on line 157 · · · jv : www.whitenoisemachine.net : 201-776-8511 : visual energy specialist - Do you Yahoo!? HotJobs - Search new jobs daily now
Re: [PHP] newbie question
This is very simple To access variables from GET form, which you would use request.querystring( ) for in ASP, use the $_GET array in PHP, e.g. $var = $_GET{'var'} To access POST form values, which you would use request.form( ) for in ASP, use the $_POST array in PHP e.g. $var = $_POST{'var'}. Cheers! Scott On 10/2/2002 1:24 PM, Remon Redika wrote: > I am newbie in php > I have var $query_string in my address page. > I want get value of query string. > For example I give string on my query string like > www.mypages.com?var=numberx > I just want get a value of var or "numberx" > I usually do this var on asp > request.querystring("var") , so I'll get the value = "numberx" > how i do it on php...? > sorry about my English. -- //// // Scott Houseman // // Jam Warehouse http://www.jamwarehouse.com/ // // Smart Business Innovation // // +27 21 4477440 / +27 82 4918021// //// -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie question
It depends on the version of PHP, in older versions you just use the variable name ie in your example just use $var to access it's contents. In new versions, with register globals turned off use $_GET['var'] to access it ie: Print $_GET['var'] Will print numberx Thanks Mark -Original Message- From: Remon Redika [mailto:[EMAIL PROTECTED]] Sent: 02 October 2002 12:24 To: [EMAIL PROTECTED] Subject: [PHP] newbie question I am newbie in php I have var $query_string in my address page. I want get value of query string. For example I give string on my query string like www.mypages.com?var=numberx I just want get a value of var or "numberx" I usually do this var on asp request.querystring("var") , so I'll get the value = "numberx" how i do it on php...? sorry about my English. -- 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] newbie question
I am newbie in php I have var $query_string in my address page. I want get value of query string. For example I give string on my query string like www.mypages.com?var=numberx I just want get a value of var or "numberx" I usually do this var on asp request.querystring("var") , so I'll get the value = "numberx" how i do it on php...? sorry about my English. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie question
Just do this: Header("Location: $where_you_wanna_go\n\n"); And make sure you do this before produce any HTML autput !! Hope this is helpful !! How do I get PHP to automatically open another PHP page in a browser if a condition is met? I have a pull down HTML table that submits a form to a PHP script. That script then uses a little logic to figure out which web page to go to. I have 5 different pages, and each has different content. Right now, I can make it bring up links, but I can't figure a way out to make it automatically go to the proper web page. I know this has to be easy, but I can't find any info one it. Thanks for your help, Brian -- 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] newbie question
include($thefile.".html"); http://www.php.net/manual/en/function.include.php header("Location: ".$thefile); http://www.php.net/manual/en/function.header.php -Kevin - Original Message - From: "Brian & Shannon Windsor" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 30, 2002 1:25 PM Subject: [PHP] newbie question > How do I get PHP to automatically open another PHP page in a browser if a > condition is met? > > I have a pull down HTML table that submits a form to a PHP script. That > script then uses a little logic to figure out which web page to go to. I > have 5 different pages, and each has different content. Right now, I can > make it bring up links, but I can't figure a way out to make it > automatically go to the proper web page. > > I know this has to be easy, but I can't find any info one it. > > Thanks for your help, > > Brian > > > > -- > 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] newbie question
On Saturday 31 August 2002 03:25, Brian & Shannon Windsor wrote: Please do not be lazy and choose a proper descriptive text for your subject. Imagine the blandness and confusion and the utter uselessness if everybody used generic subjects such as "Help", "Quick question", "This one is easy", "What am I doing wrong?". Not to mention the fact that I usually (and I bet many others do as well) delete such messages straight away. > How do I get PHP to automatically open another PHP page in a browser if a > condition is met? > > I have a pull down HTML table that submits a form to a PHP script. That > script then uses a little logic to figure out which web page to go to. I > have 5 different pages, and each has different content. Right now, I can > make it bring up links, but I can't figure a way out to make it > automatically go to the proper web page. > > I know this has to be easy, but I can't find any info one it. Without a better explanation of what you mean by "go to the proper web page" the best answer that can be given is: header("Location: http://www.doo.com/dah.php";) -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* That secret you've been guarding, isn't. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question
How do I get PHP to automatically open another PHP page in a browser if a condition is met? I have a pull down HTML table that submits a form to a PHP script. That script then uses a little logic to figure out which web page to go to. I have 5 different pages, and each has different content. Right now, I can make it bring up links, but I can't figure a way out to make it automatically go to the proper web page. I know this has to be easy, but I can't find any info one it. Thanks for your help, Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about UNIX command-line directives
As mentioned a couple of times on that include page, you can just use ini_set() directly in your application to set include_path. eg. That will run through each directory listed in your include path. That is, it will check for: ./foo.inc ../foo.inc ../../foo.inc /usr/local/lib/php/foo.inc in that order. -Rasmus On Mon, 12 Aug 2002, Al wrote: > I wasn't clear before. The problem I'm having, and most of the others > folks who commented, with include is really with "include_path". > > A good bit of the problem seems to be my virtual host's environment. > Most things I've tried with directives in an htaccess don't work and the > error log says "not allowed" etc. > > I appreciate your help. > > Rasmus Lerdorf wrote: > > What does include have to do with DirectoryIndex? And what exactly is > > your problem with include? The only trick is setting the include_path > > which doesn't seem all that obtuse to me. > > > > -Rasmus > > > > On Sun, 11 Aug 2002, Al wrote: > > > > > >>The problem may be due to the fact that my environment is Apache Unix. > >> > >>I spent about two hours today pouring over the php on-line manual > >>"include" spec and trying dozens of combinations. > >>http://www.php.net/manual/en/function.include.php > >> > >>There must be at least 20 user contributed notes at the bottom. > >> > >>It is incredible that such a basic php function should be so obtuse and > >>ill defined. > >> > >>I'm going to give your other suggestion a try tomorrow. > >> > >>Thanks again > >> > >>Analysis & Solutions wrote: > >> > >>>On Sun, Aug 11, 2002 at 12:33:55PM -0400, Al wrote: > >>> > >>> > The .htaccess approach appears to fit my situation best; but, I've not > been able to get it to work. > >>> > >>> > >>>I wondered about the DirectoryIndex directive's ability to utilize files > >>>in other directories, so did a little test, which is what you indicated > >>>you tried in your initial email: > >>> > >>> DirectoryIndex ../index.htm > >>> > >>>Worked fine. Apache 1.3.26. Windows NT. > >>> > >>>So, your problem could be a web server configuration thing, as Rasmus > >>>hinted at. > >>> > >>>Beyond the things already discussed, I'm at a loss. > >>> > >>>Good luck, > >>> > >>>--Dan > >>> > >> > >> > >>-- > >>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
Re: [PHP] Newbie question about UNIX command-line directives
I wasn't clear before. The problem I'm having, and most of the others folks who commented, with include is really with "include_path". A good bit of the problem seems to be my virtual host's environment. Most things I've tried with directives in an htaccess don't work and the error log says "not allowed" etc. I appreciate your help. Rasmus Lerdorf wrote: > What does include have to do with DirectoryIndex? And what exactly is > your problem with include? The only trick is setting the include_path > which doesn't seem all that obtuse to me. > > -Rasmus > > On Sun, 11 Aug 2002, Al wrote: > > >>The problem may be due to the fact that my environment is Apache Unix. >> >>I spent about two hours today pouring over the php on-line manual >>"include" spec and trying dozens of combinations. >>http://www.php.net/manual/en/function.include.php >> >>There must be at least 20 user contributed notes at the bottom. >> >>It is incredible that such a basic php function should be so obtuse and >>ill defined. >> >>I'm going to give your other suggestion a try tomorrow. >> >>Thanks again >> >>Analysis & Solutions wrote: >> >>>On Sun, Aug 11, 2002 at 12:33:55PM -0400, Al wrote: >>> >>> The .htaccess approach appears to fit my situation best; but, I've not been able to get it to work. >>> >>> >>>I wondered about the DirectoryIndex directive's ability to utilize files >>>in other directories, so did a little test, which is what you indicated >>>you tried in your initial email: >>> >>> DirectoryIndex ../index.htm >>> >>>Worked fine. Apache 1.3.26. Windows NT. >>> >>>So, your problem could be a web server configuration thing, as Rasmus >>>hinted at. >>> >>>Beyond the things already discussed, I'm at a loss. >>> >>>Good luck, >>> >>>--Dan >>> >> >> >>-- >>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] Newbie question about UNIX command-line directives
What does include have to do with DirectoryIndex? And what exactly is your problem with include? The only trick is setting the include_path which doesn't seem all that obtuse to me. -Rasmus On Sun, 11 Aug 2002, Al wrote: > The problem may be due to the fact that my environment is Apache Unix. > > I spent about two hours today pouring over the php on-line manual > "include" spec and trying dozens of combinations. > http://www.php.net/manual/en/function.include.php > > There must be at least 20 user contributed notes at the bottom. > > It is incredible that such a basic php function should be so obtuse and > ill defined. > > I'm going to give your other suggestion a try tomorrow. > > Thanks again > > Analysis & Solutions wrote: > > On Sun, Aug 11, 2002 at 12:33:55PM -0400, Al wrote: > > > >>The .htaccess approach appears to fit my situation best; but, I've not > >>been able to get it to work. > > > > > > I wondered about the DirectoryIndex directive's ability to utilize files > > in other directories, so did a little test, which is what you indicated > > you tried in your initial email: > > > >DirectoryIndex ../index.htm > > > > Worked fine. Apache 1.3.26. Windows NT. > > > > So, your problem could be a web server configuration thing, as Rasmus > > hinted at. > > > > Beyond the things already discussed, I'm at a loss. > > > > Good luck, > > > > --Dan > > > > > -- > 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] Newbie question about UNIX command-line directives
The problem may be due to the fact that my environment is Apache Unix. I spent about two hours today pouring over the php on-line manual "include" spec and trying dozens of combinations. http://www.php.net/manual/en/function.include.php There must be at least 20 user contributed notes at the bottom. It is incredible that such a basic php function should be so obtuse and ill defined. I'm going to give your other suggestion a try tomorrow. Thanks again Analysis & Solutions wrote: > On Sun, Aug 11, 2002 at 12:33:55PM -0400, Al wrote: > >>The .htaccess approach appears to fit my situation best; but, I've not >>been able to get it to work. > > > I wondered about the DirectoryIndex directive's ability to utilize files > in other directories, so did a little test, which is what you indicated > you tried in your initial email: > >DirectoryIndex ../index.htm > > Worked fine. Apache 1.3.26. Windows NT. > > So, your problem could be a web server configuration thing, as Rasmus > hinted at. > > Beyond the things already discussed, I'm at a loss. > > Good luck, > > --Dan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about UNIX command-line directives
On Sun, Aug 11, 2002 at 12:33:55PM -0400, Al wrote: > > The .htaccess approach appears to fit my situation best; but, I've not > been able to get it to work. I wondered about the DirectoryIndex directive's ability to utilize files in other directories, so did a little test, which is what you indicated you tried in your initial email: DirectoryIndex ../index.htm Worked fine. Apache 1.3.26. Windows NT. So, your problem could be a web server configuration thing, as Rasmus hinted at. Beyond the things already discussed, I'm at a loss. Good luck, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about UNIX command-line directives
Does your AllowOverride include "Indexes"? If it doesn't, you can't put DirectoryIndex in a .htaccess. httpd -L is your friend. -Rasmus On Sun, 11 Aug 2002, Al wrote: > Appreciate the feedback, but. > > The .htaccess approach appears to fit my situation best; but, I've not > been able to get it to work. > > I have a folder with a php script and that folder has several > sub-folders each with a small configuration script. I'd like the entry > point to be a subfolder and main script [in the parent folder] to be > "symbolically" executed. > > I'm familiar with the DirectorIndex and use it often, but only for > defining the default file for the particular folder. > > Could I be doing something wrong? Or is there another htaccess directive > that may work? > > Thanks. > > Analysis & Solutions wrote: > > On Sat, Aug 10, 2002 at 01:12:38PM -0400, Al wrote: > > > >>I'm on a virtual host without a shell account and need execute a UNIX > >>command. > >> > >>ln -s ../afile.php index.php > > > > > > In a PHP script, you can do this -- if permissions are favorable: > > > >exec('ln -s ../afile.php index.php'); > > > > > > > >>Is there some way to do this [e.g., with a htaccess file]? > > > > > > In an .htaccess file, you can put this > > > > DirectoryIndex afile.php > > > > > > > >>What happens when you execute UNIX commands like the one above? Does it > >>make a file, change the config? > > > > > > It makes a link in the file system. -s makes the link symbolic. > > http://www.tac.eu.org/cgi-bin/man-cgi?ln++NetBSD-current > > > > --Dan > > > > > -- > 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] Newbie question about UNIX command-line directives
Appreciate the feedback, but. The .htaccess approach appears to fit my situation best; but, I've not been able to get it to work. I have a folder with a php script and that folder has several sub-folders each with a small configuration script. I'd like the entry point to be a subfolder and main script [in the parent folder] to be "symbolically" executed. I'm familiar with the DirectorIndex and use it often, but only for defining the default file for the particular folder. Could I be doing something wrong? Or is there another htaccess directive that may work? Thanks. Analysis & Solutions wrote: > On Sat, Aug 10, 2002 at 01:12:38PM -0400, Al wrote: > >>I'm on a virtual host without a shell account and need execute a UNIX >>command. >> >>ln -s ../afile.php index.php > > > In a PHP script, you can do this -- if permissions are favorable: > >exec('ln -s ../afile.php index.php'); > > > >>Is there some way to do this [e.g., with a htaccess file]? > > > In an .htaccess file, you can put this > > DirectoryIndex afile.php > > > >>What happens when you execute UNIX commands like the one above? Does it >>make a file, change the config? > > > It makes a link in the file system. -s makes the link symbolic. > http://www.tac.eu.org/cgi-bin/man-cgi?ln++NetBSD-current > > --Dan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about UNIX command-line directives
On Sat, Aug 10, 2002 at 01:12:38PM -0400, Al wrote: > I'm on a virtual host without a shell account and need execute a UNIX > command. > > ln -s ../afile.php index.php In a PHP script, you can do this -- if permissions are favorable: exec('ln -s ../afile.php index.php'); > Is there some way to do this [e.g., with a htaccess file]? In an .htaccess file, you can put this DirectoryIndex afile.php > What happens when you execute UNIX commands like the one above? Does it > make a file, change the config? It makes a link in the file system. -s makes the link symbolic. http://www.tac.eu.org/cgi-bin/man-cgi?ln++NetBSD-current --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie question about UNIX command-line directives
I'm on a virtual host without a shell account and need execute a UNIX command. ln -s ../afile.php index.php Is there some way to do this [e.g., with a htaccess file]? What happens when you execute UNIX commands like the one above? Does it make a file, change the config? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about SQL result formatting
On Fri, Aug 09, 2002 at 10:55:52PM +0200, Kristoffer Strom wrote: > > How do I convert the result to HTML code, I especially want the linebreaks!! Two options. Put the output in between tags. Or if you want the regular font, in PHP use the nl2br() function. --Dan PS: For future reference... The mailing list archive is at http://groups.google.com/groups?hl=en&safe=off&group=php.general Putting in the search terms "line break" produces a plethora of results with this same answer. -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie question about SQL result formatting
Ok, this is totally newbie but I just started messing around with PHP after programming IBM's NetData for a while. My first big problem I haven't been able to solve myself is how to format the result of an SQL query into HTML code. In the (MySQL) database, I have one field for very long texts. One test entry looks like this: -- test test test -- But when printing the result, even with HTMLENTITIES and HTMLSPECIALCHARS, just looks like: - test test test - How do I convert the result to HTML code, I especially want the linebreaks!! The answer is probably very simple /Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
Exactly- I could see uses in PHP, but they're so limited that it's obvious to see why it works the way it does. Michael Kennedy -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 10:46 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question The only reason a compiled language would not include a function/module/etc is to reduce the size of the final executable. Since php doesn't store (barring the caching engines, but they work differently anyway) a compiled version, it doesn't need to worry about not including something. Martin -Original Message- From: Michael Kennedy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question Yeah, that's what I figured. With C++ you could find evidence that it only grabbed the used portions, but in PHP I didn't see anything to support that. Of course, like I said, the answer likely wouldn't have made a difference in anything I did, but it's nice to delve a little deeper sometimes. Thanks. Michael -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 8:05 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > &g
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
The only reason a compiled language would not include a function/module/etc is to reduce the size of the final executable. Since php doesn't store (barring the caching engines, but they work differently anyway) a compiled version, it doesn't need to worry about not including something. Martin -Original Message- From: Michael Kennedy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question Yeah, that's what I figured. With C++ you could find evidence that it only grabbed the used portions, but in PHP I didn't see anything to support that. Of course, like I said, the answer likely wouldn't have made a difference in anything I did, but it's nice to delve a little deeper sometimes. Thanks. Michael -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 8:05 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > > PHP is parsed and passed to the client. I assume it would be best to > > divide up the functions into multiple files (ex. dbfunctions.php, > etc.), > > but is that still the best method? Basically, I'm just curious on how > > you guys handle things like this. > > > > Thanks in advance. > > Michael Kennedy > > > &g
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
Yeah, that's what I figured. With C++ you could find evidence that it only grabbed the used portions, but in PHP I didn't see anything to support that. Of course, like I said, the answer likely wouldn't have made a difference in anything I did, but it's nice to delve a little deeper sometimes. Thanks. Michael -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 8:05 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > > PHP is parsed and passed to the client. I assume it would be best to > > divide up the functions into multiple files (ex. dbfunctions.php, > etc.), > > but is that still the best method? Basically, I'm just curious on how > > you guys handle things like this. > > > > Thanks in advance. > > Michael Kennedy > > > > > -- > 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
Re: [PHP] Newbie Question on Efficiency : Follow-up Question
On Tue, Jul 16, 2002 at 06:25:42PM -0500, Michael Kennedy wrote: > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? Nope. Everything is brought into memory at compile time. Or at least that's the way I understood it to be. I suspect it's still the case. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > > PHP is parsed and passed to the client. I assume it would be best to > > divide up the functions into multiple files (ex. dbfunctions.php, > etc.), > > but is that still the best method? Basically, I'm just curious on how > > you guys handle things like this. > > > > Thanks in advance. > > Michael Kennedy > > > > > -- > 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
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
OK, if I understand C++ correctly, if I write a program and #include or something similar and compile the program it only compiles with the used functions in it, right? So, if I never use 'cin' it leaves that function out of the final complied app. Does/can PHP do anything similar? I'm always much more comfortable with a language when I can understand how it works and I'm sure some of you feel the same. Now, I fully understand that PHP documents are not even close to being compiled in the traditional sense. But, I'm wondering if it pulls all the necessary functions into memory when the page is accessed, then uses them when needed, or does it pull the whole include()d file into memory and just combine the whole mess together into one big memory heap and run like that? My gut tells me that it's the second one, but I'm just wanting to be sure. Of course, the answer likely won't make a single difference in my life, but I'm just curious... Also, I hope the above question isn't stupid. I do have a habit of thinking about something for a while and then having it suddenly hit me later that the answer is simple very trivial. Ah, well... Thanks for humoring me. Michael -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 5:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question on Efficiency If you have have a large number of functions, it might be better to separate them into a few files that you can include as needed. I use one file that contains functions needed by every page. I have a few other files that contain functions that aren't needed by every page, so, I include them only on pages that need them. But most functions go in the main include file used on every page. Separating them will also minimize some overhead if you have a lot of functions. Otherwise, if your include files aren't War & Peace in length, one include file is fine. >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > Hello everyone, I'm a newbie and have a question on style that I've not > seen addressed anywhere. I have a large number of frequently used > functions that I'm trying to find a good way to organize. The method > I'm thinking of using is to simply create a .php file called, for > example, functions.php. Then, just include the file at the top of each > page that needs any of the functions, and just call them as needed. My > question is this- if that file gets very large with tons of different > functions, is that an inefficient method? I'm not entirely clear on how > PHP is parsed and passed to the client. I assume it would be best to > divide up the functions into multiple files (ex. dbfunctions.php, etc.), > but is that still the best method? Basically, I'm just curious on how > you guys handle things like this. > > Thanks in advance. > Michael Kennedy > -- 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] Newbie Question on Efficiency
If you have have a large number of functions, it might be better to separate them into a few files that you can include as needed. I use one file that contains functions needed by every page. I have a few other files that contain functions that aren't needed by every page, so, I include them only on pages that need them. But most functions go in the main include file used on every page. Separating them will also minimize some overhead if you have a lot of functions. Otherwise, if your include files aren't War & Peace in length, one include file is fine. [EMAIL PROTECTED] 07/16/02 04:59PM >>> > Hello everyone, I'm a newbie and have a question on style that I've not > seen addressed anywhere. I have a large number of frequently used > functions that I'm trying to find a good way to organize. The method > I'm thinking of using is to simply create a .php file called, for > example, functions.php. Then, just include the file at the top of each > page that needs any of the functions, and just call them as needed. My > question is this- if that file gets very large with tons of different > functions, is that an inefficient method? I'm not entirely clear on how > PHP is parsed and passed to the client. I assume it would be best to > divide up the functions into multiple files (ex. dbfunctions.php, etc.), > but is that still the best method? Basically, I'm just curious on how > you guys handle things like this. > > Thanks in advance. > Michael Kennedy > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question on Efficiency
Yeah, that's what I was thinking. Mostly I was curious if the procedure I mentioned was a good one or if there was something better to be doing. Thanks for the super quick reply. :) Michael -Original Message- From: Martin Clifford [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 4:01 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question on Efficiency Unless the file is getting retartedly big (10-20K), then I wouldn't separate them. Though if you have enough functions, you could justify making separate files for your database functions, output functions, backend functions, etc. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy -- 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] Newbie Question on Efficiency
Unless the file is getting retartedly big (10-20K), then I wouldn't separate them. Though if you have enough functions, you could justify making separate files for your database functions, output functions, backend functions, etc. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question on Efficiency
Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy
Re: [PHP] Newbie question
ðÒÉ×ÅÔ! Cal Evans wrote: > ++ is an incrementor. He may also consider the position of the inc/decrementor. Example (note that the first element of an array has index 0): $a = Array(1,2,3,4,5); $i = 1; executing echo $a[++$i] will output 3 2 echo $a[$i++] will output 2 2 In both cases $i gets incremented, but the value used to access the array might be before or after the increment takes place, according to the incrementor (or decrementor, if you use --) position. A subtle, but often very handy nuance. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie question
++ is an incrementor. $i=1; $i++; echo $i; =C= p.s. -- is a decrementor. * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Jay [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 13, 2002 8:32 PM To: [EMAIL PROTECTED] Subject: [PHP] Newbie question I have just started to teach myself php so I am reading through several scripts to see how the language is "spoken". I came across the following at phpworld.com $i = 1; while ($i <= 10) { print $i++ Its a little script that counts from 1 to 10, but what does $i++ mean. What does the ++ do? Why ++ and not just one + Thanks -Jay -- 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] Newbie question
I have just started to teach myself php so I am reading through several scripts to see how the language is "spoken". I came across the following at phpworld.com $i = 1; while ($i <= 10) { print $i++ Its a little script that counts from 1 to 10, but what does $i++ mean. What does the ++ do? Why ++ and not just one + Thanks -Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie: question about question marks
In that case, the question marks are part of the PHP opening and closing tags. There are several ways to open and close sections of PHP script, mainly being , , and <% %>. What the below equals is , since http://www.completesource.net (Now Open!) >>> "Alexander Ross" <[EMAIL PROTECTED]> 07/09/02 09:54AM >>> How bout the question marks in the following line of php generated html: what do they mean? "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Sun, 7 Jul 2002, Alexander Ross wrote: > > Can someone explain to me what the ? does. I have a vague idea of what > > it means in a URL (please cearify that) but I haven't the slightest what > > it means in php code. Thanks for your help > > Read about the ternary operator at: > > http://www.php.net/manual/en/language.operators.comparison.php > > miguel > -- 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] newbie: question about question marks
How bout the question marks in the following line of php generated html: what do they mean? "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Sun, 7 Jul 2002, Alexander Ross wrote: > > Can someone explain to me what the ? does. I have a vague idea of what > > it means in a URL (please cearify that) but I haven't the slightest what > > it means in php code. Thanks for your help > > Read about the ternary operator at: > > http://www.php.net/manual/en/language.operators.comparison.php > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie: question about question marks
On Sun, 7 Jul 2002, Alexander Ross wrote: > Can someone explain to me what the ? does. I have a vague idea of what > it means in a URL (please cearify that) but I haven't the slightest what > it means in php code. Thanks for your help Read about the ternary operator at: http://www.php.net/manual/en/language.operators.comparison.php miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie: question about question marks
Can someone explain to me what the ? does. I have a vague idea of what it means in a URL (please cearify that) but I haven't the slightest what it means in php code. Thanks for your help Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question - retaining values
On Thu, 13 Jun 2002, Leston Drake wrote: > I've been creating forms that use hidden inputs to retain variables and > values from one instance of the form to the next (by calling itself in the > FORM ACTION). > > Are there other ways to retain *global* variables and values between > instances of loading a page? http://php.net/session miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question - retaining values
Hi, I've been creating forms that use hidden inputs to retain variables and values from one instance of the form to the next (by calling itself in the FORM ACTION). Are there other ways to retain *global* variables and values between instances of loading a page? I apologize for the newbie question, I'm still trying to grasp the concepts of programming for the web environment. TIA, Leston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question - InstallShield PHP Installation with PWS
Here's a newbie question. I installed the Windows CGI InstallShield version of PHP to use with the MS Personal Web Server I already have working perfectly on my system. On restarting my PC and trying a very simple php script, I get the error at the bottom of this email. Unfortunately there isn't much help for the InstallShield version of PHP on the web site. I'd rather get this version working rather than install the manual version. Can anyone help? Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive. For more information as to why this behaviour exists, see the manual page for CGI security. For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php newbie question
I am having a hard time getting apache to load the php4 module. Can I still use PHP for my web stuff...? Thanks Taylor Lewick Unix System Administrator Fortis Benefits 816 881 6073 "Help Wanted. Seeking Telepath..." "You Know where to apply." Please Note The information in this E-mail message is legally privileged and confidential information intended only for the use of the individual(s) named above. If you, the reader of this message, are not the intended recipient, you are hereby notified that you should not further disseminate, distribute, or forward this E-mail message. If you have received this E-mail in error, please notify the sender. Thank you * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie question : PHP variables are not posted by this
It a BASIC question, With the following: Name : With the job_action.php I want to display the resaults to the user. But the variable name is empty. What's the problem? Thanks Frédérick St-Hilaire -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about PHP and Oracle
if ($x<>0) { $textedisplay.=", ".$resquery [$headerdisplay[$x]][$row]; } else { $textedisplay=$resquery [$headerdisplay[$x]][$row]; } } print $textevalue."\">".$textedisplay."\n"; } print ""; } "Michael Sweeney" cc: Subject: [PHP] Newbie question about PHP and Oracle 28/05/02 00:08 a VERY newbie question, just how do I get data into a listbox? In mysql it was pretty easy with mysql_fetch_row, but for oracle I am totally lost. Thanks! -- 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] Newbie question about PHP and Oracle
a VERY newbie question, just how do I get data into a listbox? In mysql it was pretty easy with mysql_fetch_row, but for oracle I am totally lost. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question to everybody....PHP
Hello r, Sunday, May 12, 2002, 4:25:37 AM, you wrote: r> Greetings people, r> Special greetings to all of you who have helped me in the past. r> As most of you know i am a newbie, I learned a bit of PHP via webmonkey and r> a few other places, seeing the power of PHP i decided to convert from Java r> servlets and JSP (JSP coz its expensive to host and not many hosting r> opportunities) so I baught a book called "The PHP black book". r> Anyway, now that the background is done heres my questions: r> 1)How many of you have seriously dug into arrays and has it been important r> in your programming? r> 1.1)Do you think you could have done the same thing you did with arrays r> WITHOUT arrays? r> (The reason i ask this is theres a whole chapter dedicated to arrays in the r> book & its pretty frustrating) Arrays in PHP are very useful and easy to use. I had no problem. And I have no book about PHP :). I use manual, because it's the best book. I looked through some books and find that the PHP manual is MUCH better. r> Last question: r> Is ther any function to make the program "sleep" for 10 seconds or so? or r> does anybody have a function that does this? It's called sleep() :) Once again, use manual. Espacially if you work on Windows. Then just download the manual in CHM.It includes index and search capabilities. -- Best regards, Olexandrmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie question to everybody....PHP
> 1)How many of you have seriously dug into arrays and has it been important > in your programming? > 1.1)Do you think you could have done the same thing you did with arrays > WITHOUT arrays? > (The reason i ask this is theres a whole chapter dedicated to arrays in > the > book & its pretty frustrating) > Last question: > Is ther any function to make the program "sleep" for 10 seconds or so? or > does anybody have a function that does this? You should be ashamed of yourself... www.php.net/sleep :) As for arrays, they are invaluable and not that hard to understand. Don't skip over them, read the chapter a couple times if you have to... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question to everybody....PHP
I have never really understood why people have problems with arrays. Just think of an array as a table of values. A one-dimensional array would be a table with a single column and each row has a number (or index) assigned to it: +---++ | 0 | Apple | +---++ | 1 | Orange | +---++ | 2 | Banana | +---++ In PHP this simple array could br created like this: $fruits[0] = 'Apple'; $fruits[1] = 'Orange'; $fruits[2] = 'Banana'; Or there is a shortcut: $fruits = array('Apple','Orange','Banana'); Now, the row numbers (or indices) do not have to start at 0. $fruits[7] = 'Apple'; $fruits[10] = 'Orange'; $fruits['foo'] = 'Banana'; Would create a table like this: +-++ | 7 | Apple | +-++ | 10 | Orange | +-++ | foo | Banana | +-++ As you can see, row names don't even have to be numbers. When using non-numerical array indices like this the array is sometimes referred to as an associative array, although in PHP we don't really differentiate. The shortcut for creating this array where you name each row would be: $fruits = array(7=>'Apple', 10=>'Orange', 'foo'=>'Banana'); and obviously, to display an element you would do: echo $fruits['foo']; To loop through and display every value in the array you can use foreach: foreach($fruits as $value) echo $value; If you also want to display the row name (also known as the index or the key): foreach($fruits as $key=>$value) echo "$key: $value"; Now, what really seems to confuse people are multi-dimensional arrays, but they are exactly the same. A multi-dimensional array can be thought of as a table with more columns and you give each column a name as well now. Just like a tic-tac-toe board: 01 +---++---+ | 0 | Apple | 1.99 | +---++---+ | 1 | Orange | 2.99 | +---++---+ | 2 | Banana | 0.89 | +---++---+ So the Apple element would be in position 0,0, Orange would be 1,0 and 0.89 would be in position 2,1. Or in PHP you would write this as: $fruits[0][0] = 'Apple'; $fruits[0][1] = 1.99; $fruits[1][0] = 'Orange'; $fruits[1][1] = 2.99; $fruits[2][0] = 'Banana'; $fruits[2][1] = 0.89; That's of course a bit wordy. If you think of this slightly differently, consider that each row is actually a small array of two items. The fruit and the price. So you could also write this as: $fruits[0] = array('Apple',1.99); $fruits[1] = array('Orange',2.99); $fruits[2] = array('Banana',0.89); And then further breaking it down, we see that $fruits is just an array of arrays, so it could actually be written as: $fruits = array(array('Apple',1.99), array('Orange',2.99), array('Banana',0.89)); and again, you don't have to use simple numbers to name your rows and columns. NamePrice +---++---+ | a | Apple | 1.99 | +---++---+ | b | Orange | 2.99 | +---++---+ | c | Banana | 0.89 | +---++---+ $fruits = array( 'a'=>array('Name'=>'Apple', 'Price'=>1.99), 'b'=>array('Name'=>'Orange','Price'=>2.99), 'c'=>array('Name'=>'Banana','Price'=>0.89) ); Looping through a multi-dimensional array is a little trickier: foreach($fruits as $k=>$arr) { echo "$k: "; foreach($arr as $kk=>$val) { echo "$kk: $val "; } echo "\n"; } If you run that code on the $fruits array you will get this output: a: Name: Apple Price: 1.99 b: Name: Orange Price: 2.99 c: Name: Banana Price: 0.89 So basically you loop through all the rows and then inside each row iteration you loop through each column. This is about as complex as you are ever likely to get. You may end up with 3-dimensional or higher arrays, but there really is no difference. The display loop will of course get more complex as you will need another level of looping. For a 3-dimensional array you would have items like $fruits[0][0][0] and your display loop would be: foreach() { foreach() { foreach() { } } } -Rasmus On Sat, 11 May 2002, r wrote: > Greetings people, > Special greetings to all of you who have helped me in the past. > > As most of you know i am a newbie, I learned a bit of PHP via webmonkey and > a few other places, seeing the power of PHP i decided to convert from Java > servlets and JSP (JSP coz its expensive to host and not many hosting > opportunities) so I baught a book called "The PHP black book". > Anyway, now that the background is done heres my questions: > > 1)How many of you have seriously dug into arrays and has it been important > in your programming? > 1.1)Do you think you could have done the same thing you did with arrays > WITHOUT arrays? > (The reason i ask this is theres a whole chapter dedicated to arrays in the > book & its pretty frustrating) > Last question: > Is ther any function to make the program "sleep" for 10 sec
RE: [PHP] Newbie question to everybody....PHP
1. I have dug deeper into arrays than I care to remember. 2. Absolutely not. 3. See http://www.php.net/sleep and http://www.php.net/usleep Glad to hear you're converting to PHP! It's an amazing language, and I don't see it going away any time in the near future. Hope you have fun, and be sure to ask if you have any more questions. I always try and answer questions on the list if I have the time, and know the answer. Matthew Walker Senior Software Engineer ePliant Marketing -Original Message- From: r [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 11, 2002 7:26 PM To: [EMAIL PROTECTED] Subject: [PHP] Newbie question to everybodyPHP Greetings people, Special greetings to all of you who have helped me in the past. As most of you know i am a newbie, I learned a bit of PHP via webmonkey and a few other places, seeing the power of PHP i decided to convert from Java servlets and JSP (JSP coz its expensive to host and not many hosting opportunities) so I baught a book called "The PHP black book". Anyway, now that the background is done heres my questions: 1)How many of you have seriously dug into arrays and has it been important in your programming? 1.1)Do you think you could have done the same thing you did with arrays WITHOUT arrays? (The reason i ask this is theres a whole chapter dedicated to arrays in the book & its pretty frustrating) Last question: Is ther any function to make the program "sleep" for 10 seconds or so? or does anybody have a function that does this? ANY replies good,bad,flames will be welcome. Cheers, -Ryan. /* You cannot get to the top by sitting on your bottom. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question to everybody....PHP
Hi! 1. I believe every serious programmer out there uses arrays on a regular basis... 1.1. ...exactly because there are so many problems virtually unsolvable without them. Take for instance the case of a product page where people would fill in ordering quantitites. My recommendation would be not to study arrays, but rather try solving problems using them - that way you'll have a better chance to remember what you've learned. But then again, that's me - maybe you learn better in other ways. If you want to sleep, you can use sleep($seconds). But why in God's name would you want to do that? Bogdan r wrote: >Greetings people, >Special greetings to all of you who have helped me in the past. > >As most of you know i am a newbie, I learned a bit of PHP via webmonkey and >a few other places, seeing the power of PHP i decided to convert from Java >servlets and JSP (JSP coz its expensive to host and not many hosting >opportunities) so I baught a book called "The PHP black book". >Anyway, now that the background is done heres my questions: > >1)How many of you have seriously dug into arrays and has it been important >in your programming? >1.1)Do you think you could have done the same thing you did with arrays >WITHOUT arrays? >(The reason i ask this is theres a whole chapter dedicated to arrays in the >book & its pretty frustrating) >Last question: >Is ther any function to make the program "sleep" for 10 seconds or so? or >does anybody have a function that does this? > >ANY replies good,bad,flames will be welcome. >Cheers, >-Ryan. > >/* You cannot get to the top by sitting on your bottom. */ > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question to everybody....PHP
Why would you want a scripting language to sleep, there is no such thing as a loop in a web page (yes, I know it would be possible, but it would lock up a users machine). I know you can set up the apache daemon to run on-demand to conserver resources, but I think you are getting mixed up between compiled and interpreted (aka scripting) languages. [EMAIL PROTECTED] --- "Life must be lived as play." - Plato (427 - 347 BC) - Original Message - From: "r" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, May 12, 2002 2:25 AM Subject: [PHP] Newbie question to everybodyPHP > Greetings people, > Special greetings to all of you who have helped me in the past. > > As most of you know i am a newbie, I learned a bit of PHP via webmonkey and > a few other places, seeing the power of PHP i decided to convert from Java > servlets and JSP (JSP coz its expensive to host and not many hosting > opportunities) so I baught a book called "The PHP black book". > Anyway, now that the background is done heres my questions: > > 1)How many of you have seriously dug into arrays and has it been important > in your programming? > 1.1)Do you think you could have done the same thing you did with arrays > WITHOUT arrays? > (The reason i ask this is theres a whole chapter dedicated to arrays in the > book & its pretty frustrating) > Last question: > Is ther any function to make the program "sleep" for 10 seconds or so? or > does anybody have a function that does this? > > ANY replies good,bad,flames will be welcome. > Cheers, > -Ryan. > > /* You cannot get to the top by sitting on your bottom. */ > > > > > > -- > 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] Newbie question to everybody....PHP
Greetings people, Special greetings to all of you who have helped me in the past. As most of you know i am a newbie, I learned a bit of PHP via webmonkey and a few other places, seeing the power of PHP i decided to convert from Java servlets and JSP (JSP coz its expensive to host and not many hosting opportunities) so I baught a book called "The PHP black book". Anyway, now that the background is done heres my questions: 1)How many of you have seriously dug into arrays and has it been important in your programming? 1.1)Do you think you could have done the same thing you did with arrays WITHOUT arrays? (The reason i ask this is theres a whole chapter dedicated to arrays in the book & its pretty frustrating) Last question: Is ther any function to make the program "sleep" for 10 seconds or so? or does anybody have a function that does this? ANY replies good,bad,flames will be welcome. Cheers, -Ryan. /* You cannot get to the top by sitting on your bottom. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question: templates with frames
At 3:02 AM -0700 15/4/02, Alexander Javier wrote: >Hello to all. Please help me in this problem of mine. I have an html >template with a frame. I'm using phplib's templating functions to >replace values in the templates. How do i also replace values both in >the main template (frleft.htm) and in the html page contained in the >frame? My code looks like the following: You can't use PHP to change the content of an existing frame. You can use Javascript, but it gets ugly real fast. So you will need to regenerate *all* the frames with each request. This requires maintaining state across the frameset and the child frames. You could do that either by embedding a GET string in the URL of the frame pages, or using cookies. I prefer the GET option as it works for all users. ...R. p.s. PHPLIB questions are best asked at [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
Hubert, It may just be the way you typed it in the email but your "products.php?tosend = 1" has spaces in it. This will truncate the tosend parameter and give it a null value. HTH Regards Chris Janet Valade wrote: >>On the browser i have a page in which i select the first button which has >>a link in the form of "products.php?tosend = 1" >>but in the second pagein where I try to trap the value of tosend to >>include a file, i don't get anything. >> > >I assume you mean that you can see the value in the URL, but when you access >$tosend, it has no value. You should be able to get it from $_GET['tosend']. >Or if you are using a version of PHP prior to 4.1.0, you can use >$HTTP_GET_VARS. The problem may be that you have register_globals turned >off. > >Janet > >>If somebody could help me >> >>TYA >> >>Hubert DAUL >>Lyon - France >> >> >> >> >> >>-- >>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] Newbie Question
> On the browser i have a page in which i select the first button which has > a link in the form of "products.php?tosend = 1" > but in the second pagein where I try to trap the value of tosend to > include a file, i don't get anything. I assume you mean that you can see the value in the URL, but when you access $tosend, it has no value. You should be able to get it from $_GET['tosend']. Or if you are using a version of PHP prior to 4.1.0, you can use $HTTP_GET_VARS. The problem may be that you have register_globals turned off. Janet > > If somebody could help me > > TYA > > Hubert DAUL > Lyon - France > > > > > > -- > 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] newbie question: templates with frames
Hello to all. Please help me in this problem of mine. I have an html template with a frame. I'm using phplib's templating functions to replace values in the templates. How do i also replace values both in the main template (frleft.htm) and in the html page contained in the frame? My code looks like the following: set_var("test", "nyahahaha"); $tpl->set_file(array(base => "frleft.htm")); $tpl->parse(DefaultPage, base); $tpl->finish(DefaultPage); $tpl->p(DefaultPage); ?> - Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax
[PHP] Newbie Question
I've got a small pb i'm looking to send parameters from a php window to another. I'll try to explain : On the browser i have a page in which i select the first button which has a link in the form of "products.php?tosend = 1" but in the second pagein where I try to trap the value of tosend to include a file, i don't get anything. If somebody could help me TYA Hubert DAUL Lyon - France -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question
$fp = fopen($filename, 'r'); while ($l = fgets($fp, 1000)) { list ($parts, $vignette, $marque, $nom, $pdfproduit, $commprod) = explode (';', $l); // now use the data print "$parts"; // or whatever } fclose ($fp); On Mon, 8 Apr 2002, Hubert DAUL wrote: > > Hi , > > Here's my problem : > > I read a data file (no sql file) which contains 8 lines, and in each line, 8 > datas > > (ex: name1;picture1;title1;anything1;everything1;nothing1) > > and when i run it I see only one picture(the second data) and not all of > them > > If someone could help me > > TYA > > Here the code : > > > > Solid > > > > > > > $row = 1; > $fp = fopen ("album.dat","r"); > while ($data = fgetcsv ($fp, 1000, ";")) > { > $num = count ($data); > > $row++; > > if (isset($vignette)) > { > print(""); > print("$vignette"); >// I think it's wrong here but I dont know why > ==> print(" \"prod.php?file=lecteur.dat\">"); > print("$marque"); > print("$nom"); > print("$pdfproduit"); > print("$commprod"); > print(""); > } > > > for ($c=0; $c<$num; $c++) > switch ($c) { > case 0 : > { > $vignette = $data[$c]; > break; > } > > case 1 : > { > $photo= $data[$c]; > break; > } > > case 2 : > { > $marque= $data[$c]; > break; > } > > case 3 : > { > $nom = $data[$c]; > break; > } > > case 4 : > { > $pdfproduit= $data[$c]; > break; > } > > case 5 : > { > $commprod = $data[$c]; > break; > } > } > } > ?> > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question
Hi , Here's my problem : I read a data file (no sql file) which contains 8 lines, and in each line, 8 datas (ex: name1;picture1;title1;anything1;everything1;nothing1) and when i run it I see only one picture(the second data) and not all of them If someone could help me TYA Here the code : Solid "); print("$vignette"); // I think it's wrong here but I dont know why ==> print(""); print("$marque"); print("$nom"); print("$pdfproduit"); print("$commprod"); print(""); } for ($c=0; $c<$num; $c++) switch ($c) { case 0 : { $vignette = $data[$c]; break; } case 1 : { $photo= $data[$c]; break; } case 2 : { $marque= $data[$c]; break; } case 3 : { $nom = $data[$c]; break; } case 4 : { $pdfproduit= $data[$c]; break; } case 5 : { $commprod = $data[$c]; break; } } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question: how to recompile PHP?
Hello all, I hope my newbie question don't bother you too much. I've downloaded the latest PHP for windows but when I try to use it I get a message that I have to re-compile it. ("You may disable this restriction by recompiling the PHP binary with the --disable-force-cgi-redirect switch.") Can anybody tell me a couple of words about how to recompile PHP? Or this error message is just an issue of php.ini? I got the sources but what kind a compiler do I need, where from I can get it? -- TIA, Bogdan mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question: how to recompile PHP?
Hello all, I hope my newbie question don't bother you too much. I've downloaded the latest PHP for windows but when I try to use it I get a message that I have to re-compile it. ("You may disable this restriction by recompiling the PHP binary with the --disable-force-cgi-redirect switch.") Can anybody tell me how to recompile PHP? I suppose I need the sources and a compiler, where from I can get them? -- Many thanks in advance, Bogdan mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question
> I'm sure it's something simple, but what's the > php function that will let me connect to the > SQL Server? mssql_*, instead of mysql_* See them all at http://www.php.net/manual/en/ref.mssql.php HTH Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question
What type of OS are you running this application on and how was php compiled? Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Greg [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 6:47 AM To: [EMAIL PROTECTED] Subject: [PHP] Newbie Question I have an app that worked with mySQL, but now I'm trying to make it use SQL Server. The function that connected to to the mySQL was: mysql_pconnect($db_host, $db_user, $db_pass) or die("Unable to connect to SQL server"); I tried to change it to "sql_pconnect($db_host, $db_user, $db_pass) or die("Unable to connect to SQL server");" but I get an error that the function doesn't exist. I'm sure it's something simple, but what's the php function that will let me connect to the SQL Server?
[PHP] Newbie Question
I have an app that worked with mySQL, but now I'm trying to make it use SQL Server. The function that connected to to the mySQL was: mysql_pconnect($db_host, $db_user, $db_pass) or die("Unable to connect to SQL server"); I tried to change it to "sql_pconnect($db_host, $db_user, $db_pass) or die("Unable to connect to SQL server");" but I get an error that the function doesn't exist. I'm sure it's something simple, but what's the php function that will let me connect to the SQL Server?