Jump to content

Help with SQL table


Syrehn

Recommended Posts

Ok, I'm totally new to the php/mysql scene so bear with me.

 

I'm trying to install and test the following script:

 

http://www.michelhiemstra.nl/blog/igoogle-like-drag-drop-portal-v20/

 

 

In the comments it says that the SQL for creating the table and required fields is:

–
– Table structure for table `blocks`
–

CREATE TABLE `blocks` (
`unique_id` int(11) NOT NULL auto_increment,
`block_id` varchar(255) NOT NULL default ”,
`column_id` varchar(255) NOT NULL default ”,
`order_id` int(11) NOT NULL default ‘0′,
PRIMARY KEY (`unique_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

–
– Dumping data for table `blocks`
–

INSERT INTO `blocks` VALUES(1, ‘block-1′, ‘column-1′, 0);
INSERT INTO `blocks` VALUES(2, ‘block-3′, ‘column-2′, 0);
INSERT INTO `blocks` VALUES(3, ‘block-2′, ‘column-3′, 0);
INSERT INTO `blocks` VALUES(4, ‘block-4′, ‘column-2′, 1);

 

I'm not exactly sure how to add this and if I put it in a text file and try to import it I get errors.

 

I know I'm probably doing something very wrong.  Can anyone help?

Link to comment
https://forums.phpfreaks.com/topic/189908-help-with-sql-table/
Share on other sites

I am trying to test this on my local server first and yes I do have phpmyadmin v3.

 

So when I go to the database and click the sql tab it says run queries.  so if i copy all of the following code:

 

–
– Table structure for table `blocks`
–

CREATE TABLE `blocks` (
`unique_id` int(11) NOT NULL auto_increment,
`block_id` varchar(255) NOT NULL default ”,
`column_id` varchar(255) NOT NULL default ”,
`order_id` int(11) NOT NULL default ‘0′,
PRIMARY KEY (`unique_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

–
– Dumping data for table `blocks`
–

INSERT INTO `blocks` VALUES(1, ‘block-1′, ‘column-1′, 0);
INSERT INTO `blocks` VALUES(2, ‘block-3′, ‘column-2′, 0);
INSERT INTO `blocks` VALUES(3, ‘block-2′, ‘column-3′, 0);
INSERT INTO `blocks` VALUES(4, ‘block-4′, ‘column-2′, 1);

 

it generates the following errors:

 

Error

SQL query:

–– TABLE structure FOR TABLE `blocks` – CREATE TABLE `blocks` (
`unique_id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`block_id` varchar( 255 ) NOT NULL default”,
`column_id` varchar( 255 ) NOT NULL default”,
`order_id` int( 11 ) NOT NULL default‘0′,
PRIMARY KEY ( `unique_id` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =8;

MySQL said: Documentation
#1064 - 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 '–
– Table structure for table `blocks`
–

CREATE TABLE `blocks` (
`un' at line 1

 

I'm not exactly sure what that means or how to fix it.  Can anyone shed some light?

Link to comment
https://forums.phpfreaks.com/topic/189908-help-with-sql-table/#findComment-1002444
Share on other sites

That file looks like it was opened up (or created in) a Microsoft product, especially Word. That's where those inverted quotes come from all the time I've found.

 

What might help you is if you take the whole .sql file, copy and paste it to notepad (NOT word pad) and then save it as .txt or .sql, re-open it and try re-pasting into your browser.

 

I'm guessing that maybe you're doing all of this on a windows based system?

 

That can "wash" the script of the funny single and double quotes that could be hampering your script.

Link to comment
https://forums.phpfreaks.com/topic/189908-help-with-sql-table/#findComment-1004040
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.