obviousl
11-04-2004, 07:11 PM
Hey all,
I have made my first php posting to mysql script, but alas it's not working. Was wondering if you can pick out the problem:
this is my action.php :
<?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'username', 'password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('database') or die('Could not select database');
$tablename = table;
// Performing SQL posting
$result =mysql_query("INSERT INTO $tablename(
'gender','name','age','height','hair','eyes','from','city','suburb',
'type','sign','f.movie','f.music','f.food',
'message','seek','password','email') VALUES ('".$_POST["gender"]."',
'".$_POST["name"]."','".$_POST["age"]."',
'".$_POST["height"]."','".$_POST["hair"]."','".$_POST["eyes"]."',
'".$_POST["from"]."','".$_POST["city"]."','".$_POST["suburb"]."',
'".$_POST["type"]."','".$_POST["sign"]."',
'".$_POST["f.movie"]."','".$_POST["f.music"]."','".$_POST["f.food"]."',
'".$_POST["message"]."','".$_POST["seek"]."','".$_POST["password"]."',
'".$_POST["email"]."')");
// Closing SQL link
mysql_close($link);
echo 'Posted successfully';
?>
Any idea why this doesn't post any information to my database?
Cheers,
Chris
I have made my first php posting to mysql script, but alas it's not working. Was wondering if you can pick out the problem:
this is my action.php :
<?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'username', 'password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('database') or die('Could not select database');
$tablename = table;
// Performing SQL posting
$result =mysql_query("INSERT INTO $tablename(
'gender','name','age','height','hair','eyes','from','city','suburb',
'type','sign','f.movie','f.music','f.food',
'message','seek','password','email') VALUES ('".$_POST["gender"]."',
'".$_POST["name"]."','".$_POST["age"]."',
'".$_POST["height"]."','".$_POST["hair"]."','".$_POST["eyes"]."',
'".$_POST["from"]."','".$_POST["city"]."','".$_POST["suburb"]."',
'".$_POST["type"]."','".$_POST["sign"]."',
'".$_POST["f.movie"]."','".$_POST["f.music"]."','".$_POST["f.food"]."',
'".$_POST["message"]."','".$_POST["seek"]."','".$_POST["password"]."',
'".$_POST["email"]."')");
// Closing SQL link
mysql_close($link);
echo 'Posted successfully';
?>
Any idea why this doesn't post any information to my database?
Cheers,
Chris
