Re: [PHP] Cant set info in DB...HELP
On 6/2/07, kvigor <[EMAIL PROTECTED]> wrote: Hello, I'm using phpMyAdmin and I can't get any of my form data into the database. It returns message: "MySQL returned an empty result set" w/in phpMyAdmin GUI. However I get no errors on screen when form info is submitted. What I have done to solve issue: drop DB and create new. Review form vars and SQL statements can't find errors...help Please help... //=FORM== Consumer Information *Name: *Address: *City: *State: *Zip: *Phone: School Nomination Information *Name: *Address: *City: *State: *Zip: Store Shopped At *Name: *City: *State: "; //END==FORM echo" "; //===striptags=and=trim=== $regName = trim(strip_tags($_POST['conName'])); $regAddress = trim(strip_tags($_POST['conAddress'])); $regCity = trim(strip_tags($_POST['conCity'])); $regState = trim(strip_tags($_POST['conState'])); $regZip = trim(strip_tags($_POST['conZip'])); $regPhone = trim(strip_tags($_POST['conPhone'])); $sclName = trim(strip_tags($_POST['schName'])); $sclAddress = trim(strip_tags($_POST['schAddress'])); $sclCity = trim(strip_tags($_POST['schCity'])); $sclState = trim(strip_tags($_POST['schState'])); $sclZip = trim(strip_tags($_POST['schZip'])); $stoName = trim(strip_tags($_POST['strName'])); $stoCity = trim(strip_tags($_POST['strCity'])); $stoState = trim(strip_tags($_POST['strState'])); //==end=striptags=and=trim=== //==Begin dbPopulation of Form data $dbserver = "localhost"; $dbuser = "root"; $dbpassword = ""; $dbname = "theDB"; $connection = mysqli_connect($dbserver, $dbuser, $dbpassword, $dbname) or die ("Could not connect to the Server. Contact your Network Administrator or your Web Programmer"); $insert_query = "INSERT INTO contestants (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclName', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysqli_query($connection,$insert_query); ?> //==End dbPopulation of Form data Try to add a die() to the mysqli_query, like this: mysqli_query($connection,$insert_query) or die(mysqli_error($connection)); This will probably tell you that there's an error in your SQL code... Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading really big files
Angelo Zanetti schrieb: clive wrote: Angelo Zanetti wrote: Dear all We need to develop a system where we can upload really big files. IE 15 - 25 Mb. I know its not a php answer, but if you have ever uploaded a file with facebook then you will have seen the little applet they push down to your browser, perhaps investigating something like might prove useful, I doubt they wrote it themselves, then again maybe they did. yeah seen that its a Java applet was going to research it but didnt have time. Quite a cool component though! Thanks Hello List, i think an upload of 15 - 25 MB is not that big, just depends on which kind of customers you rely, in Sweden for an instance is an 100 Mbit line a normal thing for a home user. For a Video plattform we use a an Flash upload formular that posts to an php file, works up to 120MB like a charm (we just havent test > 120MB, but it should also work) - Give them FTP or SCP or something that is more stable and will re-try. -> *SCP* (http://en.wikipedia.org/wiki/Secure_copy) SCP ?!? an shell account for an unkown person on a server? NO DONT DO THAT!!! the only way to secure scp running normal envirements is to set a chroot, and that is way to much effort for a system > 5 users. (http://sublimation.org/scponly/wiki/index.php/Main_Page) the least thing you would have to worry about is that your server is becoming a spam nest. -> *FTP * could work depending on the requirements you have. Try Proftpd it has an easy way to integrate mysql. (http://www.proftpd.org/) Also try enabling SSL/TLS to keep some privacy. -> *Flash *: There a lot of Tutorials out there, try google or sourceforge. (http://sourceforge.net/search/?type_of_search=soft&words=flash+upload+php) the important settings within php is as mentioned memory_limit as the file gets sucked in, post_max_size and upload_max_filesize as php denies file larger than these settings. By the way as mentioned before, alot of ram is require, but there is nothing you couldnt throw hardware at. Also try playing around with safemode, set an upload dir where the filesystem has no exec rights. (if somebody uploads a script like sh or bash or what ever) Dont place the upload within your webroot, or they will be accessable from the 'outside'. Dont take for granted that the user uploads a file that you like him to upload, test the file, copy the file, make filechecks on the type (not just the normal is '.wmv' within the filename), keep in mind which user on your system runs the php script. If you run cronjobs with the uploaded stuff, dont do it with root. - The browser gets tired of waiting around for the upload to complete - because your server is too slow/busy, and the user has a very bad - experience. I think that statement is totally wrong, we have all seen the success an plattform like youtube made, and they do it no other way. if you have a server that is to slow/busy -> get a another one, or a new Administrator (if it is config based) As a summary, think about what you want to do, it is possible, but as mentioned by beware of the side effects. Oh long post Cheers, Alex
[PHP] Re: Error logging
I've had the same weird problem before, and eventually I discovered that the error_reporting was set on the script level (eg in the PHP page) using the function error_reporting. The thing is any setting in your php pages would overwrite the php.ini setting (as far as I know). -- itoctopus - http://www.itoctopus.com "Clark Alexander" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > We have the following php.ini settings: > error_reporting = E_ALL > display_errors = Off > display_startup_errors = Off > log_errors = On > log_errors_max_len = 1024 > ignore_repeated_errors = Off > ignore_repeated_source = Off > report_memleaks = On > track_errors = Off > > on a SuSE 10.1 server and the errors are being logged to > /var/log/apache2/error_log > (although I can't seem to find a setting that is making that happen.) > > parse errors ARE being logged to this file and that would be extremely > useful information for students to be able to have when trying to find > problems in their scripts. I can't just make that file readable to them. > > So, I had students create a "logs" directory within their file area and > set > the permissions so that the server can to it. I have them adding the > following to the script(s) that they wish to troubleshoot: > > ini_set("log_errors", "On"); > ini_set("error_reporting", E_ALL); > ini_set("error_log", "logs/error_log"); > > > Parse errors are not being written to their personal log file, though. Why > not?? About the only going in there are NOTICE level entries. > > Thanks. > > Clark W. Alexander -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting the filesize of a file with the help of javascript
Hey, I`m currently making a script and i`m having the intention of getting it to work on as much hosts as possible. The big problem with this is that some host (mostly free hosts) turn off alot of vital functions that i need to get for example the filesize of a remote file (or anything remote). Now i had the idea to use some javascript ajax requests to a host that does support that stuff so that it`s still availible on alot hosts.. even if they have it turned off. Now i`m just wondering how you guys would go arround a problem like this and if you think the above is a good idea..? btw.. i have the remote filesize stuff with the help of javascript and ajax working so it`s not a impossible idea.. it`s probably just a little harder when you need to get remoe (xml) files with net security update.. or even the remote creation of thumbnails. Thanx in favor, Mark.
Re: [PHP] Streaming download to IE doesn't work
That's why you comment your code. Take the extra time and put a bit of effort into explaining yourself. Add in a paragraph explaining what's going on, link to whatever solution you found on the web (who knows it might still exist), and just outright bloat it with comments. You might find it annoying now, but I can't tell you how many times I've thanked myself for doing stuff like this when I've revisited old code. You don't need to comment every line, but put a nice hearty paragraph at the beginning of the confusing part and things should be nice and clear to anyone who has to maintain it. "Daniel Kasak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 2007-05-30 at 13:40 -0500, Richard Lynch wrote: > ..snip... >> If I returned to this 2 years later ( or > God forbid, someone else had to look at it ), they wouldn't have a clue > what it was doing, or why. > ..snip .. > Daniel Kasak > IT Developer > NUS Consulting Group > Level 5, 77 Pacific Highway > North Sydney, NSW, Australia 2060 > T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 > email: [EMAIL PROTECTED] > website: http://www.nusconsulting.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting the filesize of a file with the help of javascript
On Sat, June 2, 2007 9:42 am, Mark wrote: > I`m currently making a script and i`m having the intention of getting > it to > work on as much hosts as possible. > The big problem with this is that some host (mostly free hosts) turn > off > alot of vital functions that i need to get for > example the filesize of a remote file (or anything remote). Now i had > the > idea to use some javascript ajax > requests to a host that does support that stuff so that it`s still > availible > on alot hosts.. even if they have it turned off. > > Now i`m just wondering how you guys would go arround a problem like > this and > if you think the above is a good idea..? > btw.. i have the remote filesize stuff with the help of javascript and > ajax > working so it`s not a impossible idea.. it`s probably just a little > harder > when you need to get remoe (xml) files with net security update.. or > even > the remote creation of thumbnails. You could, perhaps, write various "fallback" functions to try to find the filesize... See if filesize(REMOTE) works. See if curl is installed, and do a HEAD request for HTTP If it's FTP, see if PHP has ftp functions. You might want to use JS as a last resort, as you can't guarentee that it will be enabled on the browser, nor that the various security resrictions won't trip you up. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading really big files
On Sat, June 2, 2007 8:38 am, Alexander Jaeger wrote: > - Give them FTP or SCP or something that is more stable and will > re-try. > > -> *SCP* (http://en.wikipedia.org/wiki/Secure_copy) > SCP ?!? an shell account for an unkown person on a server? > NO DONT DO THAT!!! > the only way to secure scp running normal envirements is to > set > a chroot, and that is way to much effort for a system > 5 users. > (http://sublimation.org/scponly/wiki/index.php/Main_Page) > the least thing you would have to worry about is that your > server is becoming a spam nest. Depends who is doing the uploading... One also could imagine a write-only account, either in FTP or SCP setup. I know I've seen this in FTP, and I don't see any reason SCP couldn't. > -> *Flash *: > There a lot of Tutorials out there, try google or sourceforge. Leaves all your non-Flash users out in the cold, which to me is a non-starter, but might be fine for the OP -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cant set info in DB...HELP
On Fri, June 1, 2007 10:52 pm, kvigor wrote: > I'm using phpMyAdmin and I can't get any of my form data into the > database. > It returns message: "MySQL returned an empty result set" w/in > phpMyAdmin > GUI. That might be normal... If you are doing an INSERT, you won't have a result set returned. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linking to an image with document_root
On Fri, June 1, 2007 6:33 pm, chris smith wrote: > On 6/2/07, Richard Lynch <[EMAIL PROTECTED]> wrote: >> On Fri, June 1, 2007 3:16 am, blueboy wrote: >> > May be a stupid question but can I link to images with doscument >> root >> > >> > $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif'; >> > >> > echo ""; >> > >> > I am certain the path is correct, >> > >> > If not what are my alternatives? >> >> You could try if faster than you'll get an answer here, but, yes, >> you >> could do that. >> >> You may even want to set up a variable called $IMAGE_ROOT and set it >> to $_SERVER['DOCUMENT_ROOT'] in a config/include file, so that if >> you >> ever want to move all your images somewhere else, you only change >> one >> line of code. > > How's that going to help when the OP is using a *file path* as an > image source ? Because if he tries it, he'll find out it wont' work. And if he has it only ONE place to fix, then that's better than having it all over his site, once he finds out that DOCUMENT_ROOT is wrong, but something like HTTP_HOST is right. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linking to an image with document_root
On Fri, June 1, 2007 8:37 pm, Tom Rogers wrote: > Friday, June 1, 2007, 6:16:34 PM, you wrote: > b> May be a stupid question but can I link to images with doscument > root > > b> $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif'; > > b> echo ""; > > b> I am certain the path is correct, > > b> If not what are my alternatives? > > > b> R. > > > You don't need anything other than the first slash and it will be from > the root of the web site. So all you need is: > $url = '/images/holder.gif'; > > and it will come from http://whatever.com/images/holder.gif That actually relies on the browser to fill in the domain, and it's a Documented Feature so that's fine... But if you have dreams of scaling up to zillions of users, setting this up "right" so that you can flip all your images to separate boxes (or dcn or akami-like or...) is probably a Good Idea. It will only take a few minutes' work, and some discipline on an ongoing basis, but it's not "hard" by any means. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_GET strings seperation
Hey Jarred, Sorry I couldn't get to you earlier. Thanks again for all the help. And yes, I live maybe about 15-20 min from the new stadium. Take care... Navid On 5/27/07, Jared Farrish <[EMAIL PROTECTED]> wrote: On May 26, 5:39 pm, [EMAIL PROTECTED] ("Navid Yar") wrote: > Thanks so much Jarred. It helps me learn more when there's an > explaination on how the code works. I'll play around with it, change > it a bit and give that a try. Take care... > P.S. -- I'm in Arlington, TX I work with a guy from Arlington. Live near the new stadium? Incidentally, ponder this: function shortGetNewQueryString($arr,$merge) { return array_merge($arr,$merge); } echo(''); // Let's do one new cID, new GET key/value $query = Array('cID'=>42,'freudian'=>'slip'); $go = shortGetNewQueryString($_GET,$query); print_r($go); // Let's do one new cID, new GET key/value $query = Array('cID'=>9-002,'footloose'=>'fancy free'); $go = shortGetNewQueryString($go,$query); print_r($go); // Let's do one new cID, new GET key/value $query = Array('cID'=>493,'fugged'=>'dhaboutit'); $go = shortGetNewQueryString($go,$query); print_r($go); // Let's do one new cID, new GET key/value $query = Array('cID'=>A4,'longlongtimeago'=>'in a galaxy far, far away'); $go = shortGetNewQueryString($go,$query); print_r($go); echo(''); By the way, when you run that code, pay special attention to the second test. Very very tricky entry anomaly... Wuffuh! Pay attention to how short that new code is ( shortGetNewQueryString() ). It's certainly arguable you don't even need to wrap it in a function. Consider: // This is the best version, I believe: brief and simple. function mediumGetNewQueryString ($arr,$add) { foreach ($add as $key=>$val) { $arr[$key] = $val; } return $arr; } echo(''); print_r( mediumGetNewQueryString($_GET,$query) ); echo(''); And then, of course, a number of shortcuts may be used to obscurify and mystify your code for later puzzling, head-scratchedness. This is, of course, exactly comparable to all the other example methods: // Hard to read, ie, needless brevity function annoyingGetNewQueryString ($arr,$add) { foreach ($add as $key=>$val) $arr[$key] = $val; return $arr; } echo(''); print_r( annoyingGetNewQueryString($_GET, $query) ); echo(''); Caution: Using array_merge, though, will overwrite keynames, but NOT numerical items. You can't auto-map over numerical keys with array_merge(), apparently. Consider: $array = Array( [0] => 'moe' [1] => 'curly', [2] => 'larry' ); // Is equivalent to ~ $array = Array(); $array[] 'moe'; $array[] 'curly'; $array[] 'larry'; // Is equivalent to ~ $array = Array(); array_push($array, 'moe'); array_push($array, 'curly'); array_push($array, 'larry'); When you add a numerical array in php, it is added to the stack as a new item, or push. Essentially, $array = Array('item1') $array[] = 'item2' eq ~ "Array('item1','item2')" And then when you call on the array, it { get Array as Numerically-Indexed Set } eq ~ split($array,$token=',') eq ~ ({ [0] => 'item' , [1] = 'item2' }) So an array on a stack can be represeted in memory as a comma-delimited numerically-indexed list, eg, 'item','item2' -- Jared Farrish Intermediate Web Developer Denton, Tx Abraham Maslow: "If the only tool you have is a hammer, you tend to see every problem as a nail." $$ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading really big files
Depends who is doing the uploading... One also could imagine a write-only account, either in FTP or SCP setup. I know I've seen this in FTP, and I don't see any reason SCP couldn't. the reason why scp is different is it needs an system account with a valid shell. FTP does simply not (but it can :). I think nobody except the root user should have shell access to a server, only for security reasons. -> *Flash *: There a lot of Tutorials out there, try google or sourceforge. Leaves all your non-Flash users out in the cold, which to me is a non-starter, but might be fine for the OP There I totaly agree with you! But I require my user to have flash, same as i require them to have an graphical browser. I can imagine where the internet would be with still browsing with lynx, but i guess that is a decision every developer has to face. I guess the gap is between introducing people how to handle a ftp or scp transfer and installing flash. I would go with the second choice. Nevertheless, i see your point. Thanks, Alex
[PHP] When and when not to use ' and "
I noticed today when I was using mysql_fetch_array something weird happened. Database: | id | 1 Code: $colVal = "id"; $foo=mysql_fetch_array($someresult, MYSQL_ASSOC); Now all I wanted to do was get the value of 1 into the variable $bar. Please assume $someresult was the direct product of mysql_query("select * from thistable");. $bar = $foo['$colVal']; // didn't work $bar = $foo['{$colVal}']; // didn't work $bar = $foo[$colVal]; // worked $bar = $foo['id']; // obviously worked What I don't understand is why the first or second option didn't work. Can anybody shed some light on this? Brian Seymour AeroCoreProductions http://www.aerocore.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] When and when not to use ' and "
On 6/2/07, Brian Seymour <[EMAIL PROTECTED]> wrote: I noticed today when I was using mysql_fetch_array something weird happened. Database: | id | 1 Code: $colVal = "id"; $foo=mysql_fetch_array($someresult, MYSQL_ASSOC); Now all I wanted to do was get the value of 1 into the variable $bar. Please assume $someresult was the direct product of mysql_query("select * from thistable");. $bar = $foo['$colVal']; // didn't work $bar = $foo['{$colVal}']; // didn't work $bar = $foo[$colVal]; // worked $bar = $foo['id']; // obviously worked What I don't understand is why the first or second option didn't work. Can anybody shed some light on this? Brian Seymour AeroCoreProductions http://www.aerocore.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Brian, Single quotes give a literal value of the data passed, while double quotes give the translated value. For example, if you have the following: you'll have the following output: $the end The same counts for escaped characters, such as the newline character (\n). If you put it in single quotes, it's processed as a literal value; the same newline inserted in double quotes is displayed properly, as again, it's processed as a translated value. So: Shows: $word\nworks this works Hope that helps a bit. I'm in the middle of moving furniture into my new house and can't get the bed upstairs, so I decided to take a break and grab some "sanity" from the list. Talk about your oxymorons -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] When and when not to use ' and "
On Sat, June 2, 2007 3:15 pm, Brian Seymour wrote: > $bar = $foo['$colVal']; // didn't work > $bar = $foo['{$colVal}']; // didn't work > $bar = $foo[$colVal]; // worked > $bar = $foo['id']; // obviously worked > > What I don't understand is why the first or second option didn't work. > > Can anybody shed some light on this? ' is actually easier to explain. ' has only TWO special characters you can embed in it: ' and \ $foo = 'That\'s life!'; $bar = 'The backslash \\ should be escaped, because it\'s special'; You don't HAVE to escape \ with \\ if PHP won't get "confused" by whatever else you have in your string, but it's a Good Idea, imho, to just always escape it, so you understand what the string parser is doing internally. " is a bit more complex. In addition to " and \ being special, exactly parallel to ' and \ inside '', you also have: variables like $foo and 1-D arrays like $foo[id] special control characters like \n \t \r any char you want with octal { and } for some versions (ugh) of PHP There is also heredoc syntax, which is probably best for large chunks of text, in general. Full documentation is here: http://us.php.net/manual/en/language.types.string.php -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading really big files
On Sat, June 2, 2007 3:01 pm, Alexander Jaeger wrote: >> Depends who is doing the uploading... >> >> One also could imagine a write-only account, either in FTP or SCP >> setup. >> >> I know I've seen this in FTP, and I don't see any reason SCP >> couldn't. >> >> > the reason why scp is different is it needs an system account with a > valid shell. > FTP does simply not (but it can :). > > I think nobody except the root user should have shell access to a > server, > only for security reasons. Veering off the original topic quite a bit here, but... I personally would refuse to work with any webhost who didn't give me a shell account. cron jobs, symlinks, large-scale file operations, and other innumerable minor reasons make non-ssh web development a royal PITA for me, personally. So root-only shell is way too restrictive, imho. >>> -> *Flash *: >>> There a lot of Tutorials out there, try google or >>> sourceforge. >>> >> >> Leaves all your non-Flash users out in the cold, which to me is a >> non-starter, but might be fine for the OP >> >> > There I totaly agree with you! But I require my user to have flash, > same > as i require them to have an graphical browser. > > I can imagine where the internet would be with still browsing with > lynx, > but i guess that is a decision every developer has to face. Um. I tend to use Linux as my desktop, and gave up on Flash long ago. Once I stopped installing it on Windows, I had a MUCH better online experience, actually. Websites are faster, no annoying random noises and fewer distracting "popups" and the CPU and RAM usage finally is reasonable. So I can't listen to bands on myspace. big deal. > I guess the gap is between introducing people how to handle a ftp or > scp > transfer and installing flash. The gap is between a tiny percentage of users who CANNOT install flash, period. I don't know of any OS that doesn't have a large assortment of FTP clients available. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I cannot figure out why this is not working?
On 6/2/07, Brad Sumrall <[EMAIL PROTECTED]> wrote: Where did you get $email2?? $subject = ("Thank you"); $email = $_POST['email'] . "\n"; Why do you need $email? $headers = "Reply-To: " . $_POST['email'] . "\n"; $body = "Thank you for signing our Guest Book and visiting our website. Feel free to search our extensive property database, as this is the most current up to date information in the Real Estate Market today. You will see the latest listings the same time the Realtors do. Check out http://www.Floridaonlineinvestments.com"; . "\n" . mail($to,$subject,$body,$headers); } ?> Did you get any error? And what does mail return? true or false? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cant set info in DB...HELP
Please include the list on all replies. K.Hayes wrote: I don't know if I'm escaping the 'vars correctly'. If I'm wrong can you give me an example? $sql_query = "INSERT INTO contestants (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclName', '$sclCity', 'sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; $insert_query = mysqli_real_escape_string($connection, $sql_query); mysqli_query($connection,$insert_query); ?> No, this is not the right way. I suggest you read the manual page on mysqli_real_escape_string (http://php.net/mysqli_real_escape_string). You need to run it on every variable you are using *in* the SQL query, not on the SQL query itself. Google for a php mysqli tutorial - all this stuff is very basic and should be covered by most tutorials you'll find. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cant set info in DB...HELP
What "lists" are you referring to? Also this is how the examples show I've seen. I know this is basic general stuff but I try many times before posting, and I have followed all directions given. So this is what I did, and nothing is set DB still :-( ===NEW CODE= $regName = trim(strip_tags($_POST['conName'])); $regAddress = trim(strip_tags($_POST['conAddress'])); $regCity = trim(strip_tags($_POST['conCity'])); $regState = trim(strip_tags($_POST['conState'])); $regZip = trim(strip_tags($_POST['conZip'])); $regPhone = trim(strip_tags($_POST['conPhone'])); $sclName = trim(strip_tags($_POST['schName'])); $sclAddress = trim(strip_tags($_POST['schAddress'])); $sclCity = trim(strip_tags($_POST['schCity'])); $sclState = trim(strip_tags($_POST['schState'])); $sclZip = trim(strip_tags($_POST['schZip'])); $stoName = trim(strip_tags($_POST['strName'])); $stoCity = trim(strip_tags($_POST['strCity'])); $stoState = trim(strip_tags($_POST['strState'])); //==Begin dbPopulation of Form info=== $dbserver = "localhost"; // This will be where server name goes $dbuser = "root"; // This will be where username goes $dbpassword = ""; // This will be where password goes $dbname = "theDB"; // This will be where database name goes $connection = mysqli_connect($dbserver, $dbuser, $dbpassword, $dbname) or die (mysqli_error($connection)); $regName = mysqli_real_escape_string($connection, $regName); $regAddress = mysqli_real_escape_string($connection, $regAddress); $regCity = mysqli_real_escape_string($connection, $regCity); $regState = mysqli_real_escape_string($connection, $regState); $regZip = mysqli_real_escape_string($connection, $regZip); $regPhone = mysqli_real_escape_string($connection, $regPhone); $sclName = mysqli_real_escape_string($connection, $sclName); $sclAddress = mysqli_real_escape_string($connection, $sclAddress); $sclCity = mysqli_real_escape_string($connection, $sclCity); $sclState = mysqli_real_escape_string($connection, $sclState); $sclZip = mysqli_real_escape_string($connection, $sclZip); $stoName = mysqli_real_escape_string($connection, $stoName); $stoCity = mysqli_real_escape_string($connection, $stoCity); $stoState = mysqli_real_escape_string($connection, $stoState); $sql_query = "INSERT INTO contestants (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclAddress', '$sclCity', '$sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; mysqli_query($connection,$sql_query); ?> ===END NEW CODE= - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "K.Hayes" <[EMAIL PROTECTED]> Cc: "php-general" Sent: Saturday, June 02, 2007 9:52 PM Subject: Re: [PHP] Cant set info in DB...HELP Please include the list on all replies. K.Hayes wrote: I don't know if I'm escaping the 'vars correctly'. If I'm wrong can you give me an example? $sql_query = "INSERT INTO contestants (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclName', '$sclCity', 'sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; $insert_query = mysqli_real_escape_string($connection, $sql_query); mysqli_query($connection,$insert_query); ?> No, this is not the right way. I suggest you read the manual page on mysqli_real_escape_string (http://php.net/mysqli_real_escape_string). You need to run it on every variable you are using *in* the SQL query, not on the SQL query itself. Google for a php mysqli tutorial - all this stuff is very basic and should be covered by most tutorials you'll find. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cant set info in DB...HELP
K. Hayes wrote: What "lists" are you referring to? Also this is how the examples show I've seen. I mean hit "Reply to all" in your mail client. That way you include the email address of the PHP General mailing list so everyone, including the archives, can see your reply. I know this is basic general stuff but I try many times before posting, and I have followed all directions given. Change the following line... mysqli_query($connection,$sql_query); ?> to... mysqli_query($connection,$sql_query) or die("Query failed: ".mysqli_error($connection); If you still get no output, check error_reporting and display_errors in your php.ini file to make sure you are seeing at least errors and warnings. -Stut ===END NEW CODE= - Original Message - From: "Stut" <[EMAIL PROTECTED]> To: "K.Hayes" <[EMAIL PROTECTED]> Cc: "php-general" Sent: Saturday, June 02, 2007 9:52 PM Subject: Re: [PHP] Cant set info in DB...HELP Please include the list on all replies. K.Hayes wrote: I don't know if I'm escaping the 'vars correctly'. If I'm wrong can you give me an example? $sql_query = "INSERT INTO contestants (conName, conAddress, conCity, conState, conZip, conPhone, schName, schAddress, schCity, schState, schZip, strName, strCity, strState) VALUES('$regName', '$regAddress', '$regCity', '$regState', '$regZip', '$regPhone', '$sclName', '$sclName', '$sclCity', 'sclState', '$sclZip', '$stoName', '$stoCity', '$stoState')"; $insert_query = mysqli_real_escape_string($connection, $sql_query); mysqli_query($connection,$insert_query); ?> No, this is not the right way. I suggest you read the manual page on mysqli_real_escape_string (http://php.net/mysqli_real_escape_string). You need to run it on every variable you are using *in* the SQL query, not on the SQL query itself. Google for a php mysqli tutorial - all this stuff is very basic and should be covered by most tutorials you'll find. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php