Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011
    Posts
    3

    Unanswered: Dreamweaver & MYSQL

    Hiya Guys

    Trying to create a Search page in dreamweaver to search my MYSQL database.

    I created the Search Form

    PHP Code:
    <form name="form1" method="POST" action="NEW.php">
      <
    input type="text" name="EmployeeName">
      <
    input type="submit" name="Submit" value="Submit">
    </
    form
    and created the result page

    PHP Code:
    <table border="1">
      <tr>
        <td>EmpID</td>
        <td>EmployeeName</td>
        <td>JobDate</td>
        <td>ProjectName</td>
        <td>CustomerID</td>
        <td>Address</td>
        <td>ArriveTime</td>
        <td>BreakStart</td>
        <td>BreakEnd</td>
        <td>DepartTime</td>
        <td>TotalTime</td>
        <td>Materials</td>
        <td>Notes</td>
      </tr>
      <?php do { ?>
      <tr>
        <td><?php echo $row_Recordset1['EmpID']; ?></td>
        <td><?php echo $row_Recordset1['EmployeeName']; ?></td>
        <td><?php echo $row_Recordset1['JobDate']; ?></td>
        <td><?php echo $row_Recordset1['ProjectName']; ?></td>
        <td><?php echo $row_Recordset1['CustomerID']; ?></td>
        <td><?php echo $row_Recordset1['Address']; ?></td>
        <td><?php echo $row_Recordset1['ArriveTime']; ?></td>
        <td><?php echo $row_Recordset1['BreakStart']; ?></td>
        <td><?php echo $row_Recordset1['BreakEnd']; ?></td>
        <td><?php echo $row_Recordset1['DepartTime']; ?></td>
        <td><?php echo $row_Recordset1['TotalTime']; ?></td>
        <td><?php echo $row_Recordset1['Materials']; ?></td>
        <td><?php echo $row_Recordset1['Notes']; ?></td>
      </tr>
      <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>
    </table>
    <?php require_once('Connections/NEW.php'); ?>
    <?php
    $maxRows_Recordset1 
    10;
    $pageNum_Recordset1 0;
    if (isset(
    $_GET['pageNum_Recordset1'])) {
      
    $pageNum_Recordset1 $_GET['pageNum_Recordset1'];
    }
    $startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

    $colname_Recordset1 "1";
    if (isset(
    $_GET['EmployeeName'])) {
      
    $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['EmployeeName'] : addslashes($_GET['EmployeeName']);
    }
    mysql_select_db($database_NEW$NEW);
    $query_Recordset1 sprintf("SELECT EmployeeName, JobDate FROM Jobs WHERE EmployeeName LIKE '%%%s%%'"$colname_Recordset1);
    $query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
    $Recordset1 mysql_query($query_limit_Recordset1$NEW) or die(mysql_error());
    $row_Recordset1 mysql_fetch_assoc($Recordset1);

    if (isset(
    $_GET['totalRows_Recordset1'])) {
      
    $totalRows_Recordset1 $_GET['totalRows_Recordset1'];
    } else {
      
    $all_Recordset1 mysql_query($query_Recordset1);
      
    $totalRows_Recordset1 mysql_num_rows($all_Recordset1);
    }
    $totalPages_Recordset1 ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
    ?>
    <?php
    mysql_free_result
    ($Recordset1);
    ?>
    I have also created the recordset and set the filter on the name "EmployeeName" I tested this using dreamweaver and success, I entered the "Name" and it displayed 100%

    as soon as I test LIVE online, it returns no results and I'm stuck

    Any help?

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Your form definition you are stating method="POST". But in your PHP code you are using $_GET. Either change $_GET to $_POST or change it to $_REQUEST which handles both types.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  3. #3
    Join Date
    Jul 2011
    Posts
    3
    Quote Originally Posted by it-iss.com View Post
    Either change $_GET to $_POST or change it to $_REQUEST which handles both types.
    I had a similar problem like this a few weeks back. $_REQUEST was the solution for me, as well.

    Good eyes, Ronan. (though, I guess you don't need confirmation from me!)

  4. #4
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Me too!! No hair left
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

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