Forum Replies Created
-
AuthorPosts
-
chimpMemberpeterlaursen wrote on Oct 6 2007, 07:50 PM:please try to understand the example
CREATE TABLE `tablename1` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`t` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
and compare the two insert statements
insert into table tablename1 (id,t) values ('','tt');
insert into table tablename1 (t) values ('tt');
First statement inserts an (empty) string in the INT column – Last statement simply OMITS the auto-increment column as well in the COLUMNs-list as the DATA-listing. Then the server will handle it!
o.k. i took out (id) and (“”) out of insert statement.
should i have in the table creation a default value for “id” column? if so do i start at the number one:1
should i take out of .php file the $id=$post_id
sorry to be such a dunce .. but coding in php and mysql is totally new to me. i do appreciate your help but i don't want u to have a stroke dealing with me.
when i run the php file now i get the following error code:Column count doesn't match value count at row 1
is that because i left in the $id_$post_id statement?
i'm not giving up till i conquer this
chimpMemberpeterlaursen wrote on Oct 6 2007, 12:06 PM:If `id`is a (TINY)INT it may (depending on the server version and the server settings) cause an error 1064 (syntax error) to try to store a STRING in it. Because basically a NUMBER cannot be a STRING!If the column is autoincrement, just omit that column in the INSERT statement – the server will take care of inserting into the column automatically.
In my exampe `t` was only the name/identifier of a column.
yes the id column is auto increment so i should just remove it from the insert statement and leave “” the empty value in the value statement. is that correct?
chimpMemberpeterlaursen wrote on Oct 5 2007, 08:12 PM:I think the issue might be that you are inserting a '' (empty string) into an integer field! Depending on the server sql_mode inserting a string to an integer filed may raise an error or a warning!What is the MySQL version?
What does “select @@global.sql_mode” return?
with the table definition
CREATE TABLE `tablename1` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`t` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
try this
insert into table tablename1 (id,t) values ('','tt');
— and you'll get the 1064 error in 'strict mode' with MySQL 5 and 6, but
insert into table tablename (t) values ('tt'); — is OK!
i wonder if u could be clearer for a real newbie. i have 'id' as a tinyint and not sure what 't' stands for.
its mysql5
do i just type into enterprise version select as u have it and run it?
can i modify table columns in enterprise .. if so how?
sorry to be such a newbie but ones got to start somewhere.
what is error 1064? the one i'm getting?
chimpMemberchimp wrote on Oct 5 2007, 07:08 PM:i added $id=$POST['id']; and i still get the same count error. i fixed up the typos also.here's my code as it is now.
$id=$_POST['id'];
$space=$_POST['space'];
$space2=$_POST['space2'];
$music=$_POST['music'];
$music2=$_POST['music2'];
$slichot=$_POST['slichot'];
$rh=$_POST['rh'];
$tash=$_POST['tash'];
$yomk=$_POST['yomk'];
$succot=$_POST['succot'];
$simhat=$_POST['simhat'];
$hhbest=$_POST['hhbest'];
$least=$_POST['least'];
$attend=$_POST['attend'];
$shabbatattend=$_POST['shabbatattend'];
$membership=$_POST['membership'];
$query = “INSERT INTO `worshipspace` (`id`,`space`,`space2`,`music`,`music2`,`slichot`,`rh`, `tash`,`yomk`,`succot`,`simhat`,`hhbest`,`least`,` attend`,`shabbatattend`,`membership`) VALUES('','{$space}','{$space2}','{$music}''{$music2}','{$slichot}','{$rh}','{$tash}','{$yomk}','{$succot}','{$simhat}','{$hhbest}','{$least}','{$attend}',' {$shabbatattend}','{$membership}')”;
mysql_query($query) or die(mysql_error());
if (mysql_query($query)){
if u see anything incorrect (i hope) 😕 i'm hoping u can set me clear on it/them.
thanks
chimpMemberchimp wrote on Oct 5 2007, 06:34 PM:i see i made a couple of typos with . instead of comma and dbl qoutes instead of single. so i fixed and ran and now i get the odourous message:Column count doesn't match value count at row 1
so here's the php code: do i need to insert a row for column id?? i will try it as when i search for that error code it tells me that i need one more $ statement ..at least that's what i think ..being a newbie.
$space=$_POST['space'];
$space2=$_POST['space2'];
$music=$_POST['music'];
$music2=$_POST['music2'];
$slichot=$_POST['slichot'];
$rh=$_POST['rh'];
$tash=$_POST['tash'];
$yomk=$_POST['yomk'];
$succot=$_POST['succot'];
$simhat=$_POST['simhat'];
$hhbest=$_POST['hhbest'];
$least=$_POST['least'];
$attend=$_POST['attend'];
$shabbatattend=$_POST['shabbatattend'];
$membership=$_POST['membership'];
i added $id=$POST['id']; and i still get the same count error. i fixed up the typos also.
chimpMemberchimp wrote on Oct 5 2007, 05:15 PM:here's what my insert statement:$query = “INSERT INTO `worshipspace` (`id`.`space`,`space2`,`music`,`music2`,`slichot`,`rh`, `tash`,`yomk`,`succot`,`simhat`,`hhbest`,`least`,` attend`,`shabbatattend`,`membership` ) VALUES('',{$space}','{$space2}','{$music}''{$music2} ','{$slichot}','{$rh}''{$tash}','{$yomk}','{$succot}''{$simhat}','{$hhbest}','{$least}''{$attend}',' {$shabbatattend}','{$membership}')”;i see i made a couple of typos with . instead of comma and dbl qoutes instead of single. so i fixed and ran and now i get the odourous message:
Column count doesn't match value count at row 1
so here's the php code: do i need to insert a row for column id?? i will try it as when i search for that error code it tells me that i need one more $ statement ..at least that's what i think ..being a newbie.
$space=$_POST['space'];
$space2=$_POST['space2'];
$music=$_POST['music'];
$music2=$_POST['music2'];
$slichot=$_POST['slichot'];
$rh=$_POST['rh'];
$tash=$_POST['tash'];
$yomk=$_POST['yomk'];
$succot=$_POST['succot'];
$simhat=$_POST['simhat'];
$hhbest=$_POST['hhbest'];
$least=$_POST['least'];
$attend=$_POST['attend'];
$shabbatattend=$_POST['shabbatattend'];
$membership=$_POST['membership'];
chimpMemberchimp wrote on Oct 5 2007, 05:11 PM:in fact it is a web page form that has its results sent to a php file processform. that's what's generating the error. but perhaps my table columns aren't set up correctly .. i have 4 textareas in the form. in my table i've made them varchar and each has a different default text. i guess what i'm asking if these columns should be “text” types? and do they need default text inserted in the table column which i created?i hope this is clear, the error code is as follows:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=”1″','i think it was good','3''I felt good ','=”1″','2''3',
not sure what u mean by escaping??
but thanks for your interest.
here's what my insert statement:$query = “INSERT INTO `worshipspace` (`id`.`space`,`space2`,`music`,`music2`,`slichot`,`rh`, `tash`,`yomk`,`succot`,`simhat`,`hhbest`,`least`,` attend`,`shabbatattend`,`membership` ) VALUES('',{$space}','{$space2}','{$music}''{$music2} ','{$slichot}','{$rh}''{$tash}','{$yomk}','{$succot}''{$simhat}','{$hhbest}','{$least}''{$attend}',' {$shabbatattend}','{$membership}')”;
chimpMemberpeterlaursen wrote on Oct 5 2007, 03:31 PM:I do not fully understand your last post!But I think I understand it is an issue with a (webpage)form and not SQLyog, that you are describing?
Can you paste the SQL statement generated and tell what you want to insert (literally – without escaping)?
in fact it is a web page form that has its results sent to a php file processform. that's what's generating the error. but perhaps my table columns aren't set up correctly .. i have 4 textareas in the form. in my table i've made them varchar and each has a different default text. i guess what i'm asking if these columns should be “text” types? and do they need default text inserted in the table column which i created?
i hope this is clear, the error code is as follows:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=”1″','i think it was good','3''I felt good ','=”1″','2''3',
not sure what u mean by escaping??
but thanks for your interest.
chimpMemberpeterlaursen wrote on Oct 4 2007, 08:10 PM:When you are building a table in SQlyog you must have been connected to some MySQL server. SQLyog is a MySQL client and without conection to a MySQL server it is not able to do anything!There is nothing to 'upload'. What you created in SQLyog is stored on the server.
However if you have been connected to a local server (and stored the table here) and want to transfer data to a remote server there are several options:
1) table menu .. 'copy to other' (you must be connected to both servers)
2) Powertools .. DATA sync (ENTERPRISE only FEATURE)
3) export from local server and import on the remote server (if server versions are different this is not always so easy!)
thanks i checked the mysql admin and my table was created. thanks again ..duh on me.
now when i run my process form i get the following error :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=”1″','i think i that a cube formation would be better than a
my code in the questionnaire is as follows.
in the table in mysql i have a default of “I think” is that incorrect …i.e. there shouldn't be a default??
if u can help i sure would be appreciative .. i'm doing this db as a volunteer and am not paid except that i'm learning new tools.
thanks.
-
AuthorPosts