Mordred wrote:You appear to have some misconception about how arrays are used. I didn't get what exactly you are trying to do, but here's an example on inserting things in a database:
Code: Select all
$value1 = mysql_real_escape_string($_REQUEST['value1']);
mysql_query("INSERT INTO `table` SET `value1`='$value1' ");
$_REQUEST['value1'] is the way to get something out of an array.
Thats close to what I am attempting, however in my case, and since it is for
error reporting, I will never be sure what is in the $_REQUEST.
If a user stumbles upon an error triggered by my error class,
then I am wanting to record the error into sql, along with any
$_REQUEST that was attempted as the error was generated.
I do not want to show the user what the $_REQUEST was
and since the Error Reporting is dynamic, I cant pre-define what is in the
$_REQUEST['array']
So how can I get the values from the $_REQUEST without knowing before hand what they are
and without displaying the values publicly?
The below code works to get and show all values, however it only works by publicly displaying the values.
Heres my flow:
Code: Select all
foreach ($_REQUEST as $k => $v)
{
//this echo will show all values in $_REQUEST
echo "<br />$k = $v";
//this $full_request will only show the last values in $_REQUEST
$full_request = "$k = $v";
}
mysql_query("INSERT INTO error_log (request) VALUE ('$full_request')");
does this make any more sense to anyone other then myself what I am trying to do?