Hello,
how may I integrate an url-parameter for instance "123" into the select
From this code:
$g->select_command = "SELECT * FROM `t` where id = 123; ";
to a code like this:
echo
' "$g->select_command = "SELECT * from t where id =". $_GET["ref_id"]. ";"';
Or is this not not possible having a flexible id in the select command?
best regards,
Mario
Ideally $_GET should work as it is. But you can try the following:
e.g.
if (!empty($_GET["ref_id"]))
{
$_SESSION["ref_id"] = $_GET["ref_id"];
}
$ref_id= $_SESSION["ref_id"];
and use `$ref_id` in your SQL.
Thank you. The standard case works.
But the referrer-id is only kept with the first click. As soon as the second click is there the message appears:
Couldn't execute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '…WHERE ref_id = '
This means at the second click the ref_id is empty. Is there a possibility to keep the id over the whole session, or is there a possibility to errorhandle an error like "Couldn't execute query." to a redirect?
thanx and best regards,
Mario