Jump to content

Recommended Posts

<?php
$query = mysql_query("SELECT con, verified FROM `table` WHERE email='".$_POST['email']."'");
?>

 

In and of itself, there is apparently nothing wrong with the code, but there are sooo many more variables than simply debugging parse errors. Besides the fact that this query is wide open to SQL injection, there are several things that we need to know: what are you attempting to do? Are you doing any checks on the email variable to assure that it contains what you think it contains? Have you run any debugging options on the query itself? Is your table really named "table" as your query implies?

 

I would recommend you try something like this for starters:

<?php
$sql   = "SELECT con, varified FROM `table` WHERE email = '{$_POST['email']}'";
$query = mysql_query($sql) or die(mysql_error() . "<br />\n<b>SQL:</b> $sql");
?>

Link to comment
https://forums.phpfreaks.com/topic/51316-select-question/#findComment-252741
Share on other sites

Aren't these different?

 

email='".$_POST['email']."'
email = '{$_POST['email']}'

 

As fenway stated, the first two evaluate the same, but those two are very different. Consider the following:

<?php
$_POST['email'] = 'test@test.com';

// These will all echo "test@test.com"
echo $_POST['email'];
echo "$_POST[email]";
echo "{$_POST['email']}";

// This will echo "$_POST[email]"
echo '$_POST[email]';

// This will echo "{$_POST['email']}"
echo '{$_POST[\'email\']}';
?>

Link to comment
https://forums.phpfreaks.com/topic/51316-select-question/#findComment-253680
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.