homepage Welcome to WebmasterWorld Guest from 54.198.94.76
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Incorrect column specifier for column
SToRMBaNLeaDeR




msg:4284799
 10:54 pm on Mar 20, 2011 (gmt 0)

Same problem as this person: [webmasterworld.com ]

[edited by: eelixduppy at 3:36 am (utc) on Mar 21, 2011]

 

SToRMBaNLeaDeR




msg:4284804
 11:02 pm on Mar 20, 2011 (gmt 0)

</form><form method="post" action="Process
.php">two points of the last name
<input type="text" size="10" maxlength="40" name="lastname" /><br />two points of the name
<input type="text" size="10" maxlength="40" name="name" /><br />two points of the type
<input type="radio" name="Sex" value="Man">Man
<input type="radio" name="Sex" value="Donna">Donna
<br />two points of the email of the address
<input type="text" size="10" maxlength="40" name="electronicmailaddress" /><br />both points of the ignited commentary
<input type="text" size="10" maxlength="40" name="Commentaries" /><br /><input type="submit" value="it transmits
" /></form>

SToRMBaNLeaDeR




msg:4284805
 11:03 pm on Mar 20, 2011 (gmt 0)

<?php
// make a mysql connection
mysql_connect("","","") or die(mysql_error());
mysql_select_db("stormban_Guestbook") or die(mysql_error());

//insert a row of information into the table "stormbanGuestbook"
mysql_query("INSERT INTO stormban_Guestbook
(lastname) values()")
or die(mysql_error());

mysql_query("INSERT INTO stormban_Guestbook
(name) values()")
or die(mysql_error());

mysql_query("INSERT INTO stormban_Guestbook
(Sex) values()")
or die(mysql_error());

mysql_query("INSERT INTO stormban_Guestbook
(electronicmailaddress) values()")
or die(mysql_error());

mysql_query("INSERT INTO stormban_Guestbook
(Commentaries) values()")
or die(mysql_error());?>

SToRMBaNLeaDeR




msg:4284808
 11:06 pm on Mar 20, 2011 (gmt 0)

[img217.imageshack.us ]

SToRMBaNLeaDeR




msg:4284810
 11:07 pm on Mar 20, 2011 (gmt 0)

Table 'stormban_Guestbook.stormban_Guestbook' doesn't exist

sonjay




msg:4284863
 1:43 am on Mar 21, 2011 (gmt 0)

Does the table stormban_Guestbook actually exist?

Is the table named stormban_Guestbook or stormbanGuestbook?

SToRMBaNLeaDeR




msg:4284877
 2:32 am on Mar 21, 2011 (gmt 0)

other than that did you see any errors with the code

SToRMBaNLeaDeR




msg:4284885
 2:50 am on Mar 21, 2011 (gmt 0)

we could possibly do a screen share and you can help me

rocknbil




msg:4285146
 4:44 pm on Mar 21, 2011 (gmt 0)

Look at your phpMyAdmin header in the image.

localhost->stormban_Guestbook->lastname

Your database is named stormban_Guestbook, and your table is named lastname.

Next, when you insert into anything but an integer type field - date/datetime, varchar, char, text, etc - it must be quoted.

So the first query should be like this. Make it a habit to store your queries in a variable, far easier to manage and debug.

// Note the empty single quotes - see next examples
$query = "INSERT INTO lastname (lastname) values('')";
mysql_query("$query") or die(mysql_error());

Next, you won't have to do four queries for the four columns. Do them all at once.

$query = "INSERT INTO lastname (lastname,name,Sex,electronicmailaddress,Commentaries) values('Doe','John Doe','this@examples.com','This is a comment. I love comments.')";

For your reference (shouldn't be necessary, but might help you understand your database structure), the "full table syntax" would be

$query = "INSERT INTO stormban_Guestbook`.`lastname` (
stormban_Guestbook`.`lastname`.`lastname`,
stormban_Guestbook`.`lastname`.`name`,
stormban_Guestbook`.`lastname`.`Sex`,
stormban_Guestbook`.`lastname`.`electronicmailaddress`,
stormban_Guestbook`.`lastname`.`Commentaries`
) values(
'Doe',
'John Doe',
'this@examples.com',
'This is a comment. I love comments.'
)";

The other advantages of storing selects in strings, you can put them on multiple lines to sort out any errors you might encounter.

The backticks are only necessary if you use table or field names that conflict with internal functions or reserved words such as time, date, etc . . .

SToRMBaNLeaDeR




msg:4285183
 5:42 pm on Mar 21, 2011 (gmt 0)

did not work

SToRMBaNLeaDeR




msg:4285189
 5:54 pm on Mar 21, 2011 (gmt 0)

<?php
// make a mysql connection
mysql_connect("","stormban_storm","password123") or die(mysql_error());
mysql_select_db("stormban_Guestbook") or die(mysql_error());

//insert a row of information into the table "stormbanGuestbook"
$lastname=$_POST['lastname'];
$name=$_POST['name'];
$Sex=$_POST['Sex'];
$electronicmailaddress=$_POST['electronicmailaddress'];
$Commentaries=$_POST['Commentaries'];

$sql="INSERT INTO $Identificatore(lastname, name, Sex, electronicmailaddress, Commentaries)VALUES('$lastname', '$name', '$Sex', '$electronicmailaddress', '$Commentaries')";
$result=mysql_query($sql);

if($result){
echo "successful";
echo "<br />";
echo "<a href=''></a>";
}

else {
echo "error";
}

mysql_close();

?>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved