
Mario F.
Members-
Posts
13 -
Joined
-
Last visited
Never
Everything posted by Mario F.
-
How to select data from mysql db using php regardless of case?
Mario F. replied to willc's topic in PHP Coding Help
It's neither WHERE is a clause, LIKE is an operator. WHERE will fetch the field value and UPPER() will make it all uppercase. The LIKE operator is case sensitive. That is. it will only match if the value returned from WHERE, its 1st operand, is the same as its 2nd operand. 'Johnson' LIKE 'jonhson' returns false 'JOHNSON' LIKE 'JOHNSON' returns true -
How to select data from mysql db using php regardless of case?
Mario F. replied to willc's topic in PHP Coding Help
LIKE is case-sensitive. You can instead do this: // username and password sent from signup form $myusername=strtoupper($_POST['myusername']); $mypassword=$_POST['mypassword']; $sql="SELECT * FROM $tbl_name WHERE UPPER(lastname) LIKE '%$myusername%' and membernum='$mypassword'"; -
Data will have to be stored somewhere for later retrieval. This can be a database or a simple text file. Judging from your requirements I'd say you need a database. You'll then need to create a new xxx.php to get data from the database, not from the form. The form will publish your data to the database instead. You can - and probably should, due to the form complexity - present the user with an intermediate page where is data is presented well formated and with two buttons where you ask them to either confirm their entries or go back and make amends. That page design is similar to your current biotest_form2.php. When the user presses submit, data is saved to the database. When he presses return, data is sent to back to the initial form. The message you are getting is created by your browser when it detects you are trying to refresh a page that contains data sent to it by the POST method. That is, your POST method has this page as the action attribute. This page is meant to process the form. When you refresh your browser is asking you if you wish to resend the form data for this page to process it once again. Why do you get this warning? Because your biotest_form2.php script could be doing other things than just creating the html. It could, for instance be writing to a database, or processing your credit card. When you refresh these operations get repeated (definitely not a good thing when it comes to your credit card). Naturally this is a consequence of your flawed designed when you assumed biotest_form2.php would be seen by everyone. This problem will go away if you change your design to what I suggest on the previous question. Cascading Style Sheets For a quick solution <INPUT type="submit" name="oper" value="coverage"> <INPUT type="submit" name="oper" value="tentative"> your php then reads the $_POST['oper'] variable and acts differently according to its value of 'coverage' or 'tentative' Hope this helps
-
If you are still not convinced, do a port scan on the target machine and use the script on an opened port.
-
Change the offline line to" echo "<font>Offline: $num, $error</font>"; //When server status is offline, output this That should help you understand the error. Your code is fine and works on my machine by changing to my webhost. $ip = "mzproperty.co.uk"; //put your ipaddress here $port= "80"; //the port number
-
Hello all, Despite instructions from the PHP manual I want to use mysql_free_result() and mysql_close() consistently across my scripts. It's a matter of programming culture I acquired from other programming languages and I find it hard to let go, even during my apprenticeship of PHP. What I would like to know however is if by explicitly freeing these two resources, I may be losing the edge on some internal advantage I'm not aware of like memory pooling (in place for many servers, I hear) or garbage collecting that would take care of freeing the resources at more convenient times. I apologize for the assumptions in my question. I just don't know PHP well enough yet not to make them.
-
Well, not saying this for you to avoid using PHP Just mentioning the fact you are probably looking at server-side scripting the wrong way. I can understand your confusion though if you are learning website design as you are learning PHP. I think this the the case since you called script to a snippet of HTML. I suggest perhaps you do it the other way around. Learn website design before learning PHP. It isn't difficult really and in two or 3 weeks you will be here again, this time with a better baggage. I personally think server-side scripting is much more fun (and profitable) when we feel comfortable around HTML and CSS. Your menu doesn't need PHP. In fact it will suffer from its use. You can do it with HTML and CSS. This way you will be separating content and presentation from scripting. Now imagine, after having done of those, you decide that the links to the pages opened by that menu will be stored in a database. It's at that time you will want PHP. It's when you want to create dynamic content. I really believe that to better understand these differences you should start by HTML, followed by CSS, followed by PHP
-
That is fine, but you do realize that you could, and probably should, be doing this without a form or PHP. Unless you don't have to worry about search engine bots or accessibility, it is best to use server-side scripting for only when it's needed. Not just because you can. Your current menu will defeat search engine bots and will confuse people with disabilities that need to use screen reading aiding software.
-
If I understood your requirements right, you don't use PHP for this. You use straight (X)HTML/CSS.
-
Thanks hawk. This is probably an effect of using PHP on a windows machine, since my message needs to be parsed by an MTA which is more restricting on what I can do. However I do wonder why is that on all other places, the mail() function obeys 822bis, except on the body for both windows and unix implementations. Anyway, thanks once again. I will use CRLF throughout.
-
Hello all, I'm trying to send the results of a form processing operation through email. I'm doing this on a Windows machine with WAMP and using Mobile TCP as smtp forwarding mechanism to point to my ISP smtp server. The finished message is formated as such: $body = "Message received from the automated contact form at www.mzproperty.co.uk\n"; $body .= "DO NOT REPLY TO THIS MESSAGE\n"; /*...*/ $body .= "-----------------------------\n"; $body .= "END OF MESSAGE\n"; On my web host this formatting works fine. It also follows what I am learning from the PHP manual. But when ran from my machine, it is refused by my ISP's MTA (qmail) with a "server response: 451" pointing me to the fact I'm using bare LFs on my message. When changing the LFs to CRLF the message gets successfully through. So... this confused me. What exactly is the right way to do it? qmail directs me to RFC 2822 section 2.3, which does state indeed I should use CRLF; The PHP Manual instructs me in the use of LF only; and my web host doesn't care as both forms get through.
-
Well, I'm sorry. Somehow I put this on the wrong forum. Can some moderator move it to PHP Help please?
-
Hello all, I'm trying to send the results of a form processing operation through email. I'm doing this on a Windows machine with WAMP and using Mobile TCP as smtp forwarding mechanism to point to my ISP smtp server. The finished message is formated as such: $body = "Message received from the automated contact form at www.mzproperty.co.uk\n"; $body .= "DO NOT REPLY TO THIS MESSAGE\n"; /*...*/ $body .= "-----------------------------\n"; $body .= "END OF MESSAGE\n"; On my web host this formatting works fine. It also follows what I am learning from the PHP manual. But when ran from my machine, it is refused by my ISP's MTA (qmail) with a "server response: 451" pointing me to the fact I'm using bare LFs on my message. When changing the LFs to CRLF the message gets successfully through. So... this confused me. What exactly is the right way to do it? qmail directs me to RFC 822 section 2.3 which is actually 3.2. It seems to be right; The PHP Manual instructs me in the use of LF, and my web host doesn't care as both forms get through.