Quote:
Originally Posted by black-dog
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.
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.
|
OK after giving up on my whole website in despair for a couple of months (because i can't get simple scripts and webpages displaying that have worked elsewhere for years) i'm trying to get the time to have another stab.
My query is POSTED from the webpage form. I added the php code you suggested.
What happens now is instead of the whole database table displaying, and not just the selected rows, none of it displays.
However, a possible step nearer to solving the problem is that the MySql query now contains the fields entered into the search form - previously the fields were showing empty.
So whilst not displaying the results yet, the query shows up as;
Select * from database_name where artist like 'beatles' song like '%love%' order by 'folder'
This should normally display all songs by the beatles with the word 'love'
anywhere in the title. (folder refers to the physcal folder i have music scores stored in)
Do you think the problem now moves on to the target (of the POST command) script of the query page? If so i can supply the script for that, it is only a few lines.