View Single Post
Old 11-12-2012, 03:59 PM   PM User | #4
BluePanther
Senior Coder

 
Join Date: Jul 2011
Posts: 1,226
Thanks: 3
Thanked 171 Times in 171 Posts
BluePanther is on a distinguished road
Quote:
Originally Posted by stevenryals View Post
Sorry i know this is noob stuff.. but i'm in the learning phase here

I have:

Code:
$tagval = $_POST['tagval']; 
$cpmval = $_POST['cpmval']; 

if (!mysql_connect($db_host, $db_user, $db_pwd))
    die("Can't connect to database");

if (!mysql_select_db($database))
    die("Can't select database");

$tagval = mysql_real_escape_string($tagval);
$cpmval = mysql_real_escape_string($cpmval);

$sql = mysql_query("DELETE FROM {$table} WHERE tag = $tagval AND cpm > $cpmval" );
if (!$sql) {
    die(mysql_error());
}
it's erroring.. says: "unknown collumn 'steven' in where clause.
the tagval i'm sending is "steven-slist" so it's obviously coming from there somehow..

I thought this was because $tag was being sent, $tag was being retried by POST and then tag was the name of the collumn.. so i changed that variable to $tagval and it's still the same..
Notice my amendments in bold. Try that and see how it goes.

It's important, for security, to use that function every single time you put user input into an SQL query.
__________________
Useful function to retrieve difference in times
The best PHP resource
A good PHP FAQ
PLEASE remember to wrap your code in [PHP] tags.
PHP Code:
// Replace this
if(isset($_POST['submitButton']))
// With this
if(!empty($_POST))
// Then check for values/forms. Some IE versions don't send the submit button 
Quote:
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
BluePanther is offline   Reply With Quote