php-windows Digest 18 Mar 2011 07:02:10 -0000 Issue 3927

Topics (messages 30533 through 30533):

Mysql problems
        30533 by: Bas Caminada

Administrivia:

To subscribe to the digest, e-mail:
        php-windows-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-windows-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-wind...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
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 
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. 

Can anyone point me in the right directions, could this be a Mysql database 
problem.

Regards,

Bas
TABLE CREATION:

<?php

$con = mysql_connect("localhost","libra","visionairy");

if (!$con)  {

  die('Could not connect: ' . mysql_error());

  }

mysql_select_db("contacts", $con);

$sql='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=MyISAM';

mysql_query ($sql,$con);



mysql_close($con)

?> 


INSERT DATA INTO:

<?php
$con = mysql_connect("localhost","libra","visionairy");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("contacts", $con);

$sql="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)
?> 





--- End Message ---

Reply via email to