Seems my SQL is out of date?

Associate
Joined
18 Dec 2002
Posts
1,542
Location
Cardiff
I found back ups of websites I did around 3-4 years ago. I'm only just getting back into coding etc and wondered if someone could help me.

I noticed that I now need to use ` instead of nothing or a ', for example creating a database from an old SQL dump just didnt work. I had to go through and add a ` around the table name and row names like below:

From:
Code:
CREATE TABLE leagues (
  l_id int(11)  DEFAULT '0' NOT NULL auto_increment,
  l_name varchar(15)  DEFAULT '0' NOT NULL ,
  l_url varchar(100)  DEFAULT '0' NOT NULL ,
  PRIMARY KEY (l_id)
);

To:
Code:
CREATE TABLE `leagues` (
`l_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`l_name` VARCHAR( 15 ) NOT NULL ,
`l_url` VARCHAR( 100 ) NOT NULL 
) TYPE = MYISAM ;

After some editing I finally got the site up but I'm receiving the following error:

Error(news_sql) : 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

Relating to the following:

Code:
$news_sql = mysql_query( "SELECT * FROM news WHERE n_id = $p_id" )
	or die( "Error(news_sql) : " . mysql_error()

While I understand I could re-write everything I'm sure I could install an older version of MySQL or something to get this working? Anyone?
 
Last edited:
Nevermind, seems its down to register_globals. Would have to go through it all and change it to $_GET[]
 
You are a star BeanSprout, that has fixed everything :).

Now to just code a new site workable with register_globals on :).
 
That's a great help. My current site uses page= and action= type scripting, along with some other huge security risks which I just wasnt aware of back when I started years ago.
I'm just thinking of a new project to work on to bring my PHP/SQL skills up to line from what things were like 3-5 years ago.

These forums and Robs Security page has been a great help though :).
 
Back
Top Bottom