Well n not a mysql expert so i need help with this sql file here r d contents of it.


Quote:

CREATE TABLE `admin` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(255),
`password` varchar(255),
`webmaster_email` varchar(255),
`lastlogin` int(11),
PRIMARY KEY (`id`)
)";

"insert into admin set username='$admin_login',password='$admin_pass',web master_email='$admin_email'";


CREATE TABLE `admin_session` (
`admin_id` int(11) NOT NULL auto_increment,
`hash` varchar(255),
`timestamp` int(11),
`last_export` int(11),
PRIMARY KEY (`admin_id`)
)";

CREATE TABLE `admin_settings` (
`id` int(11) NOT NULL DEFAULT '0' ,
`help_url` varchar(255) ,
`email_from_name` varchar(255) ,
`email_subject` varchar(255) ,
`email_message` text ,
`paypal_email` varchar(255) ,
`stormpay_email` varchar(255) ,
`mailer_details` text ,
PRIMARY KEY (`id`)
)";

"insert into admin_settings set id='1'";

CREATE TABLE `automated_emails` (
`id` int(10) unsigned NOT NULL auto_increment,
`product_id` int(10) unsigned ,
`subject` varchar(255) ,
`message` text ,
`rank` tinyint(3) unsigned ,
`delay` int(11) ,
PRIMARY KEY (`id`)
)";


CREATE TABLE downloaded_products (
id INT (11) NOT NULL AUTO_INCREMENT, 
member_id INT (11), 
product_id INT (11), 
downloaded INT (11) DEFAULT '0', 
PRIMARY KEY(id)
)";


CREATE TABLE email_log (
`id` int(11) NOT NULL auto_increment,
`member_id` int(11) ,
`product_id` int(11) ,
`email_id` int(11) ,
`last_send` int(11) ,
PRIMARY KEY (`id`)
)";
$db->insert($q);


CREATE TABLE `emails` (
id int(11) unsigned NOT NULL auto_increment,
type varchar(255) ,
subject varchar(255) ,
message text ,
from_name varchar(255) ,
from_email varchar(255) ,
PRIMARY KEY (id)
)";

"INSERT INTO emails VALUES (1, 'Email sent to first time users after payment', 'Welcome', 'Dear {firstname} {lastname}, \r\n\r\nThank You! for joining our site.\r\n\r\nNow you can start advertising and earn instantly for each sale you bring to us.\r\n\r\nYour Details,\r\n\r\nEmail : {email}\r\n\r\nUsername : {username}\r\n\r\nPassword : {password}\r\n\r\nFirst Name: {firstname}\r\n\r\nLast Name: {lastname}\r\n\r\nStormpay Email: {stormpay_email}\r\n\r\nPaypal Email: {paypal_email}\r\n\r\n\r\n\r\nThank you.\r\n\r\nAdmin', '', '')";


"INSERT INTO emails VALUES (2, 'Email sent to affiliates whenever a payment for a sale is made to them', 'You have got a Affiliate Sale', 'Dear {firstname}{lastname},\r\n\r\nYou have received a commission for one of your affilite products in HIT-Pro-Software.com.\r\n\r\nProduct Name : {product_name}\r\n\r\nYou Earned: ${ref_commission} \r\n\r\n\r\nLogin for more details.\r\n\r\nThank You!\r\nAdmin', '', '')";

"INSERT INTO emails VALUES (3, 'Email sent to admin whenever a payment/sale is made', 'A Sale Made', 'Dear Admin,\r\n\r\nA sale has been made.\r\n\r\nProduct Name : {product_name}\r\nProduct Cost : ${product_price}\r\n \r\nAffiliate Name: {firstname} {lastname}\r\nAffiliate Commission : ${ref_commission} \r\n\r\nYour Earning : ${admin_income}\r\n\r\nLogin for more details.\r\n\r\nThank You!\r\nAdmin', '', '')";

"INSERT INTO emails VALUES (4, 'Email sent to existing users after they purchase any other new products', 'Thank you for your purchase', 'Dear {firstname}{lastname},\r\n\r\nThank you for purchasing.\r\n\r\nProduct Name : {product_name}\r\n\r\nProduct Cost : ${product_price}\r\n\r\n\r\nThank You for your support!\r\nAdmin\r\n', '', '')";



CREATE TABLE marketing_banners (
`id` int(11) NOT NULL auto_increment,
`product_id` int(11) ,
`banner_url` varchar(255) ,
`banner_image` varchar(255) ,
PRIMARY KEY (`id`)
)";


CREATE TABLE marketing_emails (
`id` int(11) NOT NULL auto_increment,
`product_id` int(11) ,
`subject` varchar(255) ,
`message` text ,
PRIMARY KEY (`id`)
)";



CREATE TABLE mass_email (
id int(11) NOT NULL auto_increment,
subject varchar(255) ,
message text ,
from_name varchar(255) ,
from_email varchar(255) ,
mid text ,
PRIMARY KEY (id)
)";


CREATE TABLE `member_products` (
`id` int(11) NOT NULL auto_increment,
`member_id` int(11) ,
`product_id` int(11) ,
`date_added` date , 
PRIMARY KEY (`id`)
)";



CREATE TABLE member_session (
`member_id` int(11) NOT NULL DEFAULT '0' ,
`hash` varchar(255) NOT NULL DEFAULT '' ,
`time` int(11) NOT NULL DEFAULT '0' 
)";


CREATE TABLE `members` (
`id` int(11) NOT NULL auto_increment,
`firstname` varchar(255) ,
`lastname` varchar(255) ,
`email` varchar(255) NOT NULL DEFAULT '' ,
`username` varchar(255) NOT NULL DEFAULT '' ,
`password` varchar(255) ,
`paypal_email` varchar(255) ,
`stormpay_email` varchar(255) ,
`ip` varchar(255) ,
`date_joined` datetime DEFAULT '0000-00-00 00:00:00' ,
`status` int(11) DEFAULT '0' ,
`referrer_url` varchar(255) ,
`last_login` int(11) ,
`mailing` int(11) DEFAULT '1' ,
`randomstring` varchar(100) ,
PRIMARY KEY (id)
)";


CREATE TABLE `orders` (
`id` int(11) NOT NULL auto_increment,
`member_id` int(11) DEFAULT '0' ,
`product_id` int(11) NOT NULL DEFAULT '0' ,
`payment_type` int(11) ,
`visitor_id` int(11) ,
`paid` int(11) DEFAULT '0' ,
PRIMARY KEY (`id`)
)";


CREATE TABLE products (
`id` int(11) NOT NULL auto_increment,
`product_name` varchar(255) ,
`product_shortname` varchar(255) ,
`price` decimal(15,2) ,
`commission` decimal(15,2) ,
`pay_referrer_first` int(11) DEFAULT '0' ,
`date_added` datetime DEFAULT '0000-00-00 00:00:00' ,
`template_page` text ,
`download_link` varchar(255) ,
`membership_form` text ,
`show_affiliate_url` int(11) ,
`rank` int(11) ,
PRIMARY KEY (`id`)
)";


CREATE TABLE transaction (
`id` int(11) NOT NULL auto_increment,
`order_id` int(11) ,
`transaction_id` varchar(100) ,
`from_email` varchar(255) ,
`to_email` varchar(255) ,
`amount` double ,
`to_admin` int(11) DEFAULT '1' ,
PRIMARY KEY (`id`)
)";


CREATE TABLE visitor_stats (
`id` int(11) NOT NULL auto_increment,
`visited_date` date NOT NULL DEFAULT '0000-00-00' ,
`product_id` int(11) ,
`referrer` int(11) DEFAULT '0' ,
`ip` varchar(255) ,
`randomstring` varchar(255) ,
`order_placed` int(11) DEFAULT '0' ,
PRIMARY KEY (`id`)
)";



CREATE TABLE ipn_args (
id int(11) NOT NULL auto_increment,
randomstring varchar(255) ,
mrand varchar(50) DEFAULT '0' ,
returnrand varchar(50) ,
PRIMARY KEY (id)
)";  

Here is the error i get wen i import the sql file!

Quote:
Error
SQL query: 

CREATE TABLE `admin` (

`id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`username` varchar( 255 ) ,
`password` varchar( 255 ) ,
`webmaster_email` varchar( 255 ) ,
`lastlogin` int( 11 ) ,
PRIMARY KEY ( `id` ) 
) ";

" INSERT INTO admin
SET username = '$admin_login',
PASSWORD = '$admin_pass',
webmaster_email = '$admin_email' ";


CREATE TABLE `admin_session` (
`admin_id` int(11) NOT NULL auto_increment,
`hash` varchar(255),
`timestamp` int(11),
`last_export` int(11),
PRIMARY KEY (`admin_id`)
)";

MySQL said:

#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 '";

"insert into admin set username='$admin_login',password='$admin_pass',web m' at line 8


__________________

Recommended Answers

All 4 Replies

I suggest that you try one section at a time for starters. Also, your sintax should not have " around things except for literals. Each statement should not end with one.

Try to execute sub queries seperately and check out for the syntax ,it might work out then

Well n not a mysql expert so i need help with this sql file here r d contents of it.

Quote:

CREATE TABLE `admin` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(255),
`password` varchar(255),
`webmaster_email` varchar(255),
`lastlogin` int(11),
PRIMARY KEY (`id`)
)";

"insert into admin set username='$admin_login',password='$admin_pass',web_master_email='$admin_email'";

Maybe your field name is wrong ..

In addition to above suggesstions:
If you are executing this file using mysql or source commands, then you have to use the values instead of PHP variables e.g.

"insert into admin set username='$admin_login',password='$admin_pass',web master_email='$admin_email'";

Should be

insert into admin set username='some admin login',password='password here',web master_email='email@example.com';
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.