-
Posts
186 -
Joined
-
Last visited
About Kryllster
- Birthday 04/26/1962
Profile Information
-
Gender
Male
-
Location
Indiana
Contact Methods
-
Yahoo
kryllster
Kryllster's Achievements

Regular Member (3/5)
0
Reputation
-
I am trying to make an rpg another one I might add. I have a basic script that adds the right loot items and prices and descriptions. It has a post form to submit but when I do it only sells the first itme in the list and not the one that is checked with a radio button any help? <img src="images/inventory.jpg" alt="" /> <table width="100%" cellpadding="1" cellspacing="0" border="2"> <tr colspan="7"> <td>Slot</td><td>Item</td><td>Level<td>Power</td><td>Sell Price</td><td>Sell Item</td><td>Wear Item</td> <?php // include char files and loot files include "php/db/db_config.php"; // create variables from db and loot $username = $_SESSION['username']; $player_id = $account_info['player_id']; // select from loot db $result = mysqli_query($my_database,"SELECT * FROM inventory WHERE username = '$username'") or die (mysqli_error($my_database)); //$counter = 0; while ($row = mysqli_fetch_assoc($result)) { echo '<tr>'; echo '<td>'; //$counter++; //echo $counter; echo '</td>'; echo '<td>'; echo $row['item']; echo '</td>'; echo '<td>'; echo $row['level']; echo '</td>'; echo '<td>'; echo $row['power']; echo '</td>'; echo '<td>'; echo $row['sell_price']; $row['sell_price']; echo '</td>'; echo '<td>'; echo '<form action="index2.php?content=sell_item" method="post">'; echo '<input type="radio" name="id">'; echo '<input type="submit" value="Sell This Item">'; echo '</form>'; echo '</td>'; echo '<td>'; echo '<form action="loot/wear_item.php" method="post">'; echo '<input type="hidden" name="two">'; echo '<input type="submit" value="Wear This Item">'; echo '</form>'; echo '</td>'; echo '</tr>'; } ?> </table>
-
Sorry for the post I had a problem with the sql in the inventory table I figured it out right after this post sorry.
-
MySQL version 5.1.73-cll I can't seem to get the inventory table to insert the information I have stared in an array any help would be appreciated!! <?php $username = $_SESSION['username']; ini_set('display_errors',1); error_reporting(E_ALL); //include "php/db/db_config.php"; include "php/db/db_config.php"; include "php/db/item_connect.php"; $id = $items_id['id']; $player = $account_info['player_id']; //Update database $sql = mysqli_query($my_database,"INSERT INTO inventory ( player_id, username, id ) VALUES('$player', '$username', '$id')"); //echo values of item id echo "<div class=\"loot\">"; echo "<b>Required Level:" . $items_id['requ_level'] . "</b><br />"; echo "<b>Name:" . $items_id['name'] . "</b><br />"; echo "<b>Min Str:" . $items_id['min_str'] . "<br />"; echo "<b>Min Int:" . $items_id['min_int'] . "<br />"; echo "<b>Min Dex:" . $items_id['min_dex'] . "<br />"; echo "<b>Type:" . $items_id['type']. "<br />"; echo "<b>Min Physical Dmg:" . $items_id['min_dmg'] . "<br />"; echo "<b>Max Physical Dmg:" . $items_id['max_dmg'] . "<br />"; echo "<b>Min Magic Dmg:" . $items_id['mag_attk_min'] . "<br />"; echo "<b>Max Magic Dmg:" . $items_id['mag_attk_max'] . "<br />"; echo "<b>Phys Defense:" . $items_id['phy_def'] . "<br />"; echo "<b>Magical Defense:" . $items_id['mag_def'] . "<br />"; echo "</div>"; ?> I get no errors or notices and the info fields show up as being populated.
-
I have some code I used to have in mysql and now im trying to convert to mysqli and I cant seem to find out what the problem is. <?php $username = $_SESSION['username']; // Connect to server and select databse. include "db_connect.php"; include "db_config.php"; // items tables selection $sql = mysqli_query($my_database,"SELECT * FROM items_tbl WHERE level = '$account_info[player_level]' ORDER BY rand()"); //$result = mysqli_query($my_database,$sql); // Put info into array (This Works) while($item = mysqli_fetch_assoc($sql)){ //stats $items_id['itemid'] = $item['itemid']; $items_id['Level'] = $item['Level']; $items_id['name'] = $item['name']; $items_id['min_str'] = $item['min_str']; $items_id['min_int'] = $item['min_int']; $items_id['min_dex'] = $item['min_dex']; $items_id['type'] = $item['type']; $items_id['min_dmg'] = $item['min_dmg']; $items_id['max_dmg'] = $item['max_dmg']; $items_id['phys_defense'] = $item['phys_defense']; $items_id['mag_defense'] = $item['mag_defense']; } ?> here is the error im getting: Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given
-
I had my own way of doing this until I started worjing with a friend.He gave me a pice of code to use and I have no idead how to get it to work (he is way more advanced than me) here is the code I cant figure out what to do with it. <?php function logged_in(){ if (isset ($_SESSION['username'])){ $_SESSION['username'] == true; } } if(logged_in()) { echo "<div id=\"navi\">";include "content/website/header.php";"</div>"; echo "<div id=\"content\">";include "layout/game.php";"</div>"; echo "<div style=\"clear:both;\"></div>"; echo "<div id=\"footer\">";include "content/website/footer.php";"</div>"; } else { echo "<div id=\"navi\">"; include "content/website/main_header.php"; "</div>"; echo "<div id=\"content\">"; include "layout/content.php"; "</div>"; echo "<div style=\"clear:both;\"></div>"; echo "<div id=\"footer\">"; include "content/website/main_footer.php"; "</div>"; } ?> Anywy I basicaly have the main website where the else clause is and the site for my game in the logged in pard . What to do??
-
Ok thanks mac I didnt know that I did turn on all error reporting in the master php.ini and now I cant even log in. I have switched on the recommendadtion to a different structur for my sites and now it looks like im gonna have to redo all the code.
-
I am trying to make a session based quest sytem for a game im making. I have some code but im not sure why it isnt working. I get the basic info from a database but everytime I click on a link to fight a monster I get a blank page. <?php // connect to db include 'php/db/vanguard_db_config.php'; // Select data from database $sql = "SELECT * FROM assignments WHERE assignment_id='1'"; $result = mysql_query($sql); // Put info into array Hopefully while($entry = mysql_fetch_assoc($result)){ $id = $entry['assignment_id']; $assignname = $entry['assignment_name']; $numarrest = $entry['num_to_arrest']; $villianarrest = $entry['villian_to_arrest']; $num_arrested = $entry['num_arrested']; $completed = $entry['completed']; $reward = $entry['reward']; $stat = $villianarrest; // session assignment manipulation if(!isset($_SESSION['assignment_id'])) ($id = $_SESSION['assignment_id']){ $_SESSION['assignment_id'] = $id; } if(!isset($_SESSION['num_to_arrest'])){ $_SESSION['num_to_arrest'] = 10; } if(!isset($_SESSION['completed'])){ $_SESSION['completed'] = 1; } if( $_SESSION['num_to_arrest'] != 10){ $_SESSION['num_to_arrest'] + 1; } id($num_arrested == 10{ $sql = "UPDATE assignments SET // Update database with loot and level advance money = money + 20000; WHERE assignment_id = '$id'"; mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); } if($num_arrested == 10){ echo "<h2>You Have Completed Your Assignment and received $20,000 Dollars!</h2>"; } } ?> Thanks for any input in advance!
-
Im not getting any error message if the file is in the pages directory I guess what Im looking for is an error message that says something to the effect that the file is unavailabe with a custom error message instead of what was posted earlier.
-
Sorry about that, Im just tired, Im trying to write something that is way over my head and Im sorry for taking up your time.
-
Yeah it does seem a little backwords I tried copying your code it didnt work for my site Im not sure what else to do from here Im gooleing my butt off trying to find an answer!
-
<?php // header include('pages/main_header.php'); $dir = 'pages/'; $files = scandir($dir); $page = (!isset($_GET['page'])) ? 'intro' : $_GET['page']; if (!in_array($_GET['page'], $files)){ require_once('pages/' . $page . ".php"); } else { echo "This page does not exist!!"; } //footer include('pages/main_footer.php'); ?>
-
Ok well it looks like I jusmped the gun I only tested default.php?page=test when I had a folder in the main directory called test. After I delelted that folder the same error messages pop up. =========================================================== Warning: require_once(pages/test.php): failed to open stream: No such file or directory in C:\xampp\htdocs\vang\default.php on line 8 Fatal error: require_once(): Failed opening required 'pages/test.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\vang\default.php on line 8 ============================================================= back to the drawing board
-
Works perfectly thanks so much I see the problem tho. I would maybe have gotten it prolly not like thatnks to all for your suggestions and the final solution.
-
here is the var_dump(); ================================ array(37) { [0]=> string(1) "." [1]=> string(2) ".." [2]=> string(9) "about.php" [3]=> string(11) "airport.php" [4]=> string(13) "amusement.php" [5]=> string(11) "brawler.php" [6]=> string( "chat.php" [7]=> string(10) "combat.php" [8]=> string(12) "congrats.php" [9]=> string(10) "create.php" [10]=> string(10) "defeat.php" [11]=> string(12) "downtown.php" [12]=> string(10) "footer.php" [13]=> string(10) "header.php" [14]=> string(12) "industry.php" [15]=> string(9) "intro.php" [16]=> string(13) "loggedout.php" [17]=> string(12) "magician.php" [18]=> string( "main.php" [19]=> string(15) "main_footer.php" [20]=> string(15) "main_header.php" [21]=> string(12) "maindrag.php" [22]=> string( "news.php" [23]=> string(7) "old.php" [24]=> string(15) "playerstats.php" [25]=> string(12) "recovery.php" [26]=> string(13) "safeplace.php" [27]=> string(10) "sewers.php" [28]=> string(9) "slums.php" [29]=> string(9) "stats.php" [30]=> string(11) "suburbs.php" [31]=> string(10) "tanker.php" [32]=> string(16) "technologist.php" [33]=> string(4) "test" [34]=> string(11) "victory.php" [35]=> string(16) "vilinterface.php" [36]=> string(13) "weaponeer.php" } ====================================== I dont know what exactly all that means but its reading the files in the directory.
-
I tried this but it didnt work and Im not sure about the custom error page ======================================================== <?php // header include('pages/main_header.php'); $dir = 'pages/'; $files = scandir($dir); $page = (!isset($_GET['page'])) ? 'intro' : $_GET['page']; if (!in_array($page, $files)){ require_once('pages/' . $_GET['page'] . ".php"); } else { echo "That Page Does Not Exist"; } //footer include('pages/main_footer.php'); ?> This didnt work!!