Welcome to WebmasterWorld Guest from 23.20.137.66

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Incorrect column specifier for column

     
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]

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>
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());?>
11:06 pm on Mar 20, 2011 (gmt 0)
11:07 pm on Mar 20, 2011 (gmt 0)



Table 'stormban_Guestbook.stormban_Guestbook' doesn't exist
1:43 am on Mar 21, 2011 (gmt 0)

10+ Year Member



Does the table stormban_Guestbook actually exist?

Is the table named stormban_Guestbook or stormbanGuestbook?
2:32 am on Mar 21, 2011 (gmt 0)



other than that did you see any errors with the code
2:50 am on Mar 21, 2011 (gmt 0)



we could possibly do a screen share and you can help me
4:44 pm on Mar 21, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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 . . .
5:42 pm on Mar 21, 2011 (gmt 0)



did not work
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();

?>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month