Jump to content

mysql query with single quotes?


LooieENG

Recommended Posts

^^ I was just wondering.

 

Another question, would this work, and if not, where do I put the quote marks on the md5 bit?

 

mysql_query("INSERT INTO users ('username', 'password') VALUES ('$_POST[username]', md5('password')");

^^ I was just wondering.

 

Another question, would this work, and if not, where do I put the quote marks on the md5 bit?

 

mysql_query("INSERT INTO users ('username', 'password') VALUES ('$_POST[username]', md5('password')");

 

I'd personally try something like:

$query = sprintf("INSERT INTO users(username, password) VALUES ('%1$s', '%2$s')", $_POST['username'], md5($password));

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.