PHP/mySQL question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Binulead
Forum Newbie
Posts: 1
Joined: Sat Nov 23, 2002 12:17 pm

PHP/mySQL question

Post by Binulead »

What I'm trying to do:
When you enter information into a form and send it, the I want the "action" script to input the form content into a mySQL database, using variables

Here's the script:

// Create the user
//-----------
echo("Attempting to create the user data[br]");
//-----------
$crtuser = 'INSERT INTO `binupoll_user` (`name`, `pass`) VALUES ($uname, $upass);';


$crtusrmysql = mysql_db_query($db, $crtuser);
if( $crtusrmysql == true )
{
echo("[img src='images/green.gif'] Created user info[br]");
}
else
{
echo("[img src='images/red.gif'] Failed to create user info[br]");
}

//-------

The $uname and $upass variables contain the information from the form input areas uname and upass. When I run the script, instead of it inputting the information in the variables, it inputs the test $uname and $upass into the database.

Thanks for any help,
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

in-string replacement only takes place in double quoted stringliterals.
http://www.php.net/manual/en/language.types.string.php
Post Reply