If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Dreamweaver & MYSQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-23-11, 18:03
ridge1 ridge1 is offline
Registered User
 
Join Date: Jul 2011
Posts: 3
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?
Reply With Quote
  #2 (permalink)  
Old 07-23-11, 19:45
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
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
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #3 (permalink)  
Old 07-28-11, 11:30
Crawfish Crawfish is offline
Registered User
 
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!)
Reply With Quote
  #4 (permalink)  
Old 07-28-11, 12:28
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
Me too!! No hair left
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On