Jump to content
Larry Ullman's Book Forums

Problems With Creating A Table


Recommended Posts

Hi,

I'm using MyLittleAdmin as a client (that's what my hosting company supply) and under the section 'new query' I typed in the code from the book as per below. I received the error message shown below the code. There is an interface that allows table data to be input into little boxes, however there does not appear to be a way to do AUTO_INCREMENT and it doesn't have MEDIUMINT on its dropdown for 'type'. Any ideas anyone?

 

Cheers

Paul

 

 

CREATE TABLE users (

user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,

first_name VARCHAR(20) NOT NULL,

last_name VARCHAR(40) NOT NULL,

email VARCHAR(60) NOT NULL,

pass CHAR(40) NOT NULL,

registration_date DATETIME NOT NULL,

PRIMARY KEY (user_id)

);

 

Msg 102, Level 15, State 1, Line number 2

Incorrect syntax near 'UNSIGNED'.

Link to comment
Share on other sites

That is odd. I just used phpMyAdmin supplied with XAMPP to copy and paste your statement into the SQL entry box, and it worked perfectly fine. Honestly, don't know what to tell you. I'd check out some MyLittleAdmin forums and see if anyone is having similar problems, etc.

  • Upvote 1
Link to comment
Share on other sites

HartleySan,

 

Thanks for the response.

 

I've tried looking at forums and playing with MyLittleAdmin and don't get a good feel for it. The forums are tiny. MyLittleAdmin doesn't seem to be anywhere near as big or as well supported as PHPMyAdmin.

 

Could you help me understand this. I have a Windows hosting package that comes with a MS SQL database and MyLittleAdmin. They have told me that I can use PHPMyAdmin if they move my account, whatever, to Linux. However, if they did that I would need to back up my own website because they would have to point the DNS to Linux. I don't pretend to understand that but that's what they've told me.

 

I guess that I'm trying to get my head round the difference between the MySQL / PHPMyAdmin combination and the MS SQL / MYLittleAdmin combination. It appears that they are not interchangable, one is Windows and one is Linux...or have I got that wrong? Is that just what my hosting company do? If I decide to change from Windows hosting to Linux does that make any difference to how my website works, or how I FTP pages etc? Can I use PHPMyAdmin myself (seperate from my hosting company) and connect with a MS SQL database? If so what information would I need - server name, database name, login and password?

 

I'm very new to this (as you've undoubtably gathered). Thanks for your time, I appreciate it.

 

Cheers

Paul

Link to comment
Share on other sites

Paul, I am no expert on this topic, but I'll share what I (think I) know, and certainly, others can chip in:

 

Basically, when it comes to servers, Windows sucks. It's kind of a well-known fact that the only computers in the world where MS has any foothold are those used in people's homes for general use and in the office for simple tasks. Otherwise, Unix/Linux reigns supreme, and I have no doubt that phpMyAdmin vs. MyLittleAdmin is the same thing.

 

I have never ever heard of MyLittleAdmin, so I can't comment on that. However, I imagine that MyLittleAdmin would be robust enough that you could easily back up any databases you have already built in it, and then import those databases into phpMyAdmin, although I don't know for sure. Certainly though, it does not seem like it would be a problem.

 

In terms of having to back up your website, I think what they're referring to is that they're not willing to move everything over for you for free. Most likely, if you simple take all your HTML/PHP pages, backed up databases files, etc., and temporarily back them up on your hard drive until your hosting service ports your account over to Linux and phpMyAdmin, then you can easily re-upload everything to your new Linux server and import the database files using phpMyAdmin, and it'll all work fine.

 

In terms of the difference between Windows hosting and Linux hosting, like I mentioned above, without a doubt, Linux hosting is better and you should have no issues.

 

I don't know all the details, but it sounds to me like your best bet would be to back up everything you want to keep onto your local HDD ASAP, and then tell your hosting service to switch you over to Linux, and then re-upload everything.

 

A couple of things that you might want to specifically ask them are the following:

- Is it possible and easy to back up a database from MyLittleAdmin and import that database into phpMyAdmin?

- Is all your account information the same (i.e., is your user name and password the same)?

 

Beyond that, you should be good to go. If you aren't already, I recommend using FileZilla for your FTP client. And if you're on Windows, I prefer XAMPP for setting up both a virtual Apache server and MySQL database environment for testing everything locally. In fact, if you want to download XAMPP right now, you can play with phpMyAdmin in there, and see if you like it, and you're able to do everything you want to do.

 

Well, hope that is of some help. Let us know if you have any additional questions.

  • Upvote 1
Link to comment
Share on other sites

HartleySan,

Thanks very much for all your info.

 

I have asked my hosting company to move my website over to Linux. The database is not a problem as I've only just starting playing with it using Larry's book, so there's nothing in it.

 

It's interesting what you said about Windows. This is the kind of information, though, that beginners like me don't know.

 

One more question, if I may. Up until now I have been following all the PHP examples by doing them myself on Dreamweaver and uploading them (using Dreamweaver) to my hosting company as a page of my website to make sure they work. In your opinion would I be better doing these tutorials and in future, testing, on my own machine. Dreamweaver has the ability, it appears, to set up a testing server. A quick look at a Dreamweaver article indicates that they think that I am safer and more efficient if I use a test server on my own machine. They give extensive instructions on how to do it. Would you agree that I'm better setting it up on my own machine than uploading it each time to my host?

 

Thanks for all your help and I hope other beginners are benefiting from my basic questions!

Paul

Link to comment
Share on other sites

No problem with answering your questions. That's what the forum is for.

 

I suppose everyone has their own way of doing things, but I personally like to use a virtual server set up on my machine, and test everything out there before going live. It's a lot easier and faster, and also, you don't have to worry about a potential bot compromising an incomplete site.

 

There are a lot of WAMP (Windows, Apache, MySQL, PHP/Perl/Python) packages out there, but I prefer XAMPP. Perhaps it's just because it's the one that I have always used, but I have never had any issues with it, so I can't not recommend it.

 

Just go to the XAMPP website, download the Windows version and follow the simple instructions on screen. After the installation finishes, a command prompt will come up with some questions to answer. Generally, I elect to not bother setting a password for MySQL at the beginning (since I'm not worried about security issues on my local machine).

 

Note that if you go that way, the default installation will put everything in a folder called xampp on your C drive. All scripts have to go into the htdocs folder within the xampp folder. If you wanted to, for example, test out a script called myScript.php, you'd put that in the htdocs folder (subfolders are also okay), start up the XAMPP Control Panel (from the Start menu, etc.), start the Apache server, and then type http://localhost/myScript.php to run the script. It should work fine. Note that localhost points to C:\xampp\htdocs by default, but that can be easily changed, if you want to.

 

Also, if you want to access phpMyAdmin, etc., you also need to first start up MySQL from the XAMPP Control Panel. After that, the easiest thing to do is simply type localhost into your browser URL bar, and then click on phpMyAdmin from the bar on the left.

 

As a final note, if you use the default settings for MySQL (including no password), you need to use the following settings to access a MySQL database:

 

Host: localhost

User name: root

Password: (none) (Generally, you need to specify two single quotation marks without any spaces between them ('') to represent this in PHP.)

Database: database-name (Obviously this depends on the actual database name you use.)

 

Well, I don't mean to sell you on XAMPP, but it really is the easiest way to go, I think.

 

Good luck, and feel free to ask any other questions.

  • Upvote 1
Link to comment
Share on other sites

Hiya,

I took your advice and installed XAMPP. However Apache does not appear to work. It starts, comes up with 'running' and 5 seconds later turns itself off. I've posted an entry on the XAMPP forum but have you (or anyone else) come accross this problem?

 

Cheers

Paul

Link to comment
Share on other sites

Thanks for letting us know. Presumably Skype was running on the same port as Apache, thereby causing the conflict. I suspect, if that's the case, you changed the default port for either Apache or Skype to solve the problem.

Link to comment
Share on other sites

Larry,

 

Correct. I changed Skype. The XAMPP website has a specific section for Vista problems with instructions for changing the Skype port.

 

HartleySan said that Windows servers suck, I'm not sure, from reading other forums, that Vista and, for that matter, IE8 are far behind.

 

Since I (or rather XAMPP and HartleySan) got it to work I've created my first database and table.

 

Really enjoying the book.

Cheers

Paul

Link to comment
Share on other sites

 Share

×
×
  • Create New...