[PHP-DB]
Title: Glacier Hello everyone. This is a litle of topic but I need your help. Is there any toutorial or a good documentation for mailman? www.list.org doesn't help me much Thanx QbitΓατσής Νίκος - Gatsis NikosWeb developertel.: 2108256721 - 2108256722fax: 2108256712email: [EMAIL PROTECTED]http://www.qbit.gr
[PHP-DB] PHP mail fetching email address(es) from database question!
Hi, Fristly, thanks Jen for your information earlier. I have managed to fetch email addresses from a database to be sent out via email fine. But I have a few problems which are listed below. 1) I can't get from to work at all. :( When the emails are generated it goes out as nobody @ domain. I have tried putting $HEADERS .= email but it fails badly. Any idea why? (the emails go out fine with the message to all people in the database) 2) I have not managed to find out how to put their first name at the top of the message. e.g. to bob, ... I have thought of a few ways, have not tried it yet. But would be in the mysql function before it closes and could be legnthy.. I'd prefer to have it like a single line and further down have the message. At the pressent time I type a message in a form from the browser with the subject. Even if I had from on that form also to input is fine but I can't get it to work. :( The code is below. Quite easily achieved in the end. All help is mostly appreicated. Thanks in advance. Jerry $field"; } } mysql_close($linkID); print "MESSAGE DETAILS"; print "From: $FROM"; print "Subject: $SUBJECT"; print "Message:$MESSAGE"; } break; case "Preview": print "$MESSAGE"; print ""; print "SUBJECT: "; print "$MESSAGE"; print " "; print "Please type in html code below."; print ""; print "
Re: [PHP-DB] dynamic forms
On Tue, 1 Apr 2003 20:21:57 -0600 massimo <[EMAIL PROTECTED]> wrote: > hey everyone, > > I have this select form which get filled dynamically with all my > tables in my database. It depends on which one I choose from the drop > down menu, that clicking submit it displays the right table.. > now, I need to have a form on the page that would let me insert new > records. Of course I don't want to make a form for each table, so I > would like to change the entries and values of the insert form in > relation to the table I choose from the drop down form above > mentioned. Of course the "id" and "created" are NULL because they > should get filled automatically. > > thanks for your help. > > mas Mas, We recently did something very similar to this for a client. One approach that you could take is to parse the results from "describe table_name" (that statement is for Mysql but similar things can usually be done for other database engines) for the table selected in the List control. This really is fairly straight forward. You have isolated the table name that you are interested in... Great Execute a database query to get the field description for the table. Decide what action you wish to take for each field. For example, radio buttons for an enum field, hidden for a primary key and created by. George -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sharing variable values among PHP files
The method posted, using isset(). Leston Drake wrote: For us novices, can you please share how you would do this with register_globals off? At 01:07 AM 4/1/2003, you wrote: The method you posted is for register_gkobals on, which it won'tr always (and shouldn't be)! Ronan Chilvers wrote: Coments inline... On 01 Apr,2003 at 10:04 Mustafa Ocak wrote: You can store the value in a session variable session_start(); if (isset($_HTTP_SESSION_VARS['your_variable_name'])) { Rather than using isset() you may need to use session_is_registered(). This is specifically for checking the existence of a session variable. I would do something like // need this on all pages where you want to work with // the session var session_start(); // Check for the existence of the session var and create // it if it doesn't exist if (!session_is_registered("ses_username")) { session_register("ses_username"); } // Are we getting a form var thru ? if so pop it into the session var if (isset($frm_username)) { $ses_username = $frm_username; } // then in your scripts you can do do_my_amazing_function($ses_username); ?> As long as you have session_start() at the beginning of each script, $ses_username is now available across scripts. $value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value }else{ $_HTTP_SESSION_VARS['your_variable_name']=new value; } Hope that helps. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP mail() question?
mmm, could you use a foreach loop? I think you will need to send separate mail items for each e-mail address you have stored in the database if you want to address it to them personally. Eg in seudo code: foreach($row_returned_from_database){ # variables & headers etc here # eg, $contactemail = $row['email'] mail($contactemail, $subject, $message, $headers); } Cheers, Gav -Original Message- From: JeRRy [mailto:[EMAIL PROTECTED] Sent: Tuesday, 1 April 2003 9:05 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP mail() question? Hi, I am trying to get PHP mail() to do the following: 1) Grab email addresses from a database and put in the BCC of the email. (hidding their email address) 2) Grab first names from a database and put in the body of the email. Below is a script I am using, does not do any queries to any database because I am not sure how to do it in the function. I have tried but have failed so thought I'd ask here. Can anyone help? Here is the code I am using... \r\n"; $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Just My Server"; mail($contactemail, $subject, $message, $headers); ?> Maybe I need a different function? If so could someone show me a example of how it can be achieved please? Thanks! Jerry P.S. I am using mysql database. http://mobile.yahoo.com.au - Yahoo! Mobile - Check & compose your email via SMS on your Telstra or Vodafone mobile. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] dynamic forms
hey everyone, I have this select form which get filled dynamically with all my tables in my database. It depends on which one I choose from the drop down menu, that clicking submit it displays the right table.. now, I need to have a form on the page that would let me insert new records. Of course I don't want to make a form for each table, so I would like to change the entries and values of the insert form in relation to the table I choose from the drop down form above mentioned. Of course the "id" and "created" are NULL because they should get filled automatically. thanks for your help. mas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Entering a Query
> I would be very interested to see an example of how it would be possible > to > enter a query into a text area and the results of the query displayed on > the > next page, similar to PHP admin I guess, are they any examples out there? Issue the query with mysql_query() and check for an error. If there's an error, display mysql_error() or do your own error handling. From there, you'll count the number of fields returned by mysql_num_fields(). Loop through with mysql_field_name() to create your "header" row. The "header" text will match whatever the name of the column was. Then loop through mysql_fetch_row() to get all of the rows returned from the query. You already know how many fields there are, so just loop through the result of mysql_fetch_row() that many times and put each element in it's own tag. That's pretty much it. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Database Design Help
The easiest way to deal with this is to add a TEXT field to the end of the Booking table and have the user put in there all the extra data they need. If this doesnt resolve your problem you could add an etra table called extraData or something like that it may look like this: extraData: PK extraData_ID FK Booking_ID Description < Here you describe the data to be captured Ej. "Location" Data<-And here the actual data Ej. "Quebec" This way you can capture "N" records of extra data for the booking "Shaun" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > the data colleccted at each booking will be the fields set by an > administrator that he/she feels are appropriate to collect for that project. > > > "Gustavo Del Castillo Meza" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > What kind of data do you need to collect at each booking? > > > > "Shaun" <[EMAIL PROTECTED]> escribió en el mensaje > > news:[EMAIL PROTECTED] > > > Hi, > > > > > > I am creating a database for a web application. The idea for the > > application > > > is for a company administrator to be able to log into the site and > > allocate > > > staff to a project. > > > > > > Staff will be able to log in and update the status of the project they > are > > > working on and clients will be able to log in and book a member of staff > > > to their own projects. > > > > > > Administrators will be able to add / edit / delete - staff / clients / > > > projects. > > > > > > Here is my database diagram: > > > > > > http://www.mania.plus.com > > > > > > My problem is each different project will need to have different data > > > collected for it at each booking. How could I handle this in the > database > > > model? The administrator would like to be able to edit the data > collected > > > for each project via the site... > > > > > > Any other comments on my database model would be appreciated as this is > my > > > weakest area of web development by far! > > > > > > > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] compling php against interbase rpm
Hello, I'm having problems getting php installed when I compile it with interbase support. I installed interbase using the firebird rom: FirebirdSS-1.0.2.908-1.i386.rpm This installs firebird into /opt/interbase. I configure php with a line like: ./configure --with-interbase=/opt/interbase --with-apxs=/usr/local/apache/bin/apxs Then I happily compile away. But make test doesn't seem to happy: = FAILED TEST SUMMARY - InterBase: create test database [ext/interbase/tests/001.phpt] InterBase: connect, close and pconnect [ext/interbase/tests/002.phpt] InterBase: misc sql types (may take a while) [ext/interbase/tests/003.phpt] InterBase: BLOB test [ext/interbase/tests/004.phpt] InterBase: transactions [ext/interbase/tests/005.phpt] InterBase: binding (may take a while) [ext/interbase/tests/006.phpt] = And when I try to load the libphp4.so module, Apache silently dies. Any ideas? Thanks in advance, Patrick May
Re: [PHP-DB] Sharing variable values among PHP files
Hi Leston In case Leif, doesn't get back to you, here's a way to do it (inline). Similar to what Mustafa has already posted:- On 01 Apr,2003 at 8:35 Leston Drake wrote: > For us novices, can you please share how you would do this with > register_globals off? > > >> >> > >>// need this on all pages where you want to work with // the session var > >>session_start(); > >> > >>// Check for the existence of the session var and create > >>// it if it doesn't exist > >>if (!session_is_registered("ses_username")) { // Check if session var is set if (!isset($HTTP_SESSION_VARS["ses_username"])) { // check to see if we have a posted var from form if (isset($HTTP_POST_VARS["frm_username"])) { // We have no session var and a form var // waiting for us $HTTP_SESSION_VARS["ses_username"]=$HTTP_POST_VARS["frm_username"]; } } // Now $HTTP_SESSION_VARS["ses_username"] exists and contains // the username > >> session_register("ses_username"); > >>} > >> > >>// Are we getting a form var thru ? if so pop it into the session > >>var You can shorten $HTTP_SESSION_VARS to $_SESSION if PHP version > 4.1.0. Cheers -- Ronan e: [EMAIL PROTECTED] t: 01903 739 997 w: www.thelittledot.com The Little Dot is a partnership of Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sharing variable values among PHP files
For us novices, can you please share how you would do this with register_globals off? At 01:07 AM 4/1/2003, you wrote: The method you posted is for register_gkobals on, which it won'tr always (and shouldn't be)! Ronan Chilvers wrote: Coments inline... On 01 Apr,2003 at 10:04 Mustafa Ocak wrote: You can store the value in a session variable session_start(); if (isset($_HTTP_SESSION_VARS['your_variable_name'])) { Rather than using isset() you may need to use session_is_registered(). This is specifically for checking the existence of a session variable. I would do something like // need this on all pages where you want to work with // the session var session_start(); // Check for the existence of the session var and create // it if it doesn't exist if (!session_is_registered("ses_username")) { session_register("ses_username"); } // Are we getting a form var thru ? if so pop it into the session var if (isset($frm_username)) { $ses_username = $frm_username; } // then in your scripts you can do do_my_amazing_function($ses_username); ?> As long as you have session_start() at the beginning of each script, $ses_username is now available across scripts. $value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value }else{ $_HTTP_SESSION_VARS['your_variable_name']=new value; } Hope that helps. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Entering a Query
Hi Shaun On 01 Apr,2003 at 14:28 shaun shaun wrote: > thanks for your reply, > > What i was after is a way of representing the data, given that you dont know > what columns will be displayed and how many rows etc? > One way to do it is to load the data into arrays. I generally use mysql_fetch_array() to access recordsets. This delivers both an Indexed and associative array of values. You can modify this behaviour with the last argument. Assuming you want to preserve the keys (which will be the column headings in the sql result), in mysql_fetch_array() you would use the constant MYSQL_ASSOC. You could do something like this:- "; // Create a row of headings for ($i=0;$i"; } // Now loop through the rest of the data while (list(,$v)=each($myarray)) { $html .= ""; // Send keys array pointer back to the start reset($keys); while(list(,$b)=each($keys)) { $html.= "".$v[$b].""; } $html .= ""; } $html .= ""; echo $html; } else { // Drop out gracefully } ?> Does that all make sense ? Basically, you grab the recordset into an array whose dimensions you can loop through. Then you grab the keys from an array element to give you the columns. Then you loop through, using the keys as your guide for when to change to a new row. There may well be a more elegant way to do it but this would be where I would start !! > I would only be looking to do 'selects' so how can i ensure that this is the > only type of query run? > Make sure the user you run the script as, only has select permissions on the db you are using. Once again, hope this helps ;-) -- Ronan e: [EMAIL PROTECTED] t: 01903 739 997 w: www.thelittledot.com The Little Dot is a partnership of Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] BLOB in Oracle
Hi, Using PHP 4.2.2 with Oracle 8. Can someone provide the code for reading a BLOB from a Oracle database? I cannot find it anywhere in the archives. Thank you. Patrick Cossette [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connect Microsoft SQL database with php on unix
Thank you Adam Will Try that. Regards Greg Cirino - Original Message - From: "Adam Voigt" <[EMAIL PROTECTED]> To: "Greg Cirino" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 8:23 AM Subject: Re: [PHP-DB] Connect Microsoft SQL database with php on unix | You need to compile the FreeTDS library (freetds.org), | and on your PHP configure line, add "--with-sybase=/usr/local/freetds" | replacing the path for where you installed FreeTDS. | | And yes, it says Sybase, but no, you don't use the sybase | functions, you can still use all the mssql_whatever functions. | | On Mon, 2003-03-31 at 13:40, Greg Cirino wrote: | > >Maybe mssql_connect()?? | > > | > >www.php.net/mssql_connect | > | > | > The documentation indicates using sybase_connect (etc...) unless you | > are on a windows machine. | > | > But that doesn't work either as the sybase.so file seems to be | > non-existant (on my machine anyway) | > | > Regards | > Greg Cirino | > | > | > "John W. Holmes" <[EMAIL PROTECTED]> wrote in message | > news:[EMAIL PROTECTED] | > > I would like to know the best way to connect to SQL database(which | > located | > > on Microsoft SQL Server) from PHP(Located on Unix Server). | > | > Maybe mssql_connect()?? | > | > www.php.net/mssql_connect | > | > ---John W. Holmes... | > | > PHP Architect - A monthly magazine for PHP Professionals. Get your copy | > today. http://www.phparch.com/ | > | > | > | > | > | > -- | > PHP Database Mailing List (http://www.php.net/) | > To unsubscribe, visit: http://www.php.net/unsub.php | > | -- | Adam Voigt ([EMAIL PROTECTED]) | The Cryptocomm Group | My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc | -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Starting to hate MySql... thinking about using MS SqlServer instead...... :-(((((((((
On my ms box at home when I first started with mysql I used mysql> LOAD DATA INFILE "doc.txt" INTO TABLE tablename; instead of mysql> LOAD DATA LOCAL INFILE (etc...) delete 'local' Now I use phpmyadmin at work on my linux box... On Sun, 2003-03-30 at 18:30, Doug Thompson wrote: > There's nothing like RTFM to douse the fire in a rant. > > > 4.2.3 Startup Options for mysqld Concerning Security > The following mysqld options affect security: > > --local-infile[=(0|1)] > If one uses --local-infile=0 then one can't use LOAD DATA LOCAL INFILE. > > > This setting has been defaulted to 0 in recent releases. You can read more than you > probably want to here: > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > > PHHPmyadmin is a good gui, but I prefer sqlyog which you'll find at > http://www.webyog.com/ > > hth, > Doug > > > On Sun, 30 Mar 2003 13:46:23 -0700, Sparky Kopetzky wrote: > > >ARGGHHH!!! > > > >Trying to use INFILE to load a small (125) entry block of data and all MqSql does > >is puke: > > > >ERROR 1148: The used command is not allowed with this MySql version. (3.23.55) > > > >If this command is no good, then what the hell am I supposed to use > > > >At least with MS, you have a nice, GUI to use... > > > >Robin Kopetzky > >Black Mesa Computers/ISP > > -- Mignon Hunter Web Developer Toshiba International 713.466.0277 x 3461 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Entering a Query
thanks for your reply, What i was after is a way of representing the data, given that you dont know what columns will be displayed and how many rows etc? I would only be looking to do 'selects' so how can i ensure that this is the only type of query run? Thanks for your help "Ronan Chilvers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Shaun > > Comments inline ... > > On 01 Apr,2003 at 13:37 shaun shaun wrote: > > > > Hi, > > > > I would be very interested to see an example of how it would be possible to > > enter a query into a text area and the results of the query displayed on the > > next page, similar to PHP admin I guess, are they any examples out there? > > > > > Fairly simple At its most basic you have a form :- > > > > > > > which posts to your php page :- > > > $sql = $HTTP_POST_VARS["myquery"]; > > // You'll need code here to sanitize the query and make sure there's > // no nasty surprises in it. > > // then simply create your connection (assuming a function here) > $conn = db_connect(); > > $result = mysql_query($sql); > > // Code to display the result here > > ?> > > You would need to have some checking involved for the query. Also, as always, apply 'least privilege' to the user the query runs as. I don't know what you're using it for but be VERY careful - I would only allow selects here unless you're sure you know how it will be used. > > Hope this helps ... :-) > > -- > Ronan > e: [EMAIL PROTECTED] > t: 01903 739 997 > w: www.thelittledot.com > > The Little Dot is a partnership of > Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connect Microsoft SQL database with php on unix
You need to compile the FreeTDS library (freetds.org), and on your PHP configure line, add "--with-sybase=/usr/local/freetds" replacing the path for where you installed FreeTDS. And yes, it says Sybase, but no, you don't use the sybase functions, you can still use all the mssql_whatever functions. On Mon, 2003-03-31 at 13:40, Greg Cirino wrote: > >Maybe mssql_connect()?? > > > >www.php.net/mssql_connect > > > The documentation indicates using sybase_connect (etc...) unless you > are on a windows machine. > > But that doesn't work either as the sybase.so file seems to be > non-existant (on my machine anyway) > > Regards > Greg Cirino > > > "John W. Holmes" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I would like to know the best way to connect to SQL database(which > located > > on Microsoft SQL Server) from PHP(Located on Unix Server). > > Maybe mssql_connect()?? > > www.php.net/mssql_connect > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Entering a Query
Hi Shaun Comments inline ... On 01 Apr,2003 at 13:37 shaun shaun wrote: > Hi, > > I would be very interested to see an example of how it would be possible to > enter a query into a text area and the results of the query displayed on the > next page, similar to PHP admin I guess, are they any examples out there? > Fairly simple At its most basic you have a form :- which posts to your php page :- You would need to have some checking involved for the query. Also, as always, apply 'least privilege' to the user the query runs as. I don't know what you're using it for but be VERY careful - I would only allow selects here unless you're sure you know how it will be used. Hope this helps ... :-) -- Ronan e: [EMAIL PROTECTED] t: 01903 739 997 w: www.thelittledot.com The Little Dot is a partnership of Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Entering a Query
Hi, I would be very interested to see an example of how it would be possible to enter a query into a text area and the results of the query displayed on the next page, similar to PHP admin I guess, are they any examples out there? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Database Design Help
the data colleccted at each booking will be the fields set by an administrator that he/she feels are appropriate to collect for that project. "Gustavo Del Castillo Meza" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What kind of data do you need to collect at each booking? > > "Shaun" <[EMAIL PROTECTED]> escribió en el mensaje > news:[EMAIL PROTECTED] > > Hi, > > > > I am creating a database for a web application. The idea for the > application > > is for a company administrator to be able to log into the site and > allocate > > staff to a project. > > > > Staff will be able to log in and update the status of the project they are > > working on and clients will be able to log in and book a member of staff > > to their own projects. > > > > Administrators will be able to add / edit / delete - staff / clients / > > projects. > > > > Here is my database diagram: > > > > http://www.mania.plus.com > > > > My problem is each different project will need to have different data > > collected for it at each booking. How could I handle this in the database > > model? The administrator would like to be able to edit the data collected > > for each project via the site... > > > > Any other comments on my database model would be appreciated as this is my > > weakest area of web development by far! > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] LDAP using login form
Could someone point me to an example script using ldap authentication but where logins are entered through a form rather than an http pop-up challenge. I can only find exmaples of the latter, and I'm not sure how to keep the user logged in with the former. thanks, J __ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sharing variable values among PHP files
Hi Leif On 01 Apr,2003 at 3:07 Leif K-Brooks wrote: > Please, please, PLEASE don't give advice! If you don't know the answer, > DON'T COMMENT! The method you posted is for register_gkobals on, which > it won'tr always (and shouldn't be)! > No need to be rude ... its very easy to adjust this code so that it doesn't need register_globals. The logic of the code is the point. I simply offered an alternative way of handling session vars that I feel is cleaner and clearer. Please don't go off the deep end with replies. There's no need. If you felt that you should point out the register_globals issue, then a simple 'Don't forget register_globals needs to be turned on here and it probably isn't' would suffice. While I am not a php guru (as you seem to be) I have been working with it for a long time commercially and do have some experience, so I am occasionally able to offer pointers on people's questions and offer such advice freely, in the hope that it will help. Lets all be adults, shall we ? You don't get any points for flaming. We're here to learn not fight. > Ronan Chilvers wrote: > > >Coments inline... > > > > > >On 01 Apr,2003 at 10:04 Mustafa Ocak wrote: > > > > > > > >>You can store the value in a session variable > >> > -- Ronan e: [EMAIL PROTECTED] t: 01903 739 997 w: www.thelittledot.com The Little Dot is a partnership of Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sharing variable values among PHP files
Please, please, PLEASE don't give advice! If you don't know the answer, DON'T COMMENT! The method you posted is for register_gkobals on, which it won'tr always (and shouldn't be)! Ronan Chilvers wrote: Coments inline... On 01 Apr,2003 at 10:04 Mustafa Ocak wrote: You can store the value in a session variable session_start(); if (isset($_HTTP_SESSION_VARS['your_variable_name'])) { Rather than using isset() you may need to use session_is_registered(). This is specifically for checking the existence of a session variable. I would do something like // need this on all pages where you want to work with // the session var session_start(); // Check for the existence of the session var and create // it if it doesn't exist if (!session_is_registered("ses_username")) { session_register("ses_username"); } // Are we getting a form var thru ? if so pop it into the session var if (isset($frm_username)) { $ses_username = $frm_username; } // then in your scripts you can do do_my_amazing_function($ses_username); ?> As long as you have session_start() at the beginning of each script, $ses_username is now available across scripts. $value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value }else{ $_HTTP_SESSION_VARS['your_variable_name']=new value; } Hope that helps. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP-DB] Sharing variable values among PHP files
Coments inline... On 01 Apr,2003 at 10:04 Mustafa Ocak wrote: > You can store the value in a session variable > > session_start(); > if (isset($_HTTP_SESSION_VARS['your_variable_name'])) { Rather than using isset() you may need to use session_is_registered(). This is specifically for checking the existence of a session variable. I would do something like As long as you have session_start() at the beginning of each script, $ses_username is now available across scripts. > $value=$_HTTP_SESSION_VARS['your_variable_name']; //get the value > }else{ > $_HTTP_SESSION_VARS['your_variable_name']=new value; > } > Hope that helps. -- Ronan e: [EMAIL PROTECTED] t: 01903 739 997 w: www.thelittledot.com The Little Dot is a partnership of Ronan Chilvers and Giles Webberley -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php