why is this mysql query not working on the server - php

this code tested with both server and local phpmyadmin
on localhost it returned results as expected
on server it returned a good result but when passing the dr_name it returns empty result
here is the code:
SELECT * FROM doctor WHERE dr_name LIKE '%غا%' AND specialization=12 AND state=6
the only deference between server and local is that the server mysql engine is myisam and innodb on localhost
this is the create table statement:
CREATE TABLE IF NOT EXISTS `doctor` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dr_name` varchar(65) NOT NULL,
`dr_name_e` varchar(65) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`unique_name` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`pass` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`nickname` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`specialization` int(11) NOT NULL,
`state` tinyint(4) NOT NULL,
`scientific_degree` int(11) DEFAULT NULL,
`university` int(11) DEFAULT NULL,
`grad_year` smallint(6) DEFAULT NULL,
`show_degree` tinyint(1) DEFAULT NULL,
`show_univ` tinyint(1) DEFAULT NULL,
`show_grad_year` tinyint(1) DEFAULT NULL,
`appendices` varchar(1000) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`picture` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '0',
`views` bigint(20) DEFAULT '0',
`search_result` bigint(20) DEFAULT '0',
`gender_male` tinyint(1) DEFAULT NULL,
`agent` int(11) DEFAULT NULL,
`next_step` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_name` (`unique_name`),
KEY `university` (`university`),
KEY `scientific_degree` (`scientific_degree`),
KEY `specialization` (`specialization`),
KEY `agent` (`agent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;

Related

How to handle increasing data over time in MySQL and PHP [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a list of contents on my website and it is getting filled with records rapidly, for example after one month, there are 300K records in it. Because of this, the list page is responding slower and slower over time.
This page has this functionalities:
Searching
Paging
Also this table Left Joins other tables and it increases the run-time.
I run two queries every time this page is loaded, one for getting 10 limited records, and the other for getting number of all records.
How do I handle this amount of data with out jeopardizing user experience?
EDIT
Here is my Query:
SELECT *,
`note`.`attached_file` AS `attached_file`,
`note`.`description` AS `description`,
`note`.`id` AS `id`,
`note_type`.`title` AS `title`,
`note_goal`.`title` AS `goal`
FROM `note`
LEFT JOIN `contact` ON `note`.`id_contact`=`contact`.`id`
LEFT JOIN `contact_activity_field` ON `contact_activity_field`.`id_contact`=`contact`.`id`
LEFT JOIN `activity` ON `contact_activity_field`.`id_activity`=`activity`.`id`
LEFT JOIN `note_type` ON `note`.`title`=`note_type`.`id`
LEFT JOIN `note_goal` ON `note`.`goal`=`note_goal`.`id`
WHERE
( `note_type`.`title` LIKE '%$q%' OR
`firstname_eng` LIKE '%$q%' OR
`lastname_eng` LIKE '%$q%' OR
`firstname_per` LIKE '%$q%' OR
`lastname_per` LIKE '%$q%' OR
`company_name` LIKE '%$q%' OR
`company_name_per` LIKE '%$q%' OR
`description` LIKE '%$q%' OR
`note_goal`.`title` LIKE '%$q%' ) AND some other condition
GROUP BY `note`.`id`
ORDER BY `note`.`id` DESC
LIMIT $start_from, 10
EDIT 2
note table
CREATE TABLE `note` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`id_user` int(10) NOT NULL,
`id_contact` int(10) NOT NULL,
`title` int(10) DEFAULT NULL,
`goal` int(10) DEFAULT NULL,
`register_date` date DEFAULT NULL,
`description` text COLLATE utf8_unicode_ci,
`attached_file` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`meeting_place` text COLLATE utf8_unicode_ci,
`start_time` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`finish_time` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3297 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
contact table
CREATE TABLE `contact` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_user` int(10) NOT NULL DEFAULT '0',
`id_user_registered` int(10) DEFAULT NULL,
`code` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`contact_type` varchar(20) COLLATE utf8_unicode_ci DEFAULT 'legal',
`firstname_eng` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`lastname_eng` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`firstname_per` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`lastname_per` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`gender` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`id_number` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`national_code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`birth_date` date DEFAULT NULL,
`company_name` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_name_per` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`recommender_eng` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`recommender_per` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`company_type` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`registration_type` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`registration_date` date DEFAULT '1900-01-01',
`registration_number` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`national_id` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`economic_code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`website` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`postal_code` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`address_eng` text COLLATE utf8_unicode_ci,
`address_per` text COLLATE utf8_unicode_ci,
`phone_number` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`fax` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
`activity_comment` text COLLATE utf8_unicode_ci,
`level` varchar(50) COLLATE utf8_unicode_ci DEFAULT 'Basic',
`guild` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
`verify_comment` text COLLATE utf8_unicode_ci,
`status` int(1) NOT NULL DEFAULT '0',
`comment` text COLLATE utf8_unicode_ci,
`submitted` int(1) NOT NULL DEFAULT '0',
`assign_date` datetime DEFAULT NULL,
`created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=57357 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
And other tables just contain a simple id and title records.
Here is the result of EXPLAIN query:
These results are on my local database.
LIKE with a leading wild card is inefficient -- and will scan the entire table, hence the "slower as it gets bigger". Switch to FULLTEXT.
Pagination via OFFSET is inefficient because it must scan all the rows befoer the few desired. See http://mysql.rjweb.org/doc.php/pagination
Both of these have been discussed on stackoverflow repeatedly. Search for other discussions.

execute sql query in php doesn't work ,but the query work in phpmyadmin

i have my database sql query file and i wanna run it in php by the code below
$query = file_get_contents('./sqlquery.txt');
print $query;
$conn->query($query);
but it return this 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 'CREATE TABLE IF NOT EXISTS `ads` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ur' at line 2
i copied the print output in to the phpmyadmin and everything work well, what's wrong here?
my sql query is the this
DROP TABLE IF EXISTS `ads`;
CREATE TABLE IF NOT EXISTS `ads` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`url` varchar(300) NOT NULL,
`path` varchar(200) NOT NULL,
`width` int(11) NOT NULL,
`height` int(11) NOT NULL,
`priority` int(11) NOT NULL,
`adsalter` varchar(200) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`adstitle` varchar(200) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
DROP TABLE IF EXISTS `comment`;
CREATE TABLE IF NOT EXISTS `comment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(120) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`comment` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`contentid` int(11) NOT NULL,
`parentid` int(11) NOT NULL DEFAULT '0',
`date` varchar(250) NOT NULL,
`haschild` int(1) NOT NULL DEFAULT '0',
`visible` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
DROP TABLE IF EXISTS `files`;
CREATE TABLE IF NOT EXISTS `files` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
`size` int(14) NOT NULL,
`type` varchar(50) NOT NULL,
`newsid` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
DROP TABLE IF EXISTS `frgpss`;
CREATE TABLE IF NOT EXISTS `frgpss` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(100) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`ip` varchar(31) CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL,
`token` varchar(27) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`date` int(15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `news`;
CREATE TABLE IF NOT EXISTS `news` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`titrimage` varchar(100) NOT NULL,
`titr` varchar(100) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`titralter` varchar(160) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`newsshurt` varchar(200) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`text` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`keywords` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`description` text CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`author` varchar(200) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`branch` int(11) NOT NULL,
`date` varchar(160) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
`visible` int(1) NOT NULL DEFAULT '0',
`visited` int(11) NOT NULL DEFAULT '0',
`titrtitle` varchar(200) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
DROP TABLE IF EXISTS `signup`;
CREATE TABLE IF NOT EXISTS `signup` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`family` varchar(50) NOT NULL,
`email` varchar(80) NOT NULL,
`gender` varchar(50) NOT NULL,
`username` varchar(80) NOT NULL,
`picture` varchar(80) NOT NULL,
`password` varchar(60) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(60) NOT NULL,
`lastname` varchar(60) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(40) NOT NULL,
`userregistereddate` varchar(60) NOT NULL,
`key` varchar(60) NOT NULL,
`type` varchar(20) NOT NULL,
`userphoto` varchar(50) NOT NULL,
`usergroup` varchar(300) NOT NULL,
`ipaddress` text NOT NULL,
`telnumber` varchar(14) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
you're executing multiple queries here, it won't work simply, I'm pretty sure that in query function($conn->query($query);) you're using mysql_query() or mysqli_query(), but you'll have to do is to use mysqli_multi_query() instead. Have a look here at docx
$con = mysqli_connect($host, $user, $pass, $db) OR die(mysqli_error($con));
$query = file_get_contents('./sqlquery.txt');
mysqli_multi_query($con, $query);
mysqli_close($con);
Hope this will help you
Note: Assuming that all queries are working fine while executing in PHPMyAdmin.

Covering Index and two tables in mysql

I've got two tables (NewProducts and OldProducts) that are being compared. NewProducts has about 68,000 records and OldProducts about 51,000. I'm using a covering index on each table, however the query is taking 20 minutes to execute, so I'm not using it properly. Does a covering index really apply with multiple tables? What am I doing wrong? Thank you.
Here is my query code and the indexes:
$querystring = "SELECT newProducts.Id, newProducts.SKU,
newProducts.Title, oldProducts.Title, oldProducts.product_Id
FROM
newProducts, oldProducts
WHERE
trim(newProducts.SKU)=trim(oldProducts.SKU) and
trim(newProducts.Title)=trim(oldProducts.Title) and
oldProducts.Position=1 and
oldProducts.Customer=$shop";
Indexes for NewProducts:
Primary: Id
Index: SKU, Title, customer (not unique)
Indexes for OldProducts:
Primary: Id
Index: Product_id (not unique)
Index: SKU, Title, Postition, Customer (not unique)
?>
CREATE TABLE `NewProducts` (
`Id` bigint(11) NOT NULL,
`Title` varchar(120) COLLATE utf8_unicode_ci NOT NULL,
`Category` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`Office` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
`Rehashed` smallint(6) NOT NULL,
`Quantity` smallint(6) NOT NULL,
`Price1` decimal(7,2) NOT NULL,
`Price2` decimal(7,2) NOT NULL,
`Price3` decimal(7,2) NOT NULL,
`Price4` decimal(7,2) NOT NULL,
`created_at` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`OldQuantity` int(11) NOT NULL,
`SKU` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`Source` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
`customer` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `I-T-S` (`ItemId`,`Title`,`SKU`),
KEY `customer` (`customer`),
KEY `Title` (`Title`,`Rehashed`),
KEY `SKU` (`SKU`),
KEY `Title_2` (`Title`,`SKU`,`customer`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
CREATE TABLE `OldProducts` (
`barcode` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`compare_at_price` decimal(10,2) DEFAULT NULL,
`created_at` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL,
`fulfillment` varchar(35) COLLATE utf8_unicode_ci DEFAULT NULL,
`grams` decimal(10,2) DEFAULT NULL,
`id` bigint(11) NOT NULL,
`management` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`policy` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`size` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`color` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`type` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`position` int(11) DEFAULT NULL,
`price` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
`product_id` bigint(11) NOT NULL,
`SKU` varchar(55) COLLATE utf8_unicode_ci DEFAULT NULL,
`Title` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`quantity` int(11) DEFAULT NULL,
`customer` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `P-S-T-PO-CUST`
(`product_id`,`SKU`,`Title`,`position`,`customer`),
KEY `product_id` (`product_id`),
TRIM is the villain. When you hide an indexed column (eg, SKU) inside a function (eg, TRIM), the the index cannot be used.
Clean up your data:
Fix the insertion code to TRIM before inserting (or as it inserts).
UPDATE tbl SET SKU = TRIM(SKU), title = TRIM(title); -- for each table
Change the SELECT: TRIM(SKU) --> SKU etc.
Even Better
oldProducts should have, in this order,
`INDEX(`position`,`customer` ,`SKU`,`Title`, `product_id`)
With this, the WHERE need look only at old rows for position=1 and customer =.... (Actually, the first 2 columns can be in any order; the last 3 in any order.)

Result consisted of more than one row SQL=INSERT INTO

While inserting first time it gives following error: "Result consisted of more than one row". When i try to insert record second time it gives error with message duplicate entry.
SQL=INSERT INTO `master_user` (`name`,`user_name`,`email`,`password`,`system_name_of_friend`,`system_no_of_friend`,`registered_from_site`,`registered_on`,`is_existing_user`) VALUES ('FirstName LastName','username','demo#mail.com','8c71eede42e38709e9e836021b0b9b9b','','','site','','1')
any one help will be appropriated and following is the table structure which will be get help to tracking this issue very easily and get the solution for this.
CREATE TABLE IF NOT EXISTS `master_user` (
`master_user_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`user_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`system_name_of_friend` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`system_no_of_friend` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`registered_from_ip` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`registered_from_site` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
`registered_on` datetime DEFAULT NULL,
`is_existing_user` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`master_user_id`),
UNIQUE KEY `ukMasterUser_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1293 ;
I have changed the few words from column Which are conflicting and resolved.

Why is is giving me an SQL syntax error?

Do you have any idea why i get this:
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 '``, `title` varchar(255) collate latin1_general_ci NOT NULL default ``,' at line 3
The code is like this (the part im having problem with...)
$sql = 'CREATE TABLE `forum` (
`postid` bigint(20) NOT NULL auto_increment,
`author` varchar(255) collate latin1_general_ci NOT NULL default ``,
`title` varchar(255) collate latin1_general_ci NOT NULL default ``,
`post` mediumtext collate latin1_general_ci NOT NULL,
`showtime` varchar(255) collate latin1_general_ci NOT NULL default ``,
`realtime` bigint(20) NOT NULL default `0`,
`lastposter` varchar(255) collate latin1_general_ci NOT NULL default ``,
`numreplies` bigint(20) NOT NULL default `0`,
`parentid` bigint(20) NOT NULL default `0`,
`lastrepliedto` bigint(20) NOT NULL default `0`,
`author_avatar` varchar(30) collate latin1_general_ci NOT NULL default `default`,
`type` varchar(2) collate latin1_general_ci NOT NULL default `1`,
`stick` varchar(6) collate latin1_general_ci NOT NULL default `0`,
`numtopics` bigint(20) NOT NULL default `0`,
`cat` bigint(20) NOT NULL,
PRIMARY KEY (`postid`)
);';
mysql_query($sql,$con) or die(mysql_error());
Help would be greatly appreciated!
`author` varchar(255) collate latin1_general_ci NOT NULL default ``,
'author' is a column name, hence why it goes it backticks.
But the default '' is a value so it should be in quotation marks, not backticks, methinks.
If this is the case, same goes for all other defaults.
You are using backticks instead of quotes for strings. Change this:
default ``
to this:
default ''
The full statement should be:
CREATE TABLE `forum` (
`postid` bigint(20) NOT NULL auto_increment,
`author` varchar(255) collate latin1_general_ci NOT NULL default '',
`title` varchar(255) collate latin1_general_ci NOT NULL default '',
`post` mediumtext collate latin1_general_ci NOT NULL,
`showtime` varchar(255) collate latin1_general_ci NOT NULL default '',
`realtime` bigint(20) NOT NULL default '0',
`lastposter` varchar(255) collate latin1_general_ci NOT NULL default '',
`numreplies` bigint(20) NOT NULL default '0',
`parentid` bigint(20) NOT NULL default '0',
`lastrepliedto` bigint(20) NOT NULL default '0',
`author_avatar` varchar(30) collate latin1_general_ci NOT NULL default 'default',
`type` varchar(2) collate latin1_general_ci NOT NULL default '1',
`stick` varchar(6) collate latin1_general_ci NOT NULL default '0',
`numtopics` bigint(20) NOT NULL default '0',
`cat` bigint(20) NOT NULL,
PRIMARY KEY (`postid`)
);
Thanks for responses. I had actually done this before (putting ' instead of ` ), but it just showed me a blank page....
I figured out my problem. I either had to put backslash before each ' or just change the
$sql = 'CREATE TABLE `forum` (
to
$sql = "CREATE TABLE `forum` (
(note the quotes)
Thanks anyway, it helped me figure it out!

Categories