Forum Moderators: coopster
If anyone can advise me on what I have done wrong, I would greatly appreciate it.
$rs0_query="mysql_query ("select * from \reciprocal_admin where id=" . $_SESSION["reciproc_adminid"]. " and password ='" . str_replace("'","''",$_POST["password"]) . "'" )";
to this
$rs0_query="mysql_query ("select * from \reciprocal_admin where id=" . $_SESSION['reciproc_adminid']. " and password ='" . str_replace("'","''",$_POST['password']) . "'" )";
$x = "mysql_query(query stuf)";
$x = "gobbledy gook";
However, once you do this:
$x = "gobbledy gook ("select" . $var);
You have unmatched quotes and parse errors.
$rs0_query= mysql_query ("select * from reciprocal_admin where id=" . $_SESSION["reciproc_adminid"]. " and password ='" . str_replace("'","''",$_POST["password"]) . "'" )";
if ($rs0 = mysql_fetch_array($rs0_query))
I don't understand this though: str_replace("'","''",$_POST["password"])
What are you attempting there?
Try:if ($rs0=="mysql_fetch_array($rs0_query)")
Actually, don't. mysql_fetch_array() is going to return a resource which is never going to meet the equality comparison. In fact, if the fetch fails and you have error reporting turned down, this should return true without error. When the fetch finds no data, it returns false and an unintialized variable gets treated as 0, an empty string, a boolean false etc. So for a failed fetch, this would be the same as
if (false == false)
which evaluates to TRUE - exactly the opposite of what you want. In this case you actually want to assign the value to $rs0 and evaluate that so that
if ($rs0 = some_data)
is the same as
if (true)
which is what you want.