Add to Google

Functions - ???

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Functions - ???

alex1985
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)) {

Reply

Erdemir
QUOTE(alex1985 @ Jun 11 2008, 05:46 PM) *
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.

Reply

alex1985
Explain me the following line;
QUOTE
$user=trim($_POST['user'])

Reply

Erdemir
QUOTE(alex1985 @ Jun 12 2008, 11:10 AM) *
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.

Reply

alex1985
I did not get it clearly! For which puposse the function is used?!

Reply

Erdemir
QUOTE(alex1985 @ Jun 12 2008, 09:32 PM) *
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 but

if 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.

 

 

 


Reply

alex1985
Thanks. I think I am going to try it soon and then post a reply concerning such issues.

Reply

moodsey211
QUOTE(alex1985 @ Jun 15 2008, 12:47 AM) *
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

Reply

gogoily
You will find lots of useful and basic documents in this website:
http://www.php.net/

Reply

Lightning73
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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. "game maker" "string functions" - 208.92 hr back. (1)
  2. cache:w4upuxxxakoj:www.trap17.com/index.php/wappys-php-snippets_t38482.html >> enter your keyword - 1746.72 hr back. (1)
Similar Topics

Keywords : functions,

  1. Php Email Validation
    A PHP data validation class with many functions (1)
  2. Php Functions To Send Mail
    (9)
    Which other methods to send mail from a form? I just know mail function, like: mail(string to,
    string subject, string message) Has anyother?....
  3. Arrays Outside A Function
    Need to have arrays available to all functions. (3)
    I've got a bunch of arrays that i want to use for more then 1 function. when i declear the
    arrays outside a function i cant use it in a function. This code was originally written in
    javascript by another person but since I plan to use it and extend it with php I had to change it
    from javascript to php code. In the javascript code the arrays were decleared outside the functions
    with 'var arrayname' I read somewhere that declearing javascript variables with
    'var' gives it global access. Any ideas on how I can go about declearing 1 set of these
    arrays t....
  4. Encrypt Functions
    (0)
    Here is my 3rd Code: By this code you can encrypt your text: CODE $a = md5("hello"); $b =
    base64_encode("hello"); $c = base64_decode("hello"); print "md5 = ".$a." base64_encode = ".$b."
    base64_decode = ".$c; ?> EASY!....
  5. [php](simple) Using Functions To Combine Values In A Form
    Really simple example on how to combine values with function (2)
    I just learned this simple method on how to use functions to combine two values from a form. First
    we create ourselves a simple POST form CODE Name: Location: Now we add this php
    to that same file CODE $nick = $_POST ; $location = $_POST ; function information($nick,
    $location){     echo 'My nick is '.ucfirst($nick).' My location is '.$location;
         } information($nick, $location); ?> that code is similar to this one CODE $nick =
    $_POST ; $location = $_POST ; function information($nick, $location){     return ....
  6. Gd Functions
    Questions (2)
    Hi all I want begin a new project , my new project is Photo blog ( weblog and image album ) in one
    script for example you can post many image in one post at once case . so its very good and very easy
    but we have some problems . if you can plz help me to fix this problems for example : we need
    change image size for page speed ( we dont want show 16 image in one page ) * we need GD functions
    to change image size to smaller and then show smaller image at page if you know source or tutorial
    about change image size plz post here . thankx we know we can change image size (w....
  7. Wappy's Php Snippets
    I will place here usefull php snippets and functions that i learn/use (13)
    Here is a function you can use to generate a simple random password for whatever use ;-) CODE
    function rand_pass($numchar){ $string = str_shuffle ("abcdefghijklmnopqrstuvwxyz1234567890");
    $password = substr ($string, 1, $numchar); return ($password); } //example echo
    rand_pass('8'); // will return an 8 character long random password of numbers and letters
    like c8k4ss42 ?> CODE tags added. Here is an extremly usefull search function that will
    search a directory and its subdirectories for files including the given keyword and display a link
    to these fi....
  8. Some Php Functions Explaination Required
    (2)
    Can some one please tell me what is the purpose of the following functions , although there's a
    little explaination with everyline but i cant understand, can some one exaplin it bit clearly and
    tell me that why it is needed in config.inc.php.. what is its purpose and will it work if i dont
    include these files in config.inc.php thanks QUOTE ### Url were Website has been installed, not
    '/' in end! define('C_URL','http://www.test.com/Website'); ### Internal
    path to Website directory define('C_PATH','Z:/home/www.test.com/www/Webs....
  9. Globals Inside Functions
    (4)
    I've got the following function, that has a function inside of it, when I run it I get the
    followin error: PHP Code: CODE Fatal error: Call to a member function on a non-object in
    See the code below where I get the error message. I'm guessing the scope of my varaibles is
    messed up, but I'm not sure how to fix it. I've abbreviated the code so as to make it easier
    to read. PHP Code: CODE function getMemberRegistrationForm( &$tpl, &$db ) {    function
    displayRegistrationForm( $action, &$db, $defaults = NULL, $id = NULL )    {        global ....
  10. Using The Image Editing Functions Of Php
    Specifically, lines or regular polygons. (4)
    I've been experimenting a little with PHP's image functions and I was trying to see if I
    could make something that looked 3D, so I started with a cube because it's simple. To make an
    isometric picture of a cube, you need to start with a regular hexagon. However, making a regular
    hexagon isn't the easiest thing. Is there a function to create a regular polygon, or specify an
    angle and magnitude for a vector?....
  11. Writing Your Own Functions In Php
    how do i write php functions that takes arguments in php? (2)
    I'll set up the background for the question: I have a separate file that I include on all the
    webpages on my site which I call with PHP using the include() function, so everything will be much
    easier to maintain and update. Well, I have three include files for each page: header.php (includes
    stuff like meta tags, googlebot/spider info), footer.php (the footer/copyright thing), leftnav.php
    (includes the navigation bar). I also like the titles of my pages to be as descriptive as possible
    so I try to include the path of a page (how the user got to that page: "Excite Y....
  12. Confused...
    some php functions that i am confused (5)
    First of all, if you have answers to the following QUOTE
    http://www.trap17.com/forums/A-Lot-Of-Php-...ions-t7653.html
    http://www.trap17.com/forums/A-Lot-Of-Html...ions-t7651.html Feel free to answer them all. Now,
    in PHP i know there's microtime, srand, float, array_rand, arrays, foreach, or any other loop
    functions. i'm really confused . Please help me!....

    1. Looking for functions,






*SIMILAR VIDEOS*
Searching Video's for functions,

*MORE FROM TRAP17.COM*
advertisement



Functions - ???



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE