...

View Full Version : url problems



Codeman0013
09-01-2006, 08:30 PM
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

mic2100
09-01-2006, 08:38 PM
your url that is being passed to this page has to be formatted like this




http://www.yoursite.com/employees.php?employeeID=19






//also there is now a shorter way to do get calls this depends wot version of php u r using

$empid = $_GET['employeeID'];

//use the $empid variable in your recordsets in place of $HTTP_GET_VARS['employeeID']

Codeman0013
09-01-2006, 08:48 PM
your url that is being passed to this page has to be formatted like this




http://www.yoursite.com/employees.php?employeeID=19






//also there is now a shorter way to do get calls this depends wot version of php u r using

$empid = $_GET['employeeID'];

//use the $empid variable in your recordsets in place of $HTTP_GET_VARS['employeeID']




// begin Recordset
$colname__rs_employeeinfo = '1';
if (isset($empid = $_GET['employeeID'];)) {
$colname__rs_employeeinfo = $empid = $_GET['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($empid = $_GET['employeeID'];)) {
$colname__rs_employeeqa = $empid = $_GET['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


now this gives me the error of Parse error: syntax error, unexpected '=', expecting ',' or ')' in /u/internet/com/brintlinger-earl/test3.php on line 10

what did i do wrong?

mic2100
09-02-2006, 01:39 PM
$empid = $_GET['employeeID'];
// begin Recordset
$colname__rs_employeeinfo = '1';
if (isset($empid)){
$colname__rs_employeeinfo = $empid;
}
$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($empid)){
$colname__rs_employeeqa = $empid;
}
$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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum