Jump to content

Thundarfoot

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Thundarfoot's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a problem with adding page navigation to my script. My problem is when the user clicks the navigation button I get this error 'empty (sub)expression' from regexp. what I need to do is take the below code where I assign my variable and make it use the last value it held if a null value is returned? is that possible? $name = $_POST['select']; // Gets its value from a drop down selct form // Thanks for your help.
  2. I have a problem with a script I am working on the script worked until I began trying to add pagination(via dreamweaver) now when I try to change page I get an error. the error msg I get is...Got error 'empty (sub)expression' from regexp. I have a drop down select form in a block whose value when submited gets stored as $name and used in a query via regexp.. basically the script outputs the first 10 results, but when I next page I get the error from the regexp value being empty.. here is the code I am working with, I really appreciate any advice on how to get this working. If I output all records and remove navigation then it works...but when I use navigation it seems the drop down select form loses its value and returns a error. The code is ~100lines sorry for its bloatness. I am not sure what section to focus on. thank you for your time and knowledge. <?php if (!defined('MODULE_FILE')) die('You can\'t access this file directly...'); require_once('mainfile.php'); require_once('../LootWhore/Connections/LWC.php'); $module_name = basename(dirname(__FILE__)); get_lang($module_name); $pagetitle = '- You Module Name'; // If you need this to be multi-lingual then you will have to use language defines include_once 'header.php'; $currentPage = $_SERVER["PHP_SELF"]; $maxRows_Recordset1 = 10; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_LWC, $LWC); $query_Recordset1 = "SELECT * FROM lt_r2_def LEFT OUTER JOIN mobs ON (lt_r2_def.mobid = mobs.id)"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $LWC) 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; $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); ?> <html> <body> <div align="center"> <table width="90%" border="0"> <tr> <th colspan="5" scope="col">All Mobs That Drop R2 Defense Cubes </th> </tr> <tr> <table border="1"> <tr> <td>Creature Name</td> </tr> <?php do { ?> <tr> <td><?php echo $row_Recordset1['Creature Name']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table></td> <td colspan="3" rowspan="3"> </td> </tr> <tr> <td> <table border="0" width="50%" align="center"> <tr> <td width="23%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s&file=R2Deflt", $currentPage, 0, $queryString_Recordset1); ?>"><img src="First.gif" border=0></a> <?php } // Show if not first page ?> </td> <td width="31%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s&file=R2Deflt", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>"><img src="Previous.gif" border=0></a> <?php } // Show if not first page ?> </td> <td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s&file=R2Deflt&file=R2Deflt", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>"><img src="Next.gif" border=0></a> <?php } // NEXT Show if not last page ?> </td> <td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s&file=R2Deflt", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>"><img src="Last.gif" border=0></a> <?php } // Show if not last page ?> </td> </tr> </table></td> </tr> <tr> <td> </td> </tr> </table> </div> </body> </html> <?php mysql_free_result($Recordset1); ?>
  3. thank you for the php example works like a charm. I simply made the first option read Choose file and left its value blank..again thanks for the help to both of you.
  4. I want to select option 1 or 2 from the drop down list, click submit, and have file1.php or file2.php load in the current brrowser window. thank you for your time
  5. here is what I have(which obviously does not work lol) <form id="form1" name="form1" method="post" action=""> <label>Files <select name="select"> <option value="http://localhost/file1.php">File 1</option> <option value="http://localhost/file2.php">File 2</option> </select> </label> <input type="submit" name="submit" value="submit"> Basically I think my option value is wrong... any help is much appreciated.
  6. I am working on a php page I have a generated table with the output from a query. the table only takes up about half the page. The last column of the table contains a small icon, icon links to another .php page My question is instead of opening that icon link in a new page or window, could I open in inside a cell of a table or something? There is a lot of wasted space beside the query table, I would like to use to display the contents of the icon link.... is this possible? Thank you
  7. I am not sure how my topic got moved here...I am working with PHP not javascript...thanks though
  8. I am displaying the results of a query in table bu using <td><?php echo $row_Recordset1['column name']; ?></td> I am only displaying the results of 1 column, and instead of a long page of single results a b c I would prefer to make the output display from left to right. a b c d is this possible and if so how? Thank you for your time and knowledge.
  9. I am a noob working on my first page. I have a couple of href links that open in a new page with _blank. when those windows open they are regular browswer windows. Is there anyway I can make a popupwindow that only has my content? a custom window if you will? any help or advice or examples would be great. thank you for your time.
  10. forgive my ignorance, but how would I type the url to pass that value? mypage.php<variable>
  11. I am a noob, building a script. I would like to be able to use the url line to assign a variable. Can anyone show an example of how to make $cn get its numerical value from the url line? Thanks!
  12. hmm guess you cant use colored text inside code block SELECT * FROM lt_skillcards WHERE mobid = 1 INNER JOIN mobs ON lt_skillcards.mobid = mobs.id INNER JOIN skill_cards ON lt_skillcards.armsid = skill_cards.id ";
  13. I am a noob: here is my sign ??? I have a query select that is joining 3 tables, works great (thanks to the help here). I am trying to build in a WHERE clause but am having trouble with the syntax. The below code is what I am working with, the red text is where I am trying to add the WHERE $query_Recordset1 = "SELECT * FROM lt_skillcards [color=red]WHERE mobid = 1 [/color] INNER JOIN mobs ON lt_skillcards.mobid = mobs.id INNER JOIN skill_cards ON lt_skillcards.armsid = skill_cards.id "; Thank you in advance for your time.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.