Jump to content
Codeman0013

url problems

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...