Jump to content

url problems


Codeman0013

Recommended Posts

Ok here is my thing i have done some error testing and found it has somethign to do with how the information is being taken from the url if i set a default value it works fine but if i dont then it shows up blank can anyone trouble shoot the following code and see if i'm pulling from the url wrong?

// begin Recordset$colname__rs_employeeinfo = '1';if (isset($HTTP_GET_VARS['employeeID'])) {  $colname__rs_employeeinfo = $HTTP_GET_VARS['employeeID'];}$query_rs_employeeinfo = sprintf("SELECT * FROM employees WHERE employeeID = %s", GetSQLValueString($colname__rs_employeeinfo, "int"));$rs_employeeinfo = $befh->SelectLimit($query_rs_employeeinfo) or die($befh->ErrorMsg());$totalRows_rs_employeeinfo = $rs_employeeinfo->RecordCount();// end Recordset// begin Recordset$colname__rs_employeeqa = '-1';if (isset($HTTP_GET_VARS['employeeID'])) {  $colname__rs_employeeqa = $HTTP_GET_VARS['employeeID'];}$query_rs_employeeqa = sprintf("SELECT * FROM staffanswers, staffquestions WHERE staffanswers.employeeID = %s AND staffanswers.staffquestionID = staffquestions.staffquestionID", GetSQLValueString($colname__rs_employeeqa, "int"));$rs_employeeqa = $befh->SelectLimit($query_rs_employeeqa) or die($befh->ErrorMsg());$totalRows_rs_employeeqa = $rs_employeeqa->RecordCount();// end Recordset

Link to comment
Share on other sites

It might, just might, be that fact that you are using $HTTP_GET_VARS.Above version whatever, PHP introduces $_GET as the alternative, so $HTTP_GET_VARS has become obsolete at that point. But I don't know what version you use as PHP installation at your server, and I don't fully understand your code, so I may be wrong and the replacement of those variables can turn out to no changement. You should try it, give it a whirl :) $HTTP_GET_VARS is rarely used these days.You say it is the information that is taken from the url, with which you mean this variable, so I am practically sure it is true what I say, be can't be 100% though.

Link to comment
Share on other sites

It's typically better to leave register_globals off. It was disabled by default since PHP 4.2.0 for security reasons, so for security and compatibility reasons it is better not to rely on it and to use the superglobal arrays to get those types of values. But that should not be an issue, because he isn't relying on register globals in his script, he is using the superglobals (specifically, $HTTP_GET_VARS, which is one of the superglobal arrays).It is fine to use $HTTP_GET_VARS, it still exists for backwards-compatibility with older versions of PHP. $_GET and $_POST were introduced in PHP 4.1.0, so if you want a script to work with older versions you need to use $HTTP_POST_VARS or $HTTP_GET_VARS instead. It is also worth nothing that they are not the same, if you change a value in $HTTP_GET_VARS, the value will not change in $_GET, they are different variables.So, if this is the question:

can anyone trouble shoot the following code and see if i'm pulling from the url wrong?
Then the answer is that getting values from the URL is fine, there is nothing wrong there. If you're having a problem with the script, it isn't there.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...