Page 1 of 1

search/results display help

Posted: Fri Apr 09, 2004 10:06 pm
by saltriver
I am trying to make a simple search of my database. I believe I have the html page sending the form info to the php page, but I don't think the php page is reading it correctly. The form name on the html page is named "moneyinput" and the input is supposed to be a Salary of a Player. In DW, I am making a recordset13 on the php page and filtering with a Form Variable using "moneyinput" and less than(<) with Salary in descending order. It shows up when I run a test in the Recordset Dialog box. I then Insert a Dynamic Table, which lays out a two row table with the names of the categories on top and the dynamic text on he bottom (Recordset13.Player...etc), and all of this has a repeat region. My first 10 attempts resulted in a table with the categories and empty recordsets. My last three have given me an error in addition to that table. The error is:
Warning: 2 is not a valid MySQL result resource in /home/slacker/saltrivergraphics.com/bal/moneyresult.php on line 37

Line 37 is the While statement. I don't think this is the source of my problem since I also have the blank table, but it obviously not good. The third line looks suspect to me. How could that recordset = "1"?

As far as I can tell my problem lies in how I'm trying to DISPLAY the info, since the DW test works. Should the dynamic text on the bottom of the table be reffering to something else, maybe something having to do with the original form from the html page? I would think that would be included in the recordset, but I would think I wouldn't need 13 versions to get it wrong.

Please help.

Salt River Graphics

Code: Select all

<?php require_once('../Connections/slacker_roster_duff.php'); ?>
<?php
$colname_Recordset13 = "1";
if (isset($HTTP_POST_VARS&#1111;'moneyinput'])) &#123;
  $colname_Recordset13 = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS&#1111;'moneyinput'] : addslashes($HTTP_POST_VARS&#1111;'moneyinput']);
&#125;
mysql_select_db($database_slacker_roster_duff, $slacker_roster_duff);
$query_Recordset13 = sprintf("SELECT * FROM bal_teams WHERE Salary < %s ORDER BY Salary DESC", $colname_Recordset13);
$Recordset13 = mysql_query($query_Recordset13, $slacker_roster_duff) or die(mysql_error());
$row_Recordset13 = mysql_fetch_assoc($Recordset13);
$totalRows_Recordset13 = mysql_num_rows($Recordset13);

mysql_free_result($Recordset13);
?>
<table border="1" cellpadding="2" cellspacing="2">
  <tr>
    <td>Player</td>
    <td>Team</td>
    <td>Salary</td>
    <td>Eligible</td>
    <td>Postion</td>
    <td>POS#</td>
    <td>Contract</td>
    <td>Owner</td>
  </tr>
  <?php do &#123; ?>
  <tr>
    <td><?php echo $row_Recordset13&#1111;'Player']; ?></td>
    <td><?php echo $row_Recordset13&#1111;'Team']; ?></td>
    <td><?php echo $row_Recordset13&#1111;'Salary']; ?></td>
    <td><?php echo $row_Recordset13&#1111;'Eligible']; ?></td>
    <td><?php echo $row_Recordset13&#1111;'Postion']; ?></td>
    <td><?php echo $row_Recordset13&#1111;'POS#']; ?></td>
    <td><?php echo $row_Recordset13&#1111;'Contract']; ?></td>
    <td><?php echo $row_Recordset13&#1111;'Owner']; ?></td>
  </tr>
  <?php &#125; while ($row_Recordset13 = mysql_fetch_assoc($Recordset13)); ?>
  </table>

Posted: Sun Apr 11, 2004 9:40 am
by cdickson
I have been using Dreamweaver also, and am switching to hand coding based on what I've learned in this forum and on advice that I have received from others who have obviously been doing this longer.

I just reviewed a document that my DMX generated code in, and except for your suspect line 3, my code is identical, and the page works fine. Did you try removing that line? You can just put double slashes in front of it to make it a comment so you can try it without deleting it.

There is a free PHP editor that one of the experienced forum-goers referred me to: http://www.phpedit.net. You may want to give it a go.

Got it...Well close enough.

Posted: Tue Apr 13, 2004 12:49 am
by saltriver
I finally figured out what I was doing wrong. As usual I was screwing something up very basic and towards the beggining. I work my way back to the form I was using to input the search value. First of all I was using a separate form for the text field and the submit button. Am I wrong or are forms without a submit button useless in a search engine? I figured something was wrong when I couldn't even get a number to pass from one page to the next. I also found out I didn't have to have a second page, which is nice. It took me a while to figure out the Form Variable in the Bindings panel of DW and how that links with the text field in the form. And that suspected "1", I learned is a key (though not in this case) to getting the repeat regoin to work. I took the suggestion to go to phpedit.net, but as usual, no MAC version. That, however sent me on a Google chase that somehow led me to this site:
http://mdp.artcenter.edu/~vanallen/ides ... wk06c.html
All I can say is Phillip Van Allen Rocks. Really. I also decided to download PhAkt, which is a PHP extension for DW. It says you have to make a new "site" with a specific server model. If I designate a folder within my current site as my new site, will that effect either my local files or the behavior of new or old files on the host server? Just askin....

Steve