Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: SQL syntax

  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow SQL syntax

    I'm moving a site over from another hosting company but when i'm uploading sql file 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 '' at line 1
    Seen has it says near line "1" i will post just the top few lines of the sql file

    Code:
    -- phpMyAdmin SQL Dump
    -- version 3.5.2.2
    -- http://www.phpmyadmin.net
    --
    -- Generation Time: Sep 06, 2012 at 02:26 PM
    -- Server version: 5.5.27-28.0
    -- PHP Version: 5.3.5
    
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";
    
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    
    --
    -- Database: `wbff_11001226_hubdir`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `adminuser`
    --
    
    CREATE TABLE IF NOT EXISTS `adminuser` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` tinytext NOT NULL,
      `username` tinytext NOT NULL,
      `password` tinytext NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
    Please note that i have no knowledge at all with mysql code etc.. So you will have to spell it out in plain english

    Any help would be much appreciated.

    PS: I can include the file if needed..

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Pull any occurences of this out of the file before trying the import:

    Code:
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    I think I remember that being the problem on some imports.

    If not try removing everything up until this line:
    Code:
    -- Database: `wbff_11001226_hubdir`

  • #3
    New Coder
    Join Date
    Apr 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Tried both your suggestions without any luck, i just get the same message.

    Thanks though.

  • #4
    New Coder
    Join Date
    Sep 2012
    Posts
    71
    Thanks
    0
    Thanked 8 Times in 8 Posts
    Have you checked to see if any of the import completed?

  • #5
    New Coder
    Join Date
    Apr 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it does import all the tables and the import does complete, its not in phpmyadmin i get the error message. I see the message when i go to my website.

    I'm going to attach the db file for anyone to look at, maybe they may see the problem?
    Last edited by Trax2k11; 09-08-2012 at 04:55 PM.

  • #6
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Quote Originally Posted by Trax2k11 View Post
    Yes, it does import all the tables and the import does complete, its not in phpmyadmin i get the error message. I see the message when i go to my website.
    So then the error message has NOTHING to do with importing the file and will be an error in your php or whatever code you have on your web page.

  • #7
    New Coder
    Join Date
    Apr 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So why would it then say on my web page?

    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 '' at line 1
    Anyway ive managed to fix it by importing one table at a time until it screwed up again

    Thanks for trying to help guys

  • #8
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    It would say that on your web page because the error is in the PHP code doing the query and you are using mysql_error to report the query back to the web page.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •