I have the function pt_replace:
function pt_register()
{
$num_args = func_num_args();
$vars = array();
if ($num_args >= 2) {
$method = strtoupper(func_get_arg(0));
if (($method != 'SESSION') && ($method != 'GET') && ($method != 'POST') && ($method != 'SERVER') && ($method != 'COOKIE') && ($method != 'ENV')) {
die('The first argument of pt_register must be one of the following: GET, POST, SESSION, SERVER, COOKIE, or ENV');
}
$varname = "HTTP_{$method}_VARS";
global ${$varname};
for ($i = 1; $i < $num_args; $i++) {
$parameter = func_get_arg($i);
if (isset(${$varname}[$parameter])) {
global $$parameter;
$$parameter = ${$varname}[$parameter];
}
}
} else {
die('You must specify at least two arguments');
}
}
Which is used for the following reasons:
pt_register('POST','themsg');
pt_register('POST','thenumbar');
I know everything works up until this point and the variables are being passed as otherwise I would receive an error message if any of the values were null.
I have a MySQL database with the tables "boxes" and "sent". "touser" in the "sent" table has exactly the same value as "thecode" in boxes.
$hount = mysql_num_rows(mysql_query("SELECT theid FROM sent WHERE theid='$themsg' LIMIT 1"));
$check1 = mysql_query("SELECT touser FROM sent WHERE theid='$themsg'");
$check2 = mysql_query("SELECT thenum FROM boxes WHERE thecode='$check1'");
if ($hount == "1")
{
if ($check2 = $thenumbar) {
$result = mysql_query("SELECT * FROM sent WHERE theid='$themsg' LIMIT 1")
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$fromip = $row['fromip'];
$themsh = $row['themsg'];
$theday = $row['thedate'];
echo "<div align='center'><b>Message:</b><br>$themsh<br><br> <b>When:</b><br> $theday</div>";
}
}
else {
die("Wrong number!");
}
} else {
echo "<div align='center'><font size='5' color='red'>Non-existant</font></div>";
If I echo $check1 and $check2 before the die("Wrong number!"); function, $check1 has a value of "Resource id #5" and $check2 is null. My level of PHP and MySQL is still pretty basic, so it could be a ridiculous problem.
Thanks for the help, Cuchara2.