alex1985 0 Report post Posted June 11, 2008 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)) { Share this post Link to post Share on other sites
Erdemir 0 Report post Posted June 11, 2008 (edited) 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. Edited June 11, 2008 by Erdemir (see edit history) Share this post Link to post Share on other sites
alex1985 0 Report post Posted June 12, 2008 Explain me the following line; $user=trim($_POST['user']) Share this post Link to post Share on other sites
Erdemir 0 Report post Posted June 12, 2008 (edited) 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 ' user\'s name ' trim function will give you the result 'user\'s name' and set it to $user. Edited June 12, 2008 by Erdemir (see edit history) Share this post Link to post Share on other sites
alex1985 0 Report post Posted June 12, 2008 I did not get it clearly! For which puposse the function is used?! Share this post Link to post Share on other sites
Erdemir 0 Report post Posted June 12, 2008 (edited) 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: 1. if ($_GET['login']) { #checks for admin login2. $user=trim($_POST['user']); #trim user in case of mistake3. $pass=trim($_POST['pass']);4. str_replace("username", "password", $srt);5. if (($user == "username") && ($pass="password")) {Think that the user's name is "username". If the member enters " username " //there are some spaces at the beginning and end.And if you didn't use trim and directly set, like this 2. $user=$_POST['user']; At the 5th line the user's name will not equals. Like this if (" username "=="username") { the two value is not equal but if you used trim function 2. $user=trim($_POST['user'];) and so 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. Edited June 12, 2008 by Erdemir (see edit history) Share this post Link to post Share on other sites
alex1985 0 Report post Posted June 14, 2008 Thanks. I think I am going to try it soon and then post a reply concerning such issues. Share this post Link to post Share on other sites
moodsey211 0 Report post Posted July 10, 2008 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://php.net/docs.php Share this post Link to post Share on other sites
gogoily 0 Report post Posted August 4, 2008 You will find lots of useful and basic documents in this website: http://php.net/ Share this post Link to post Share on other sites
Lightning73 0 Report post Posted September 12, 2008 Yeah, just use http://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. Share this post Link to post Share on other sites