| | I created this topic mainly because I wanna get a clear interpretation about those listed PHP functions. The first function is while($row=mysql_fetch_array($query)) { |
| Jul 4, 2009 |
I created this topic mainly because I wanna get a clear interpretation about those listed PHP functions. The first function is while($row=mysql_fetch_array($query)) { You have called a sql and loaded it into variable $query. And by that line, you have loaded all coulombs into the variable $row as an array from the variable $query. After this, it is easy to call a coulomb by the variable $row. For example: if there is a coulomb "username" in the table, you can call it by $row['username'] . This is the easiest way to call a coulomb. And each while repeats the next row will be loaded into the variable $row until all rows finishes. Explain me the following line; $user=trim($_POST['user']) trim function is a combine of left trim and right trim. trim deletes the spaces in the left and in the right of the variable. Here variable $user has been set to $_POST['user'] without spaces around it. For example: $_POST['user'] is CODE ' user\'s name ' trim function will give you the result CODE 'user\'s name' and set it to $user.
I did not get it clearly! For which puposse the function is used?!
I did not get it clearly! For which puposse the function is used?! The trim function erases the spaces,tabs, at the start and at the end. For example: in your code: CODE 1. if ($_GET['login']) { #checks for admin login 2. $user=trim($_POST['user']); #trim user in case of mistake 3. $pass=trim($_POST['pass']); 4. str_replace("username", "password", $srt); 5. if (($user == "username") && ($pass="password")) { Think that the user's name is CODE "username" .If the member enters CODE " username " //there are some spaces at the beginning and end.And if you didn't use trim and directly set, like this CODE 2. $user=$_POST['user']; At the 5th line the user's name will not equals. Like this CODE if (" username "=="username") { the two value is not equal butif you used trim function CODE 2. $user=trim($_POST['user'];) and so CODE if ("username"=="username") { yes the two value is equal, because we used trim function.Briefly if you use trim, the if match will be true even the member adds around the his username.
Thanks. I think I am going to try it soon and then post a reply concerning such issues.
Thanks. I think I am going to try it soon and then post a reply concerning such issues. try using php's documentation. it might help you on some other issues you have in mind. http://www.php.net/docs.php
Yeah, just use http://www.php.net to search for most functions. Or if you need a different function just google it. Or ask here. Whichever you are most comfortable with.
Similar Topics
Keywords : Functions
Here is a function you can use to generate a simple random password for whatever use ;-) CODE I've got a bunch of arrays that i want to use for more then 1 function. when i declear the Here is my 3rd Code: By this code you can encrypt your text: CODE $a = md5("hello"); $b = I just learned this simple method on how to use functions to combine two values from a form. First Hi all I want begin a new project , my new project is Photo blog ( weblog and image album ) in one Can some one please tell me what is the purpose of the following functions , although there's a I've got the following function, that has a function inside of it, when I run it I get the I've been experimenting a little with PHP's image functions and I was trying to see if I I'll set up the background for the question: I have a separate file that I include on all the First of all, if you have answers to the following QUOTE Looking for functions,
|
![]() Functions - ??? |
Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com