Thundarfoot
Members-
Posts
72 -
Joined
-
Last visited
Never
Everything posted by Thundarfoot
-
thanks
-
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.
-
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); ?>
-
[SOLVED] Drop down form - option syntax
Thundarfoot replied to Thundarfoot's topic in PHP Coding Help
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. -
[SOLVED] Drop down form - option syntax
Thundarfoot replied to Thundarfoot's topic in PHP Coding Help
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 -
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.
-
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
-
[SOLVED] formating new window? can it be done?
Thundarfoot replied to Thundarfoot's topic in Javascript Help
I am not sure how my topic got moved here...I am working with PHP not javascript...thanks though -
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.
-
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.
-
[SOLVED] variable gets value from url? how?
Thundarfoot replied to Thundarfoot's topic in PHP Coding Help
many thanks -
[SOLVED] variable gets value from url? how?
Thundarfoot replied to Thundarfoot's topic in PHP Coding Help
forgive my ignorance, but how would I type the url to pass that value? mypage.php<variable> -
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!
-
[SOLVED] Need WHERE in query select with inner join
Thundarfoot replied to Thundarfoot's topic in MySQL Help
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 "; -
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.
-
I have a html table in which each cell has a hyperlink to a diffrent .php file currently I am using href target _blank to open in new window. However, I would much prefer to open the link in the current page, but keep the html link table at the top of the page. I could edit each file to include the table...but wonder if there might not be an easier way? something along the lines of a framset or something? Any help is much appreciated.
-
mucho gracias thank you very much~
-
I am a noob, here is my sign: ??? I have a 3 column table as such ..id...armsid...mobid ..1.....40........25 ..2.....100......4 armsid = id for arms table. mobid = id for mob table. I had previously been joining 2 tables together, and was using the below code with a 2 colum join. SELECT * FROM lt_r5_armor LEFT OUTER JOIN mobs ON (lt_r5_armor.mobid = mobs.id) how do I do about making 2 joins at the same time? hope I am making sense. and thank you for your time and help.
-
Hi guys, just want a little bit of advice
Thundarfoot replied to stelthius's topic in PHP Coding Help
this is a good tutorial http://www.tizag.com/mysqlTutorial/ -
I am a noob hre is my sign: ??? I am trying to join 2 tables. a value from table a matches an id from table b.. this code works however some fields in table a contain multiple values when this happens only the first is returned. SELECT * FROM tablea LEFT OUTER JOIN tableb ON (tablea.column2 = tableb.id)"; sample table a Column1 | Column2 | firstentry 10 secondentry 20 30 12 thirdentry 05 above code returns joined entrys from table b for id 10, 20, and 05 but not 30 or 12 I can modify column 2 or its contents if needed to make this work. Thank you in advance for your time and any help you can lend.
-
Thank you!
-
thank you for that link, it helps explain things a lot. But I am still having trouble making it work. I belive the join code I need to use is.. SELECT * FROM cubes LEFT OUTER JOIN mobs ON drops_from.id = mobs.id Should I be placing this in a query? I have tried to add the abovet o a query command but to no avail. here is the code I am working with now... Thank you in advance for any help you can give. mysql_select_db($database_LWC, $LWC); $query_Rs1_cubes = "SELECT * FROM cubes"; $Rs1_cubes = mysql_query($query_Rs1_cubes, $LWC) or die(mysql_error()); $row_Rs1_cubes = mysql_fetch_assoc($Rs1_cubes); $totalRows_Rs1_cubes = mysql_num_rows($Rs1_cubes); mysql_select_db($database_LWC, $LWC); $query_Rs2_Mobs = "SELECT * FROM mobs"; $Rs2_Mobs = mysql_query($query_Rs2_Mobs, $LWC) or die(mysql_error()); $row_Rs2_Mobs = mysql_fetch_assoc($Rs2_Mobs); $totalRows_Rs2_Mobs = mysql_num_rows($Rs2_Mobs); ?> <html> <body> <table border="1"> <tr> <td>id</td> <td>Cube Type</td> <td>Drops From</td> </tr> <?php do { ?> <tr> <td><?php echo $row_Rs1_cubes['id']; ?></td> <td><?php echo $row_Rs1_cubes['Cube Type']; ?></td> <td><?php echo $row_Rs1_cubes['Drops From']; ?></td> </tr> <?php } while ($row_Rs1_cubes = mysql_fetch_assoc($Rs1_cubes)); ?> </table> <p> </p> </body> </html> <?php mysql_free_result($Rs1_cubes); mysql_free_result($Rs2_Mobs); ?>
-
I am a noob working on my second script. I have 2 tables A & B Table A has 3 columns, the third column contains a number which represents the id of an entry in table B. I know how to query table a for its 3 columns and can show that output in a dynamic table. However this just shows the number in the thrid column.... I need to figure out how to take the number and fetch the correct entry from table b instead. Any help would be appreciated. Thank you for your time.
-
ok I have a large text file that I am converting into excel spreadsheet for eventual table in mysql. all I know about csv is that every , comma makes a new cell / field. is there a way to make a line break? For example... one entry, two entry, third entry, (line break) 4th entry, 5th entry, basically I want to make all entry's in my text file (currently sepoerated by , commas) become one column when I open in excel. hope that makes sense, I could go through the file and manually add a line break after every comma...but with 7000 lines with each line having about 18 commas.....ummm there goes my weekend
-
[SOLVED] Query % needs a replacement, ty
Thundarfoot replied to Thundarfoot's topic in PHP Coding Help
solved I needed to use REGEXP '$name'