Codeman0013 Posted September 1, 2006 Share Posted September 1, 2006 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 More sharing options...
Jack McKalling Posted September 1, 2006 Share Posted September 1, 2006 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 More sharing options...
[Coyot3] Posted September 2, 2006 Share Posted September 2, 2006 Are you running your script on your localhost or webserver?Check if in your php.ini REGISTER GLOBALS are 'On'!Which erro message you get? Link to comment Share on other sites More sharing options...
Jack McKalling Posted September 2, 2006 Share Posted September 2, 2006 If you host it at a webserver, execute this php instruction in an empty file: echo ini_get('register_globals'); And check if the output says either 0 (off) or 1 (on). It should be 1. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 5, 2006 Share Posted September 5, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now