Reply
Doesn't input any data
Old 07-20-2007, 10:01 PM Doesn't input any data
Skilled Talker

Posts: 99
Can someone tell me why the query is not successful!!!

PHP Code:
<?php
$username 
$_POST["username"];
$password $_POST["password"];

$con mysql_connect("localhost","root","blah");
if (!
$con)
    {
    die(
'Could not connect: ' mysql_error());
    }

mysql_select_db("test"$con);

$sql "INSERT INTO names (username, password)
VALUES ("
$username","$password")";

if (!
mysql_query($sql,$con))
    {
    die(
'Error: ' mysql_error());
    }
echo 
"1 record added";

mysql_close($con)
?>

Last edited by Arez20469 : 07-20-2007 at 10:03 PM.
Arez20469 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 07-20-2007, 10:44 PM Re: Doesn't input any data
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
What's the error message you're getting?
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 08-07-2007, 03:06 PM Re: Doesn't input any data
Skilled Talker

Posts: 91
$sql = "INSERT INTO names (username, password)
VALUES ("
$username","$password")";

change " by ' and try again ==>
VALUES ('$username','$password')
Falcone is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Doesn't input any data
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12211 seconds with 12 queries