Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: url problems

  1. #1
    New Coder
    Join Date
    Aug 2006
    Location
    Decatur Illinois
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    url problems

    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?

    PHP Code:
    // 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 

  • #2
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    your url that is being passed to this page has to be formatted like this

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

    //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'] 

  • #3
    New Coder
    Join Date
    Aug 2006
    Location
    Decatur Illinois
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mic2100
    your url that is being passed to this page has to be formatted like this

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

    //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'] 
    PHP Code:
    // 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?

  • #4
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    PHP Code:
    $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 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •