View Single Post
  #9 (permalink)  
Old 06-03-09, 09:40 AM
black-dog's Avatar
black-dog black-dog is offline
Senior Member
 
Join Date: May 2008
Location: Newcastle under Lyme
Posts: 205
Send a message via Yahoo to black-dog
Default

Quote:
Originally Posted by perplexed View Post
Too be honest i've just spent an hour trying a myriad of ways to get this database working and i despair. It's becoming the most frustrating, enraging and infuriating task.

I've looked under 'Server variables and settings' and in a very long list can find no mention whatsoever of 'global_variables'...so are they on or off? haven't got a clue and before i smash my computer against the wall...i'm walking away and will try again tomorrow.
OK, calm down and take a deep breath. The first thing is not to blame the hosting, all installations will be like this soon, it's just the PHP upgrade.

Your variables are not getting to your database query, that much is obvious from the echo $sql statement.

In the past, register_globals was on by default. This means, among other things that if you write
Code:
http://www.example.com?myvariable=foo&myothervariable=bar
then the two variables $myvariable and $myothervariable will be available in your script.This is a potential security risk in badly written scripts. (there is loads on this on the web so I won't explain further here) As of PHP 5 register_globals is off by default and scripts relying on it have to be rewritten. That's just fact, deal with it, we all have to.

So, how are your variables getting into the query?

If they are coming from a form using the POST method then the code I posted earlier will work. If they are coming from the URL as above, replace POST with GET (as Scottie has mentioned) If you are not sure if it is GET or POST then do

PHP Code:
$a=mysql_real_escape_string($_REQUEST['a']);
$b=mysql_real_escape_string($_REQUEST['b']);
$c=mysql_real_escape_string($_REQUEST['c']); 
Before the $sql=... bit.


If that fails, tell me where your variables are coming from and I'll help you get it to work.
__________________
black-dog
4theweb.co.uk Web stuff
slipperyhill.co.uk Band

Last edited by black-dog; 06-03-09 at 09:51 AM.
Reply With Quote