Re: [PHP-DB] Variables & Forms
Hi Ron "" is perfectly legitimate in an e-mail header field like "Subject:". All headers may contain any combination of ASCII characters except CR and LF which are used to terminate the field (See RFC8222 section 2.2). There is also defined a means to "fold" lines which involves using the CR+LF+white-space combination to indicate multiple line entries. Is it possible your e-mail header fields are doing this and your access to the headers does not take this possibility into account? Without your POP handling code it's impossible to say whether this is your problem or not. -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Variables & Forms
Ron, The email subject line should not have a tag in it at all. It is not allowed under the specifications if I remember correctly. I would suggest that when you suck the message in, first thing to do is to remove the tag with str_replace... Would this get you on your way? Bastien> From: [EMAIL PROTECTED]> To: php-db@lists.php.net> Date: Tue, 16 Oct 2007 09:47:13 -0500> Subject: [PHP-DB] Variables & Forms> > I am programming a form this morning. I don't understand arrays really well. I think this is what I am needing to use, but I am really not sure.> > I have a PHP script that checks a POP e-mail address and is suppose to take the incoming message and save it to a mySQL table based on the subject line. Every now and then the subject line is broken with something like a and so I have a handful of messages that need to be indexed manually. IE my script can't see a "Subject: Correspondence for message 123" --- it is being received as "Subject: Correspondence for message 123" I am trying to update the mySQL table with a form instead of continuing to use phpmyadmin to do these updates. > > What I am wanting to do in my form is call up all the incoming messages that have a message value of 0 and I can read through the incoming message to see what their reference number is and type it in the field that I have called "new_correspondence_received". An example of my HTML code is below.> > Where I am getting stuck is if I have more than 1 message that wasn't indexed automatically I am not sure how to retrieve the values of: correspondence_reference and new_correspondence_reference. (The only reason I am displaying correspondence_received is to look for the reference number) Can what I am trying to do be accomplished through an array to find out the values submitted? What changes need to be made to my form so I can find out the values being submitted?> > Each message received that isn't automatically index is dispayed through this form, one per message, thanks for your help. Ron> > > > > 172> > > > > > > > Message here> > > _ Have fun while connecting on Messenger! Click here to learn more. http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
RE: [PHP-DB] Variables in database content
Hi you need eval() http://uk2.php.net/manual/en/function.eval.php HTH Peter > -Original Message- > From: Brian Stoffer [mailto:[EMAIL PROTECTED] > Sent: 23 May 2004 23:34 > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Variables in database content > > > Hi there. I have what I suspect is an easy one, but was unable to find > something similar in the archives (it's a tough one to search for...). > > Basically I have a table with a text block column. The actual content > that lives in column contains php variables that I want to be able to > use when I pull the text out of the database. Let me give you an > example: > > Content: > "Hi there. My name is $name. This is a bunch of text that $othername > is telling me to populate with some data. Hopefully you will be able > to help $othername and I get this to work. Thanks!" > > Now, in my script I want to be able to pull names out of another table, > initialize the $name and $othername variables, then pull out the > content above, parse the "names" variables and display it in the > browser. > > My problem is the variables don't get parsed. I've tried a few obvious > things, like storing the text in a variable, using print or echo, and > so-on, even processing it with the various text-to-html functions > hoping that it would process the variables, but it seems like it's > treating the text as a literal and not actually parsing the variables. > > I suspect it has something to do with either the order, the method of > output, or some pre-processing that I'm missing, but after a few hours > I simply can't get it. > > Thanks for any advice! > > -b > > -- > 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
Re: [PHP-DB] Variables not working within Functions
Or pass the variable $username as an argument into your function: function LoginSystem($username) { // your function code } LoginSystem($username); ck -- Cheap Domain Registration | Web Hosting | Email Packages | + more Fantastic prices -- Even better service. http://www.hosttohost.net Chris Wanstrath [EMAIL PROTECTED] on 10/15/03 7:57 PM wrote: > You are using a variable outside of the function's scope. > In the function, do this: > global $username; > > Visit www.php.net/man to get a better understanding of globals and > scope. > > On Wed, 2003-10-15 at 22:10, Adam Symonds wrote: >> Hi, >> I am starting to us functions with my work but I am having troubles >> With the variables in the functions.. >> >> If I have the following function called from my page it will work but the >> variable wont >> ($username) >> but if I put this code straight on the page then it works fine.. >> >> Any reason for the variable not to work in the function but in straight >> coding? >> Thanx >> >> >> >> Sample Function Below: >> >> == >> function LoginSystem() >> { >> echo ""; >> if ( !isset( $_SESSION['login'] ) ) { >> >> echo ""; >> echo "Username: > size=10> Password: > size=10> "; >> echo "Not A Member >> Yet? "; >> echo ""; >> >> } else { >> echo "Welcome $username > href=../Users/Logout.php>> size=1>Logout "; >> } >> echo ""; >> } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Variables not working within Functions
You are using a variable outside of the function's scope. In the function, do this: global $username; Visit www.php.net/man to get a better understanding of globals and scope. On Wed, 2003-10-15 at 22:10, Adam Symonds wrote: > Hi, > I am starting to us functions with my work but I am having troubles > With the variables in the functions.. > > If I have the following function called from my page it will work but the > variable wont > ($username) > but if I put this code straight on the page then it works fine.. > > Any reason for the variable not to work in the function but in straight > coding? > Thanx > > > > Sample Function Below: > > == > function LoginSystem() > { > echo ""; > if ( !isset( $_SESSION['login'] ) ) { > > echo ""; > echo "Username: size=10> Password: size=10> "; > echo "Not A Member > Yet? "; > echo ""; > > } else { > echo "Welcome $username href=../Users/Logout.php> size=1>Logout "; > } > echo ""; > } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Variables de SESSION dentro de funciones PHP
Thanks, I'll try it now. -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 1:49 PM To: Francisco José Saiz :: netPerceptions Subject: Re: [PHP-DB] Variables de SESSION dentro de funciones PHP You're mixing register_globals off session code with register_globals on session code. $HTTP_SESSION_VARS['myvar'] doesn't get defined until the second page view after setting it. Try: session_start(); function OneFunction() { $GLOBALS['HTTP_SESSION_VARS']['myvar'] = 'ABC'; } onefunction(); echo($HTTP_SESSION_VARS["myvar"]); Francisco José Saiz :: netPerceptions wrote: >Hi, > >I have made a PHP function that reads a tablename from a file. I want >to keep the tablename value into a session var. I register the session >vars and assign the value. But when I try to access outside the >function the variable is empty. > >I do this: > >session_start(); > >function OneFunction >{ > $myvar="ABC"; > session_register("myvar"); >} > >echo($HTTP_SESSION_VARS["myvar"]); > > >And do not prints nothing. > >Why? Is a scope fault? > >Thanks. > >-----Original Message- >From: Snijders, Mark [mailto:[EMAIL PROTECTED]] >Sent: Friday, December 13, 2002 1:08 PM >To: '_netPerceptions?='; [EMAIL PROTECTED] >Subject: RE: [PHP-DB] Variables de SESSION dentro de funciones PHP > > >english please!!! > > > >___ > >Mark Snijders, Developer >Atos Origin >Groenewoudeseweg 1, Room VN-515 >5621 BA Eindhoven, The Netherlands >* : [EMAIL PROTECTED] >*:+31 (0)40 - 2785992 (tel) >* : +31 (0)40 - 2788729 (fax) > >The information in this mail is intended only for use of the individual >or entity to which it is addressed and may contain information that is >privileged, confidential and exempt from disclosure under applicable >law. Access to this mail by anyone else than the addressee is >unauthorized. If you are not the intended recipient, any disclosure, >copying, distribution or any action taken omitted to be taken in >reliance of it, is prohibited and may be unlawful. > > > >-Original Message- >From: _netPerceptions?= [mailto:[EMAIL PROTECTED]] >Sent: vrijdag 13 december 2002 12:33 >To: [EMAIL PROTECTED] >Subject: [PHP-DB] Variables de SESSION dentro de funciones PHP > > >Hola, > >tengo una función en PHP que me lee de un fichero una configuración de >unas tablas de BBDD, quiero que el nombre de las tablas así como los >datos de conexión, me queden residentes en unas variables de sesión. >Cuando registro las variables dentro de la función, al acceder desde >cualquier otro punto con $HTTP_SESSION_VARS["nombrevariable"] me pone >como que está vacía. > >¿alguien podría aclararme el tratamiento de estas variables en PHP? > >Saludos y muchas gracias. > > > > > -- 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] Variables de SESSION dentro de funciones PHP
Hi, I have made a PHP function that reads a tablename from a file. I want to keep the tablename value into a session var. I register the session vars and assign the value. But when I try to access outside the function the variable is empty. I do this: session_start(); function OneFunction { $myvar="ABC"; session_register("myvar"); } echo($HTTP_SESSION_VARS["myvar"]); And do not prints nothing. Why? Is a scope fault? Thanks. -Original Message- From: Snijders, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 1:08 PM To: '_netPerceptions?='; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Variables de SESSION dentro de funciones PHP english please!!! ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: _netPerceptions?= [mailto:[EMAIL PROTECTED]] Sent: vrijdag 13 december 2002 12:33 To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables de SESSION dentro de funciones PHP Hola, tengo una función en PHP que me lee de un fichero una configuración de unas tablas de BBDD, quiero que el nombre de las tablas así como los datos de conexión, me queden residentes en unas variables de sesión. Cuando registro las variables dentro de la función, al acceder desde cualquier otro punto con $HTTP_SESSION_VARS["nombrevariable"] me pone como que está vacía. ¿alguien podría aclararme el tratamiento de estas variables en PHP? Saludos y muchas gracias. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Variables de SESSION dentro de funciones PHP
through the magic of babelfish! I have a function in PHP that reads of a file a configuration to me of BBDD tables, I want that the name of the tables as well as the data of connection, I have left residents in session variables. When registry the variables within the function, when acceding from any other point with $$HTTP_SESSION_VARS["nombrevariable "] puts to me because she is empty. somebody could clarify the treatment to me of these variables in PHP? Greetings and thank you very much. (just in case he can't speak English!) -Original Message- From: Ruprecht Helms [mailto:[EMAIL PROTECTED]] Sent: 13 December 2002 12:32 To: Francisco José Saiz :@mayn.de: netPerceptions Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Variables de SESSION dentro de funciones PHP Hi Francisco José Saiz netPerceptions, would you be so kind and repeat your mail in english. Regards, Ruprecht -- Ruprecht Helms IT-Service und Softwareentwicklung Tel/Fax.: +49[0]7621 16 99 16 Homepage: http://www.rheyn.de email: [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This message has been checked for all known viruses by the MessageLabs Virus Control Centre. This message has been checked for all known viruses by the MessageLabs Virus Control Centre. * Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY * -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Variables de SESSION dentro de funciones PHP
Hi Francisco José Saiz netPerceptions, would you be so kind and repeat your mail in english. Regards, Ruprecht -- Ruprecht Helms IT-Service und Softwareentwicklung Tel/Fax.: +49[0]7621 16 99 16 Homepage: http://www.rheyn.de email: [EMAIL PROTECTED] -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Variables de SESSION dentro de funciones PHP
english please!!! ___ Mark Snijders, Developer Atos Origin Groenewoudeseweg 1, Room VN-515 5621 BA Eindhoven, The Netherlands * : [EMAIL PROTECTED] *:+31 (0)40 - 2785992 (tel) * : +31 (0)40 - 2788729 (fax) The information in this mail is intended only for use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Access to this mail by anyone else than the addressee is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken omitted to be taken in reliance of it, is prohibited and may be unlawful. -Original Message- From: _netPerceptions?= [mailto:[EMAIL PROTECTED]] Sent: vrijdag 13 december 2002 12:33 To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables de SESSION dentro de funciones PHP Hola, tengo una función en PHP que me lee de un fichero una configuración de unas tablas de BBDD, quiero que el nombre de las tablas así como los datos de conexión, me queden residentes en unas variables de sesión. Cuando registro las variables dentro de la función, al acceder desde cualquier otro punto con $HTTP_SESSION_VARS["nombrevariable"] me pone como que está vacía. ¿alguien podría aclararme el tratamiento de estas variables en PHP? Saludos y muchas gracias. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Variables
It would seem that your IF statement, as it is written below, evaluates to true every time because I'm guessing that the hexadecimal value of the string timeb is larger than the hexadecimal value of timea. Like I said, just a guess. I'm also guessing that you actually want to compare two values from your database when you do your if ($tim1 < $tim2). Assuming that timea and timeb are columns in your database and are included in the $result of your query, can you just do: if($myrow["timea"] < $myrow["timeb"]){ do stuff; } HTH > -Original Message- > From: Steve Dodkins [mailto:Steve.Dodkins@;ebm-ziehl.co.uk] > Sent: Friday, November 08, 2002 9:26 AM > To: Php-Db (E-mail) > Subject: [PHP-DB] Variables > > > Hi > > The following will print the variables ($tim1 and $tim2) > correctly but the > IF statement using the same vars will not work, it will only > work as below > which seems to work by comparing the text values of the 2 > variables $tim1 > $tim2. > > while($myrow = mysql_fetch_array($result)) > > { > $tim1="timea"; > $tim2="timeb"; > if ($tim1 < $tim2) > { > echo > "".$myrow[$tim1]."".$myrow[$tim2]."".$ > myrow["labor_o > rd_no"]."".$myrow["labor_wkyr"]."".$myrow["wor > ks_orders_cust > omer_id"]."".$myrow["works_orders_part_no"]."" > .$myrow["works > _orders_qty"]."".$myrow["labor_qty"]."".$myrow > ["labor_time"] > ."".$myrow["timea"]; > > Regards > > Steve Dodkins > > IMPORTANT NOTICE The information in this e-mail is > confidential and should > only be read by those persons to whom it is addressed and is > not intended to > be relied upon by any person without subsequent written > confirmation of its > contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the > accuracy or completeness of this message as it has been > transmitted over a > public network. Furthermore, the content of this e-mail is > the personal > view of the sender and does not represent the advice, views > or opinion of > our company. Accordingly, our company disclaim all > responsibility and accept > no liability (including in negligence) for the consequences > of any person > acting, or refraining from acting, on such information prior > to the receipt > by those persons of subsequent written confirmation. In > particular (but not > by way of limitation) our company disclaims all > responsibility and accepts > no liability for any e-mails which are defamatory, offensive, > racist or in > any other way are in breach of any third party's rights, > including breach of > confidence, privacy or other rights. If you have received this e-mail > message in error, please notify me immediately by telephone. > Please also > destroy and delete the message from your computer. Any form > of reproduction, > dissemination, copying, disclosure, modification, distribution and/or > publication of this e-mail message is strictly prohibited. > If you have > received this E-mail in error, or suspect that the message > may have been > intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 > 468555. > ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ > > > > > -- > 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
RE: [PHP-DB] Variables coming from forms
could be a register globals issue? Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net tel. 0121-242-1473 --- -Original Message- From: Achilles Maroulis [mailto:[EMAIL PROTECTED]] Sent: 22 September 2002 07:04 To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables coming from forms Hi. I have posted this thread before but didn't come to a solution so I try again. I've installed Apache 2.0 and PHP 4.2.3 (both with the msi installers) on Windows 2000 Pro. The problem I have is that I get the message Notice: Undefined variable: var_name in every time I pass a new variable into another page whether this happens using the URL or a form or even sessions. The strange thing is that if I run phpinfo() in the same page (where the variable is considered to be undefined) I see that my variables do exist in the variables section of phpinfo. For example. If I use a form to pass a variable in a php file like this: and have the var.php like this: I'll get the message: Notice: Undefined variable: var in C:\Progr.\htdocs\var.php on line 2 while I'll also get a line like this in the variables section of phpinfo(): Variable Value _GET["var"] the value I typed before I think this is really strange. Has anyone something to suggest? Thanx in advance!! Achilles -- 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
RE: [PHP-DB] variables gone?
Beginning in PHP 4.2.0, the normal behavior with respect to preloaded variables was changed (specifically, the default value of the register_globals configuration entry was changed from "on" to "off"). For details, see http://www.php.net/manual/en/language.variables.predefined.php --- Mark Roedel | "Blessed is he who has learned to laugh Systems Programmer| at himself, for he shall never cease LeTourneau University | to be entertained." Longview, Texas, USA | -- John Powell > -Original Message- > From: Rob Fraser [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 29, 2002 8:49 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] variables gone? > > > I am probably doing something silly but I don't know what (story of > my life). I have just upgraded to 4.2.1 and now all the variables I > post in forms or in query strings are now coming up undefined errors > and are in absent. I'm running PHP under IIS 4. > > What am I doing wrong? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variables gone?
In php.ini you need to turn register_globals on..you also might want to start using the $_GET, $_POST, $_SESSION global arrays ed At 02:49 PM 5/29/2002 +0100, Rob Fraser wrote: >Dear All, >I am probably doing something silly but I don't know what (story of my >life). I have just upgraded to 4.2.1 and now all the variables I post in >forms or in query strings are now coming up undefined errors and are in >absent. I'm running PHP under IIS 4. >What am I doing wrong? > >-- >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
RE: [PHP-DB] Variables
In an attempt to be less vague I think you want to change your line: $c . $count+1 = $artist[$count]; to be: $varName = $c.($count+1); $$varName = $artist[$count]; Got it now? --- I think what you don't know is this: $varName = "c1"; $$varName = 3; that just set $c1 to equal 3. Does that help? -Original Message- From: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 9:56 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables HI-- * I have the following variables: $c1 thru $c10. * I also have a FOR loop like this: for($count = 0; $count < sizeof($artist); $count++) { echo "$artist[$count]"; } // $artist is a list of ten (10) artist's names. * What I'm trying to do is something like this: Combine the variables with the info inside the FOR loop: for($count = 0; $count < sizeof($artist); $count++) { //Trying to assign the value of $c1, $c2, $c3, etc. using the value of the variable $count. //But so far, it only processes the value of $count alone, and it ignores $c //The line below should read like this: $c1 = $artist[0], next line: $c2 = $artist[1], etc. $c . $count+1 = $artist[$count]; } Help!!! Julio Cuz, Jr. Riverside Community College [EMAIL PROTECTED] -- 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
RE: [PHP-DB] Variables
I think what you don't know is this: $varName = "c1"; $$varName = 3; that just set $c1 to equal 3. Does that help? -Original Message- From: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 9:56 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables HI-- * I have the following variables: $c1 thru $c10. * I also have a FOR loop like this: for($count = 0; $count < sizeof($artist); $count++) { echo "$artist[$count]"; } // $artist is a list of ten (10) artist's names. * What I'm trying to do is something like this: Combine the variables with the info inside the FOR loop: for($count = 0; $count < sizeof($artist); $count++) { //Trying to assign the value of $c1, $c2, $c3, etc. using the value of the variable $count. //But so far, it only processes the value of $count alone, and it ignores $c //The line below should read like this: $c1 = $artist[0], next line: $c2 = $artist[1], etc. $c . $count+1 = $artist[$count]; } Help!!! Julio Cuz, Jr. Riverside Community College [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Variables in a loop
If you have a string that is the name of an input field, you can do one of 3 things: Ex: $sName = "input".$i; //result = "input1" $sName = "input".$i; //result = "input2" etc... 1: Variable Variables $value = $$sName; 2: If you posted the form $value = $HTTP_POST_VARS[$sName]; 3: If you used GET with the form $value = $HTTP_GET_VARS[$sName]; Regards, -Jason Garber IonZoft.com At 09:10 AM 10/30/2001 +0100, * R&zE: wrote: > >From: LeTortorec, Jean-Louis <[EMAIL PROTECTED]> >Date: Mon, Oct 29, 2001 at 04:03:45PM -0500 >Message-ID: <615315231286D21182E40008C7B1EED23C6E76@COMPAQ3000> >Subject: [PHP-DB] Variables in a loop > > > I'm trying to write a loop to read variables I receive from a form: > > > > > > > > > > > > > > > > > > I'd like to get something like: > > > > for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;} > > > > > > The expression "a".$i is actually a string, not a variable. Any idea > how to > > "read" the value of that string? > > > > Thanks for your help. > > > > Jean-Louis > > > > > >Why don't you just use an array? > > > > > > > > > >-- > >* R&zE: > > >-- >-- Renze Munnik >-- DataLink BV >-- >-- E: [EMAIL PROTECTED] >-- W: +31 23 5326162 >-- F: +31 23 5322144 >-- M: +31 6 21811143 >-- >-- Stationsplein 82 >-- 2011 LM HAARLEM >-- Netherlands >-- >-- http://www.datalink.nl >-- > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Variables in a loop
try and for ($i=1; $i<=10; $i++) { $tab[$i]=$a[$i] ;} This way $a will be a array. Hope it helps Bruno Gimenes Pereti. - Original Message - From: "LeTortorec, Jean-Louis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 29, 2001 7:03 PM Subject: [PHP-DB] Variables in a loop > I'm trying to write a loop to read variables I receive from a form: > > > > > > > > > I'd like to get something like: > > for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;} > > > The expression "a".$i is actually a string, not a variable. Any idea how to > "read" the value of that string? > > Thanks for your help. > > Jean-Louis > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Variables in a loop
From: LeTortorec, Jean-Louis <[EMAIL PROTECTED]> Date: Mon, Oct 29, 2001 at 04:03:45PM -0500 Message-ID: <615315231286D21182E40008C7B1EED23C6E76@COMPAQ3000> Subject: [PHP-DB] Variables in a loop > I'm trying to write a loop to read variables I receive from a form: > > > > > > > > > I'd like to get something like: > > for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;} > > > The expression "a".$i is actually a string, not a variable. Any idea how to > "read" the value of that string? > > Thanks for your help. > > Jean-Louis Why don't you just use an array? -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Variables in a loop
Lookup "Variable Variables" in the PHP manual. You'll use something like: ${$i} -Original Message- From: LeTortorec, Jean-Louis [mailto:[EMAIL PROTECTED]] Sent: Monday, October 29, 2001 3:04 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Variables in a loop I'm trying to write a loop to read variables I receive from a form: I'd like to get something like: for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;} The expression "a".$i is actually a string, not a variable. Any idea how to "read" the value of that string? Thanks for your help. Jean-Louis -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Variables in a loop
http://www.php.net/manual/en/language.variables.variable.php > -Original Message- > From: LeTortorec, Jean-Louis [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 29, 2001 2:04 PM > To: '[EMAIL PROTECTED]' > Subject: [PHP-DB] Variables in a loop > > > I'm trying to write a loop to read variables I receive from a form: > > > > > > > > > I'd like to get something like: > > for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;} > > > The expression "a".$i is actually a string, not a variable. > Any idea how to > "read" the value of that string? > > Thanks for your help. > > Jean-Louis > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Variables in MySQL Insert Queries
You've created the query but haven't actually run the query. i.e. $result = mysql_query($sql); I'm new to this but I think that's what you're problem is. Howard -Original Message- From: plague [mailto:[EMAIL PROTECTED]] Sent: Friday, 24 August 2001 3:57 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables in MySQL Insert Queries I am using this code to connect to my database and insert form data from a user: $connect = mysql_connect("myhost","user","pass") or die (" not connected"); @mysql_select_db("dbname"); $sql="INSERT INTO tablename (id,first,last,age,email,sfuser,sfship,icq,ac,loca,ref) Values(,`$first`,`$last`,'$age',`$email`,`$sfuser`,`$sfship`,`$icq`,`$ac`,`$ loca`,`$ref`)"; echo (mysql_affected_rows()?"success":"failure"); mysql_close($connect); The script returns "success" except for it doesn't insert the data ( from a form ). The age column is BLOB, not INT. I would really appreciate the help of someone, as this has really stumped me. Thanks, plague -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Variables in MySQL Insert Queries
plague -- unfortunately i don't have the beginnings of this thread, but if your code below is verbatim, it looks as though you are missing the mysql_query() statement. that should drop your information. kate > -Original Message- > From: plague [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 24, 2001 12:57 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Variables in MySQL Insert Queries > > > I am using this code to connect to my database and insert form data from > a > user: > > $connect = mysql_connect("myhost","user","pass") or die (" not > connected"); > @mysql_select_db("dbname"); > $sql="INSERT INTO tablename > (id,first,last,age,email,sfuser,sfship,icq,ac,loca,ref) > Values(,`$first`,`$last`,'$age',`$email`,`$sfuser`,`$sfship`,`$icq`,`$ac`,`$ > loca`,`$ref`)"; > echo (mysql_affected_rows()?"success":"failure"); > mysql_close($connect); > > The script returns "success" except for it doesn't insert the data ( > from a > form ). > > The age column is BLOB, not INT. > > I would really appreciate the help of someone, as this has really > stumped > me. > > Thanks, > > plague > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Variables in MySQL Insert Queries
If this is an exact copy of your script, then you've surrounded each variable name in the VALUES(...) with back-ticks. Why? -Original Message- From: plague [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 12:57 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Variables in MySQL Insert Queries I am using this code to connect to my database and insert form data from a user: $connect = mysql_connect("myhost","user","pass") or die (" not connected"); @mysql_select_db("dbname"); $sql="INSERT INTO tablename (id,first,last,age,email,sfuser,sfship,icq,ac,loca,ref) Values(,`$first`,`$last`,'$age',`$email`,`$sfuser`,`$sfship`,`$icq`,`$ac`,`$ loca`,`$ref`)"; echo (mysql_affected_rows()?"success":"failure"); mysql_close($connect); The script returns "success" except for it doesn't insert the data ( from a form ). The age column is BLOB, not INT. I would really appreciate the help of someone, as this has really stumped me. Thanks, plague -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] variables
if there is a value in $HTTP_POST_VARS["variable_name"] then it came via a form with method="POST", if there's a value in $HTTP_GET_VARS["variable_name"] then it came from querystring or a form with method="GET" beau // -Original Message- // From: J-E-N [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 23 August 2001 1:24 PM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] variables // // // Hello there. // // Is there a way to know whether a variable was passed by a // form or just typed from the address bar? // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Variables and DB
how about posting the code? or describe the problem a bit closer. Johannes "Rui Machado" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello > > I'm writting a registration form with connection to > mysql DB, but I have a problem in the last step, I > can't access the variables to put them in the DB. > I'm using the same file to process the form, but the > last step is confirmation of the data and insertion in > the DB, here it fails because I can't submit the > variables. > > Any clue? > > I was thinking of doing hidden types but I think this > is not the best way. > > Use GLOBALS? > > Thanks > > Rui Machado > > __ > Do You Yahoo!? > Yahoo! Auctions - buy the things you want at great prices > http://auctions.yahoo.com/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] variables
Dunno without looking at code, but try storing the value of $customer into a local variable when the script is invoked - something is wiping it clean. my thunks, Phil J. Scott Kalbach wrote: > I am having a problem with losing a variables value. What I am doing is > taking the value from a database, 'customer_id', and putting it into a > hidden form value called 'customer'. When I hit submit on the form it sends > me to a page where it does several queries to several databases and pulls > information all based on the value $customer. > > I have the individual queries in include files. It does the first 2 queries > fine,but when it gets to the third, the value of $customer seems to be gone, > so I get no result for the rest of the query's. I looked in my scripts but > can't figure out any reason it would lose this value. > > Any ideas? > > Thanks, > > Scott Kalbach > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] variables
On Thursday, March 29, 2001, at 04:58 PM, Scott Kalbach wrote: > I have the individual queries in include files. It does the first 2 > queries > fine,but when it gets to the third, the value of $customer seems to be > gone, > so I get no result for the rest of the query's. I looked in my scripts > but > can't figure out any reason it would lose this value. > > Any ideas? I'd check over between the last query that has a valid value of $customer and make sure that my code for is there. I have had a number of these to have to track down *grin* HTH Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]