Jump to content

problems with mysql_escape_string


skateme

Recommended Posts

I was reading about mysql_escape_strings and how they're much more secure than just calling a variable using $_POST. I tried it out in my code but I always get an error saying:

 

Use of undefined constant 'delete' - assumed 'delete' in .......... on line 9

 

How do I fix this error? This is my code

 

$delete = mysql_query("delete from mytable where user='".mysql_escape_string($_REQUEST[delete])."'",$c);
$delete;

 

To simplify reading, the code is: where user = quote double-quote . mysql_escape_string($_REQUEST[delete]). double-quote quote double-quote

 

I also have another question. How do I store timestamps in my database? When I'm updating/inserting a new entry I just put ' ' for the value of timestamp but it doesn't work.

 

Thanks in advance!

Link to comment
Share on other sites

Thanks for the reply but I got an error:

 

Fatal error: Call to undefined function  mysql_query() in ........... on line 8

 

When I removed the single quotes from $_REQUEST['delete'] and changed the query to all lowercase, that error was gone. Instead I was left with the original error:

 

Use of undefined constant 'delete' - assumed 'delete' in .......... on line 8

 

 

Any ideas?

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.