Jump to content

Quick Question On PHP Register and Login Scripts - MYSQL Error


VeronMan

Recommended Posts

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

Good grief, this has been an unproductive thread so far.

 

To summarize:

 

You need to have a database (whose name you know)

In that database you can have one table, two tables, as many tables as you want

In each table, you define 'fields' (think of those like the cells in a table). The names are important.

 

From the errors that you report, it looks as though you are trying to add data into fields that don't exist (case sensitivity matters).

 

Without seeing any code at all, it's difficult to help you through what is essentially a very simple exercise.  It may also be helpful for you to use phpAdmin to export the structure of your database table(s) and post that here. Then we'll all know just what fields are where and why, etc. so that we can suggest how you resolve your problems.

 

If you get an error message it means exactly what it says. If there is an unknown column 'Names', it doesn't matter if you have a field called names, or Name, etc. only that you're trying to put data into a field that doesn't exist.  One last pointer - don't use any of MySQL's reserved words as the names for database tables or database table fields.  You can find the list at http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Link to comment
Share on other sites

Okay, here's my exported phpMyAdmin file.  ;)

 

 

-- phpMyAdmin SQL Dump
-- version 2.9.2-rc1
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Apr 02, 2007 at 03:43 AM
-- Server version: 4.0.26
-- PHP Version: 4.4.2
-- 
-- Database: `107887`
-- 
CREATE DATABASE `107887`;
USE 107887;

-- --------------------------------------------------------

-- 
-- Table structure for table `Names`
-- 

CREATE TABLE `Names` (
  `names` varchar(80) NOT NULL default ''
) TYPE=MyISAM;

-- 
-- Dumping data for table `Names`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `Users`
-- 

CREATE TABLE `Users` (
  `firstname` varchar(30) NOT NULL default '',
  `surname` varchar(30) NOT NULL default '',
  `email` varchar(80) NOT NULL default '',
  `username` varchar(50) NOT NULL default '',
  `password` varchar(18) NOT NULL default '',
  `confirm` varchar(18) NOT NULL default '',
  `Names` varchar(50) NOT NULL default ''
) TYPE=MyISAM COMMENT='Registration Table';

-- 
-- Dumping data for table `Users`
-- 


-- --------------------------------------------------------

-- 
-- Table structure for table `codes`
-- 

CREATE TABLE `codes` (
  `activation` varchar(6) NOT NULL default '',
  `code` varchar(6) NOT NULL default '',
  `id` varchar(10) NOT NULL default ''
) TYPE=MyISAM;

-- 
-- Dumping data for table `codes`
-- 

-- 
-- Database: `test`
-- 
CREATE DATABASE `test`;
USE test;

 

Right now, i'm also attempting to obtain an SQL file from the creator of these PHP scripts, but I don't think he has one. But worth a try!  :)

Link to comment
Share on other sites

Well, i'd just like to say thanks to everybody here on this forum that's helped me out with these scripts, and I know it's been a long and tedious process, but you've been great! Now, I managed to conjure up an SQL file from the scripts' author, so that should work perfectly!

 

Once again, thanks for all your help!  :)

Link to comment
Share on other sites

Oh man, this is starting to suck real bad. Just tried to upload the SQL file I was given (below), and it came up with the following error:

 

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 'CREATE TABLE `videos` (
  `id` int(10) NOT NULL auto_increment 

 

And here's the SQL file, hopefully someone can quickly fix this up.

 

CREATE TABLE `songs` (
  `id` int(10) NOT NULL auto_increment,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)


CREATE TABLE `videos` (
  `id` int(10) NOT NULL auto_increment,
  `picture` varchar(255) NOT NULL,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)


CREATE TABLE `ringtones` (
  `id` int(10) NOT NULL auto_increment,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)


CREATE TABLE `backingmusic` (
  `id` int(10) NOT NULL auto_increment,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `midURL` varchar(255) NOT NULL,
  `docURL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)


CREATE TABLE `projects` (
  `id` int(10) NOT NULL auto_increment,
  `picture` varchar(255) NOT NULL,
  `language` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)


CREATE TABLE `pictures` (
  `id` int(10) NOT NULL auto_increment,
  `pic` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)


CREATE TABLE `programs` (
  `id` int(10) NOT NULL auto_increment,
  `picture` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)

----------------------------------------------------------------------

CREATE TABLE `codes` (
  `id` int(10) NOT NULL auto_increment,
  `code` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)

CREATE TABLE `Users` (
  `id` int(10) NOT NULL auto_increment,
  `Username` varchar(255) NOT NULL,
  `Password` varchar(255) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Email` varchar(255) NOT NULL,
  `Date` varchar(255) NOT NULL,
  `Level` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)

----------------------------------------------------------------------

CREATE TABLE `animation` (
  `id` int(10) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `episodes` varchar(255) NOT NULL,
  `language` varchar(255) NOT NULL,
  `price` varchar(255) NOT NULL,
  `numcds` int(10) NOT NULL,
  PRIMARY KEY  (`id`)
)

 

Thanks for your time everyone!

Link to comment
Share on other sites

Cool, that worked fine, but now i'm getting this.

 

Error
SQL query: 

CREATE TABLE `songs` (

`id` int( 10 ) NOT NULL AUTO_INCREMENT ,
`artist` varchar( 255 ) NOT NULL ,
`title` varchar( 255 ) NOT NULL ,
`size` varchar( 255 ) NOT NULL ,
`URL` varchar( 255 ) NOT NULL ,
PRIMARY KEY ( `id` ) 
);



MySQL said:  

#1046 - No Database Selected 

 

There seems to be nothing wrong with the code...

Link to comment
Share on other sites

Okay, now i'm using the SQL file below, but i'm still getting yet another error message. I think it's somethink to do with my selecting of the database.  ???

 

mysql_select_db($107887)

CREATE TABLE `songs` (
  `id` int(10) NOT NULL auto_increment,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);


CREATE TABLE `videos` (
  `id` int(10) NOT NULL auto_increment,
  `picture` varchar(255) NOT NULL,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);


CREATE TABLE `ringtones` (
  `id` int(10) NOT NULL auto_increment,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);


CREATE TABLE `backingmusic` (
  `id` int(10) NOT NULL auto_increment,
  `artist` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `midURL` varchar(255) NOT NULL,
  `docURL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);


CREATE TABLE `projects` (
  `id` int(10) NOT NULL auto_increment,
  `picture` varchar(255) NOT NULL,
  `language` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);


CREATE TABLE `pictures` (
  `id` int(10) NOT NULL auto_increment,
  `pic` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);


CREATE TABLE `programs` (
  `id` int(10) NOT NULL auto_increment,
  `picture` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `size` varchar(255) NOT NULL,
  `URL` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);

----------------------------------------------------------------------

CREATE TABLE `codes` (
  `id` int(10) NOT NULL auto_increment,
  `code` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);

CREATE TABLE `Users` (
  `id` int(10) NOT NULL auto_increment,
  `Username` varchar(255) NOT NULL,
  `Password` varchar(255) NOT NULL,
  `Name` varchar(255) NOT NULL,
  `Email` varchar(255) NOT NULL,
  `Date` varchar(255) NOT NULL,
  `Level` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);

----------------------------------------------------------------------

CREATE TABLE `animation` (
  `id` int(10) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `episodes` varchar(255) NOT NULL,
  `language` varchar(255) NOT NULL,
  `price` varchar(255) NOT NULL,
  `numcds` int(10) NOT NULL,
  PRIMARY KEY  (`id`)
);

 

Now what's the problem?

Link to comment
Share on other sites

Ack! Sorry, I rushed when I was posting that, here's the error:

 

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 'mysql_select_db($107887)

CREATE TABLE `songs` (
  `id` int( 

Link to comment
Share on other sites

If I remove the "mysql_select_db($107887)" I get the error which I stated in my post up a few posts. I'm not really interested in R.T.M as I just need a quick-fix sort of solution for these scripts, i'm not going to be developing my knowledge of PHP/MYSQL any further than this.  ;)

Link to comment
Share on other sites

Yeah, and I agree with that wholeheartedly, but I don't need any more than what i've got in these scripts right here, and the time this has taken is a little bit annoying, but personally, I reckon this error:

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 'mysql_select_db($107887)

CREATE TABLE `songs` (
  `id` int( 

 

is the last one, because other than this selecting the database stuff (AndyB told me to put the mysql_select_database($107887) thing in), the SQL file looks fine, and same with all the PHP scripts. This is the last error i'll ask help for, as there may be more, and I don't want to waste your time, but this last error, I require help with.

 

Thanks again.  ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.