Jump to content

[SOLVED] Escaping single/double


rawky1976

Recommended Posts

maybe

$query = "SELECT CONCAT(client_lname, ', ',client_fname) AS name FROM clients ASC WHERE client_lname = ".$_POST['editclient'];
or
$query = "SELECT CONCAT(client_lname, ', ',client_fname) AS name FROM clients ASC WHERE client_lname = '".$_POST['editclient']."'";

or
$query = "SELECT CONCAT(client_lname, ', ',client_fname) AS name FROM clients ASC WHERE client_lname = {$_POST['editclient']}";

Link to comment
Share on other sites

$_POST is actually an array and 'editclient' is an array key or index. The code should work like that so be sure to have a textfield called 'editclient'. Anyway try this different approach but should give the same results:

 

$editclient = $_POST['editclient'];
$query = "SELECT CONCAT(client_lname, ', ',client_fname) AS name FROM clients ASC WHERE client_lname='$editclient'";

Link to comment
Share on other sites

Hello again, found the problem with the above; I named the submit button instead of the text field in the form!!! Sorry guys!

 

What can I put between these two lines to display the content of $query on the webpage? It's now dropping out of the if condition to display 'no results match etc...'

 

$result = @mysql_query ($query);

			if ($result) {

 

?

 

Thanks, Mark

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.