Mysql problems
am 18.03.2011 07:37:13 von Bas Caminada--Apple-Mail-2-486341
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Hi,
I am trying to build a CMS with info about clients, jobs in production =
etc etc.
Got the database running perfectly. Created tables for Contact details =
and i can enter and pull data from the table.
How ever created a table to store usernames and passwords but when =
trying to INSERT INTO this table i keep on getting=20
the error :
Error: Unknown column 'passwd' in 'field list'
I tried this first from the command line in mysql and retried this by =
creating and running 2 php files, one to create the Table and the second =
to insert
data into it. But no luck.=20
Can anyone point me in the right directions, could this be a Mysql =
database problem.
Regards,
Bas
TABLE CREATION:
$con =3D mysql_connect("localhost","libra","visionairy");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("contacts", $con);
$sql=3D'CREATE TABLE `members` (
`member_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`firstname` varchar(100) default NULL,
`lastname` varchar(100) default NULL,
`login` varchar(100) NOT NULL default ",
`passwd` varchar(32) NOT NULL default ",
PRIMARY KEY (`member_id`)
) TYPE=3DMyISAM';
mysql_query ($sql,$con);
mysql_close($con)
?>=20
INSERT DATA INTO:
$con =3D mysql_connect("localhost","libra","visionairy");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("contacts", $con);
$sql=3D"INSERT INTO members (member_id, firstname, lastname, login, =
passwd)
VALUES (`1`, `Jatinder`, `Thind`, `phpsense`, =
`ta018360fc26eodd2e929b8e77f052d`)";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>=20
--Apple-Mail-2-486341--