Function Help
Posted: Sun Nov 22, 2009 1:06 am
I (newb) am having trouble trying to understand the following return statement;
I get this so far
1.
This creates a function called addNewUser and has two parameters passed to the function, $username and $password.
2.
This is a global variable that is used to connect to a Mysql database.
3.
The variable q is equal to the mysql command to insert $username and $password into the users table of the database.
4.
Can someone explain how this line is working? I know it is adding the variables to the table, but I do not fully understand it. Like, what does "mysql_query($q,$conn)" mean in english?
Any help would be greatly appreciated.
Spec36
Code: Select all
function addNewUser($username, $password){
global $conn;
$q = "INSERT INTO users VALUES ('$username', '$password')";
return mysql_query($q,$conn);
1.
Code: Select all
function addNewUser($username, $password){2.
Code: Select all
global $conn;3.
Code: Select all
$q = "INSERT INTO users VALUES ('$username', '$password')";4.
Code: Select all
return mysql_query($q,$conn);Any help would be greatly appreciated.
Spec36