RE: [PHP] display error line in object method
From: Georgi Ivanov [mailto:[EMAIL PROTECTED] > Thank you for the replay. > I know i can pass __LINE to $db->error(). > This is not the idea. I want $db->error() to print the line > on which it was > executed . > $parent::__LINE__ > Who is the $parent here ? There isn't, necessarily. That was pseudo-code to demonstrate what I thought you were asking about. The point of my reply was "I don't think it's possible to do what you want to do here," and offer up an alternative in passing __LINE__ as an argument to error(). Good luck! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] display error line in object method
From: Georgi Ivanov [mailto:[EMAIL PROTECTED] > Hi, > I have a db wrapper class. > I use it like this : > $db->query"(SQL HERE") or die ($db->error()); > Is there a way to display the line on which $db->error() is > executed without > doing die (__LINE__." ".$db->error() )? > If i put __LINE__ in the class the line number is always the > line in the class > file. > > I want when i call $db->error() to display the current line number. Probably not the answer you're looking for, but I think your best option may be to pass __LINE__ as an arg to error() and use it there as you please. I don't know of any $parent::__LINE__ syntax, which is what it sounds like you're asking about... -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP error on form
From: Bruce Gilbert [mailto:[EMAIL PROTECTED] > Hello, > > I am trying to get a form to work integrating html with PHP. > > the code I have is: > > $form_block = " > > Your Name:< /br> > > < /br> > > Message:< /br> > > > Form\"> > "; > > if ($_POST['op'] !="ds") { > // they need to see the form > echo "$form_block"; > } else if ($_POST['op'] =="ds") { > //check value of $_POST['sender name'] > if ($_POST['sender_name'] =="") { > $name_err = "Please > enter your name!< /br>"; > $send ="no"; > } > //check value of $_POST['sender_email'] > if ($POST['sender_email'] =="") { > $email_err ="Please enter your > email address!< /br>"; > $send= "no"; > } > //check value of $_POST['message'] > if ($POST['message'] =="") { > $message_err = "Please enter a > message!< /br>"; > $send ="no"; > } > if ($send !="no") { > //it's o.k to send, so build the mail > $msg ="E-MAIL SENT FROM WWW SITE\n"; > $msg .="Senders Name: > $POST['senders_name']\n"; > $msg .="Senders E-MAIL: > $POST['senders_email']\n"; > $msg .="Senders Name: $POST['message']\n\n"; > $to ="[EMAIL PROTECTED]"; > $subject = "There has been a disturbance in the Force"; > $mailheaders .="Reply-To: $_POST['sender_email']\n"; > //send the mail > mail ($to, $subject, $msg, $mailheaders); > //display confirmation to user > echo "mail has been sent!"; > } else if ($send =="no") { > //print error messages > echo "$name_err"; > echo "$email_err"; > echo "$message_err"; > echo "$form_block"; > } > } > ?> > > and the error I get is: > > Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, > expecting T_STRING or T_VARIABLE or T_NUM_STRING in > /hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form > _test.php > on line 58 > > the above code is just the php form part of the page not the entire > code, so it would be impossible to determine line 58, but I was hoping > someone would be able to spot the problem or at least explain the > error to a relative newbie. > > thanks I don't think your error message is indicative of this, but PHP /will/ choke on your lines that include array key references in them, such as: $mailheaders .="Reply-To: $_POST['sender_email']\n"; In those cases, you need to either leave the quotes for the variable or enclose the var in curly braces: $mailheaders .="Reply-To: " . $_POST['sender_email'] . "\n"; $mailheaders .="Reply-To: {$_POST['sender_email']}\n"; I generally prefer the latter, but it's entirely up to the user. Try fixing those and see if it still errors. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] preg_match - help please
From: André Medeiros [mailto:[EMAIL PROTECTED] > On Wed, 2005-07-27 at 11:41 -0400, Mike Johnson wrote: > > From: André Medeiros [mailto:[EMAIL PROTECTED] > > > > > On Wed, 2005-07-27 at 16:16 +0100, Mark Rees wrote: > > > > > > > Or even four - like Rafael van der Vaart for example - so > > > make sure that the > > > > surname box matches spaces as well, and special characters > > > like the ê, as > > > > well as ' as in John O'Kane > > > > > > > > > > Yeah, that's why strpos will make his life much easier :) > > > > Can you explain how you'd use strpos() in this situation? I > was going to ask earlier, but didn't bother, but now I'm curious... > > > > That's not very nice of you, saying that to people who try to help ;) Well, it could be argued that an obtuse link to the online docs and nothing else isn't "trying to help." ;) > if( strpos( $_POST['frmName'], ' ' ) === false ) { > // Do error handling here > } else { > // All is OK :) > } Gotcha. Except that it'll accept a ' ' string as valid. :P -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] preg_match - help please
From: André Medeiros [mailto:[EMAIL PROTECTED] > On Wed, 2005-07-27 at 16:16 +0100, Mark Rees wrote: > > > Or even four - like Rafael van der Vaart for example - so > make sure that the > > surname box matches spaces as well, and special characters > like the ê, as > > well as ' as in John O'Kane > > > > Yeah, that's why strpos will make his life much easier :) Can you explain how you'd use strpos() in this situation? I was going to ask earlier, but didn't bother, but now I'm curious... -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with a home-grown function
From: Dan Trainor [mailto:[EMAIL PROTECTED] > Hello, all - > > I've been looking around for a function that would tell me if a $value > in a $key=>$value array was empty, and I could not find one. So I > decided to make my own. Even if I am re-inventing the wheel, > I thought that the practice might be good for me. > > However, my function doesn't *quite* work, and I'm having a difficult > time finding out why. The code is as follows: > > function findMissingVals($workingArray) { > $newcount = count($workingArray); > for ($i = 0; $i <= $newcount; $i++) { > if (empty($workingArray['$i'])) { > return 1; > } > } > } > > So it takes in $workingArray as an array, runs a loop, checks $i, yada > yada. The thing is, that sometimes the function does not > return 1, even when it should. > > I was hoping some experienced eyes could take a gander at > this and give me some pointers. PHP doesn't eval code in single-quotes, so what you want to do is simply: if (empty($workingArray[$i])) { return 1; } With the single-quotes, it's looking for the string $i as a key. HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] error when trying to delete a record
From: Paul Waring [mailto:[EMAIL PROTECTED] > On Mon, Jul 11, 2005 at 03:25:33PM +0100, Mark Rees wrote: > > with no single quotes round it. Putting quotes round > > integer values is counter-intuitive - is it necessary > > in some cases? > > If the field is a numeric type (e.g. INT) as opposed to > numeric data being stored in a character field (e.g. a > telephone number) then it is not only unnecessary to quote > the value, it's also incorrect useage of SQL, although > you'd probably get away with it in most database systems. I agree. What's best is to ensure the val is of the proper type before sending it to the db. Try casting it first; if the value is blank, it'll cast as 0 (though that may not be optimal, either, if your record could be 0): $query = "DELETE FROM sheet1 WHERE id = " . (int)$id; Also probably best to check if it's empty, something such as: if (!empty($id)) { $query = 'DELETE FROM sheet1 WHERE id = ' . (int)$id; } else { echo 'Argument $id was empty'; } HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with arrays
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Hi, > I have 2 arrays: > > Array ( >[0] => Array ( > [0] => 28 > [1] => Music > ) > [1] => Array ( > [0] => 5 > [1] => Books > ) >) > > and > > Array ( >[0] => aaa >[1] => bbb >) > > I want to join this two array and the result must be loke this: > > Array ( >[0] => Array ( > [0] => 28 > [1] => Music > [2] => aaa > ) > [1] => Array ( > [0] => 5 > [1] => Books > [2] => bbb > ) >) > > Thanks in advance for your help In this specific example, I think this would work: That's not terribly flexible, though. Is this used in a more generalized sense, or is it just this specific instance? -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] form inside an email
From: Ross [mailto:[EMAIL PROTECTED] > Hi, > > I would like to send a form to customers to get some information. > > The form will be a HTML email and collect a few bits of > data...name. age etc. > > Can I put this inside an html email so customers do not have to > open an external webpage to fill in the fields. How can this > then be processed? > > If this can be done in php then great. If not any other > suggestions are welcome. Looks like you've already gotten answers, but I wanted to mention that forms in HTML email are a big spam flag. If you're mailing to a large group or to certain domains/spam handlers, you may easily get flagged for bulk mail. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] calling a derived static method from a base class
From: news [mailto:[EMAIL PROTECTED] On Behalf Of > >class Base { > > static function f() { > self::g(); > } > > static function g() { > print("Base\n"); > } >} > >class Derived extends Base { > static function g() { > print("Derived\n"); > } >} > >Derived::f(); > > > I want that to print "Derived", but it prints "Base" instead. > How can I get > it to do what I want? > > Thank for the help. If you know the name of the extension class, you'd want to do this: class Base { static function f() { Derived::g(); } static function g() { print("Base\n"); } } class Derived extends Base { static function g() { print("Derived\n"); } } Derived::f(); If you don't know if, though, you could possibly call it as a variable. Perhaps something like this: class Base { static function f($classname) { $classname::g(); } static function g() { print("Base\n"); } } class Derived extends Base { static function g() { print("Derived\n"); } } Derived::f('Derived'); Not sure if this is what you're looking for, but if not let us know. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Notice: Undefined index
From: Rob Kapfer [mailto:[EMAIL PROTECTED] > Hello, This is a new install of PHP 5.0.4 on XP, I'm testing if it's > installed correctly with the usual test.htm: > > > Your name: > > Your age: > > > > > > Action.php: > > > echo $_POST['name']; > > echo $_POST['age']; > > ?> > > Results: > > C:\NCC>action.php > > Notice: Undefined index: name in C:\NCC\action.php on line 2 > > Notice: Undefined index: age in C:\NCC\action.php on line 3 > > C:\NCC> That's correct behavior. As you're simply running action.php on its own, it sees that $_POST['name'] and $_POST['age'] don't exist and outputs a notice for each. To avoid the notices, ensure that those keys exist before calling something like echo on them: HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Insert Chars into a string
From: Mike Johnson [mailto:[EMAIL PROTECTED] > From: PartyPosters [mailto:[EMAIL PROTECTED] > > > Hello, > > I have a variable that contains a filename, I want to be able > > to insert the date and time just before for the ".jpg" > > for example if my filename is 'pic.jpg' I want it to read > > 'pic_Monday 15th of January 2003 05:51:38 AM.jpg (or if > > anyone else knowshow to write the time and time all in > > numbers it would be appreciated as I'm using ate("l dS of F Y > > h:i:s A") which obviously is a bit long. > > First off, I'd probably use preg_replace(). Maybe something like: > > $pattern = '/^(.*?)(\.jpg)$/'; > $replacement = '\1' . date('l dS of F Y h:i:s A') . '\2'; > $filename = preg_replace($pattern, $replacement, $filename); > > I haven't tested that, but I think it should work. Actually, it occurs to me that strrpos() might be faster. $filename = substr($filename, 0, strrpos('.jpg')) . date('YmdHis') . substr($filename, strrpos('.jpg'), strlen($filename)); Might need to tweak it, but that should work. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Insert Chars into a string
From: PartyPosters [mailto:[EMAIL PROTECTED] > Hello, > I have a variable that contains a filename, I want to be able > to insert the date and time just before for the ".jpg" > for example if my filename is 'pic.jpg' I want it to read > 'pic_Monday 15th of January 2003 05:51:38 AM.jpg (or if > anyone else knowshow to write the time and time all in > numbers it would be appreciated as I'm using ate("l dS of F Y > h:i:s A") which obviously is a bit long. First off, I'd probably use preg_replace(). Maybe something like: $pattern = '/^(.*?)(\.jpg)$/'; $replacement = '\1' . date('l dS of F Y h:i:s A') . '\2'; $filename = preg_replace($pattern, $replacement, $filename); I haven't tested that, but I think it should work. As for the date format, if it doesn't need to be human-readable, might I suggest date('U')? It's the number of seconds since the epoch; it's easily convertable to human-readable format. If that doesn't fly, perhaps MySQL's datetime format, which is a 14-digit int, achievable with date('YmdHis'). I may be a holdover from DOS, but I shudder at spaces in filenames. :) HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Résultats sur plusieurs pages
From: clariond jean claude [mailto:[EMAIL PROTECTED] > Bonjour, > J'utilise PHP et MySQL grâce à EasyPHP sous WindowsXP. > J'ai réussi à modifier un programme php pour pouvoir > l'utiliser à gérer un dictionnaire d'une langue locale, dont > vous avez une phrase ci-dessous. > L'interogation de la base de données peut donner suivant les > cas, un grand nombre de résultas, aussi j'essaie d'ajouter > quelques lignes de programmation pour que le résultat d'une > recherche qui donne un trop grand nombre de réponse puisse > petre affiché sur plusieurs pages, à la manière des moteurs > de recherche, genre Google. > Où puis-je trouver un exemple de ces quelques lignes de > programmation, je bataille depuis plus de quinze jours en vain...! > > http://www.ubaye-verdon.net/barcinonien/index.php3 > > Merci et meilleures salutations. Bonjour, S'il-vous plait, pardonez ma Francaise. Je suis Americaine, mais je parle Francais un peu. Si je lis votre question correctement, vous desire paginez votre resultats. Vous avez besoin le nombre de records dans l'ensemble de resultat. Si vous desire montrer dix resultat dans chaque page, ajoutez un clause LIMIT a votre interogation: SELECT * FROM nom_de_table LIMIT n,10; `n' est l'excentrage, ou la pointe commencement. Passer `n' de chaque page et ajoutez 10: http://domain.net/resultant.php3?n=0 http://domain.net/resultant.php3?n=10 http://domain.net/resultant.php3?n=20 ... http://domain.net/resultant.php3?n=100 Avec le clause LIMIT, votre interogation est: SELECT * FROM nom_de_table LIMIT 0,10; SELECT * FROM nom_de_table LIMIT 10,10; SELECT * FROM nom_de_table LIMIT 20,10; ... SELECT * FROM nom_de_table LIMIT 100,10; Le premiere retourne resultant zero a dix, le seconde retourne onze a vingt, et le deniere retourne resultant cent a cent-dix. J'espere que ceci aide, et ma Francaise et intelligible! Bonne chance! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cache class
From: Mister Jack [mailto:[EMAIL PROTECTED] > Hi, > > I'm having a bit of a problem. > I include a class in my script, the first time run fine, and then if I > change anything in my class, changes are not reflected on the browser, > it's like it's still the old class which is used. I've cleared the > browser cache, force a pragma no-cache, but no, nothing do the trick. > even if I do "return;" at the beginning of the method I called, it > doesn't work... does someone have a clue about what is going on ? Not to be a jerk and ask the obvious question, but are you editing the right file and/or saving it to the right place? I only ask because I've done that so many times it's not funny. :) -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] User Passwords: checking for unique chars
From: Alex Gemmell [mailto:[EMAIL PROTECTED] > Hello! > > I'm checking user chosen passwords for validity and have created 7 > tests. It's not 100% bulletproof but it will do for now. My problem > is with the last check "have 6 unique characters". I'm at a loss at > how to check for this in a neat one-liner. > > My brain is starting to go off on some horribly complicated routines > but I'm sure it can be done neatly (like the regular expressions). > Can anyone help me with this? By the way - I've only just learnt > regular expressions this morning so I'm no expert on them... The quick & dirty way, I think, would be the following: I'm curious to see if there's an easier way to do it, though. I'm not sure regexps are the answer. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do you read one of these parameters?
From: Brian Dunning [mailto:[EMAIL PROTECTED] > I see URLs formatted like this: > >http://tinyurl.com/xyz > > How do you read that "xyz," since there's no "/?x=" preceding > it? Is it not a get parameter? My best guess is that it's being converted by Apache using mod_rewrite. For one of my websites, for instance, I have mod_rewrite convert /op_ed/123 to /op_ed/index.php?id=123. It's more search engine-friendly, for one, and an easier structure to remember for non-techie folks. More on mod_rewrite here: http://httpd.apache.org/docs/misc/FAQ.html#rewrite-more-config This is Apache-specific, but I'd imagine there are similar methods for other webservers. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: AW: [PHP] Student Suspended Over PHP use.[Incredibly OT]
From: Mirco Blitz [mailto:[EMAIL PROTECTED] > Oh please hack down on me. > > I also hear a lot of crap aout us germans every day an I dont > get pissed of that as well. > > You really take yourself to serious. Seriously, what do you hear about Germans on this list? I read this list daily and, while I may skip some messages, I've never seen anything about any group like what you posted earlier. Do tell, I'm curious. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [NEWBIE] Trying to create a function from an existing script
From: Dave [mailto:[EMAIL PROTECTED] > The Problem: > I'm not able to create the right syntax to pass the > $HTTP_POST_FILES variable to the function. So the function > gets called, but then it stops very early because what I > end up giving it is essentially an empty array, so it > thinks there's no file to handle. $HTTP_POST_FILES isn't an auto-global. As such, your function is looking for a localized variable called $HTTP_POST_FILES and finds nothing. Add the following as the first line of your function, and it should work fine: global $HTTP_POST_FILES; See here for more info: http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.f iles Hope this helps! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [Fwd: DNS.050125191312.29782 (Re: Re: [PHP] Replace credit card numbers with X ???)]
From: Richard Davey [mailto:[EMAIL PROTECTED] > Hello Afan, > > Tuesday, January 25, 2005, 4:12:43 PM, you wrote: > > AP> Hey! > AP> I just got this emai lfrom RIPN mail processor at Moscow ?!?!?!?!? > > Join the club.. everyone who posts gets one. Annoying, no? > > Best regards, > > Richard Davey My personal favorite is when someone requests a read receipt on listmail. I wonder what their inbox looks like when 500 people send one back all in the space of five minutes. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] variable hell
From: mario [mailto:[EMAIL PROTECTED] > Hi all > > I have few variables in this format: > > $isproductssorttext = "150"; > $isofferssorttext = "250"; > $isnewproductssorttext = "350"; > > $isproductscount = "50"; > $isofferscount = "30"; > $isnewproductscount = "20"; > etc > > > What I want to do is have a variable > e.g. $x = "products"; > > and create from that, the variable $is'products'sorttext > (<--$isproductssorttext) and use its value > > so if $x was "offers" on echo I would have (250) <-- > "$isofferssorttext" > if $x was newproducts on echo I would have (350) <-- > "$isnewproductssorttext" I'd imagine, at this point, you'd need to move into the realm of associative arrays. $x = 'products'; $issorttext[$x] = 150; $isnewsorttext[$x] = 350; $iscount[$x] = 50; $isnewcount[$x] = 20; After this, you'd end up with four arrays of one key each ('products'), referenced as such: echo $issorttext['products']; // echoes 150 Then do the same for the key 'offers' and you'd have the same four arrays, but now each with two keys. Hope this wasn't too confusing an explanation. :) -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cURL and line breaks
From: Andrew Kreps [mailto:[EMAIL PROTECTED] > Are you talking about the variable you're POSTing? Does it make a > difference if you urlencode the form var? Have you tried debugging > from the server end to see what cURL is passing over? I use cURL > quite a bit, although I've never tried passing muti-line form data. Yeah. Sorry, I wasn't as clear as I could have been in my original post. What I was referring to is one or more values passed to CURLOPT_POSTFIELDS. Oddly enough, if I urlencode it, it ends up urlencoded all the way through to the phpBB database. I didn't get to do much debugging as I was in a hurry. I just wanted to toss this one out there and see if it was a known issue I'd missed in Google. I doubted it, but figured it was worth a shot. -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cURL and line breaks
Just thought I'd throw this one out there to test the waters... This past weekend, I was fiddling with cURL to create a "bot" that could auto-post to my phpBB message board on-demand. All was working well with getting it to login to the board and post, but the strange part came when I discovered that it would shear form vars at a \n character. I never did pinpoint it to whether it was cURL or phpBB doing it, but I suspected cURL. I also didn't do much testing outside of my application outside of messing with every CURLOPT_* setting I could lay my hands on. Has anyone ever run into something like this, though? I Googled to no avail... -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] gallery (4 in a row) // carefull newbie
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Hi all > > I am making a gallery for my Homepage. Now, I want to make > little tumbnails of my work and make a table out of them. > So, to not put them all in a row, what whould make the site > unreadable, i have to put them in a little table, an i think > 4 in each row would be ok. > > I like to read out the pic's name etc. out of a mysql table. > But how do make the script to write a after it read > out 4 entries of a mysql table? > > Thanks in advance :) What I generally do is use the mod (%) operator to keep track of where it is. It returns the remainder of the divisional operator, as such: 0 % 4 == 0 1 % 4 == 1 2 % 4 == 2 3 % 4 == 3 4 % 4 == 0 5 % 4 == 1 6 % 4 == 2 etc... That way, you have a guaranteed 4-member looping variable. Try something like this: \n"; } echo "{$row['baz']}\n"; if ($loopcount == 3) { echo "\n"; } } ?> The only problem is that at the end of the while() loop, if you want to have perfectly-formatted HTML, you need to figure out if it left off in the middle of a row and fill with N empty tags. Also, if there's a better way to do this, I'm all ears. This is the way I've done it for years, but it /is/ a pain to do. Anyway, HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Conversions?
From: Robert Sossomon [mailto:[EMAIL PROTECTED] > I have a date in format YY-MM-DD in a MySQL table. I need to > pull it back to display it in either format: MM-DD-YY or > Month Day, Year format. > > I can't figure out how to write the query to do it, and am > not sure how to make PHP just parse the one given and dump it > back out in the way I need it. Any suggestions? I don't know how well PHP would handle the 2-digit year concept, so you might be better off doing it in the query. Something like this: SELECT DATE_FORMAT(date_field, '%m-%d-%y') AS date_format_1, DATE_FORMAT(date_field, '%M %e, %y') AS date_format_2... HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: probably stupid, but...
From: Robert Sossomon [mailto:[EMAIL PROTECTED] > OK, I took out the extra ' that I had at the beginning, and > then I changed everything around to: > > if (!empty($_POST['book_title_'.$i])) > { >$addtocart = "INSERT INTO `curriculum` VALUES > ('',$_POST['book_title_'.$i],$_POST['book_level_'.$i],$_POST[' > level_grades_'.$i],$_POST['book_section_'.$i],$_POST['chapter_ > '.$i],$_POST['chapter_title_'.$i],$_POST['lesson_title_'.$i],$ > _POST['skill_'.$i],$_POST['life_skill_'.$i],$_POST['success_in > dicator_'.$i],$_POST['ncscos_'.$i],$_POST['subject_'.$i],$_POS > T['pages_'.$i],$_POST['c_kit_'.$i])"; >echo "$addtocart"; >mysql_query($addtocart); > > And it still is producing an empty page (not even echoing out > the $addtocart variable) when I run it. If this is just a snippet and you do close that if clause with a curly brace later in the code, my guess is that the parser doesn't like the $_POST['book_title_'.$i] syntax. Try changing them all like this, if you're looking to eliminate that possibility: $_POST["book_title_{$i}"] Wish I had time to test my theory, but I'm strapped at the moment. :) -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What am I doing wrong - PHP
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] > Ok, hopefully I can explain this clearly, even though > I think I might be an idiot since Ive been going on > about this for a few days. > > I have a table that holds values and labels > i.e. 1 = New York > 2 = Boston > 3 = Kansas City > 4 = Amsterdam > > I want to put this table into a multiple selection > list, that a user can choose from in a form > My code is drawing a blank though: > > //This is my call to the table "staindtypes" > mysql_select_db($database_lokale, $lokale); > $indque1 = "SELECT * FROM staindtypes"; > $inds = mysql_query($indque1, $lokale) or > die(mysql_error()); > $row_inds = mysql_fetch_assoc($inds); > $totalRows_inds = mysql_num_rows($inds); > $row = mysql_fetch_row; > ?> > > > //Here is the element and the php to loop it > >id="Ind"> > Please Select > do { > ?> > $row_$result['CareerCategories']?> ---^ I think your error is right here. Don't you want $rows['CareerCategories']? Aside from that, I'm not certain the code is exactly what you want, but this should at least solve the blank page problem. I think PHP's barfing on that but errors aren't being written to the browser. Good luck! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smarterliving.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php