Flumps
10-06-2008, 04:21 PM
<?php
$con = mysql_connect("localhost","shcvnet_simon","bombfire101");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("shcvnet_shcv", $con);
$sql="INSERT INTO phoneList (firstName, lastName, email, phone)
VALUES
('$_POST[firstName]','$_POST[lastName]','$_POST[email]','$_POST[phone]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
error im getting is No database selected.
the database name is correct ive checked it 101 times.
I can establish a connection fine ive tested that bit of the code too so I know the username and password are fine.
any ideas?
im uploading from a form.
$con = mysql_connect("localhost","shcvnet_simon","bombfire101");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("shcvnet_shcv", $con);
$sql="INSERT INTO phoneList (firstName, lastName, email, phone)
VALUES
('$_POST[firstName]','$_POST[lastName]','$_POST[email]','$_POST[phone]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
error im getting is No database selected.
the database name is correct ive checked it 101 times.
I can establish a connection fine ive tested that bit of the code too so I know the username and password are fine.
any ideas?
im uploading from a form.
