Jump to content

homchz

Members
  • Posts

    93
  • Joined

  • Last visited

    Never

Everything posted by homchz

  1. You do not seem to be redefining the health variables in the where statement. Try this: [code] <?php session_start(); require_once('header.php'); if (!$_SESSION['valid_user']) { echo 'you are not logged in'; die(); } $user=$_SESSION['valid_user']; //queries the things needed for the player. $query="select playerid, user, name, email, gold, fatigue, lose, win, maxfat, power, speed, dex, intel, health, maxhealth, gender, battle from players where user='$user'"; $result=mysql_query($query); if (!$result) { die (mysql_error()); } //queries the things need for the NPC in this case the dragon. $query2="select playerid, user, name, email, gold, fatigue, maxfat, power, speed, dex, intel, health, maxhealth, gender from players where user='Dragon'"; $result2=mysql_query($query2); if (!$result2) { die (mysql_error()); } $num_rows=mysql_num_rows($result); //fetching the rows needed for the player. $row=mysql_fetch_array($result); $playerid=($row['playerid']); $name=($row['name']); $gold=($row['gold']); $user=($row['user']); $fatigue=($row['fatigue']); $maxfat=($row['maxfat']); $power=($row['power']); $speed=($row['speed']); $dex=($row['dex']); $intel=($row['intel']); $health=($row['health']); $maxhealth=($row['maxhealth']); $gender=($row['gender']); $battle=($row['battle']); $lose=($row['lose']); $win=($row['win']); $_SESSION['valid_user'] = $user; //fetching the rows needed for the NPC in this case the Dragon $row=mysql_fetch_array($result2); $name2=($row['name']); $power2=($row['power']); $speed2=($row['speed']); $dex2=($row['dex']); $health2=($row['health']); $maxhealth2=($row['maxhealth']); ?> <HTML> <HEAD> <style type="text/css" media="all">         @import "css.php";     </style>     <TITLE>TWOTTK.COM</TITLE> </HEAD> <TABLE width=100% border=0 cellpadding=0 cellspacing=0> <TR>     <TD colspan=5>         <p align="center">         <img src="http://www.twottk.com/game/banner.jpg" width="730" height="160"></p>         <TABLE border=0 cellpadding=0 cellspacing=0>             <TR><TD>                              </TD></TR>         </TABLE> <center><p><nobr><a href="home.php">Home</a> | <a href="town.php">Town</a> | <a href="search.php">Search</a> | <a href="hospital.php">Hospital</a> | <a href="gym.php">Gym</a> | <a href="http://www.twottk.com/forum/">Forum</a> | <a href="account.php">Account</a> | <nobr><a href="logout.php">Logout</a></nobr> </center>     </TD> </TR> <TR height=20><TD colspan=5 align=left><!-- SPACER --></TD></TR> <TR>     <TD align=left width=5><!-- SPACER --></TD>     <TD align=left WIDTH=20% valign=top>         <TABLE border=0 cellpadding=0 cellspacing=0 height="85" width="164">         <TR>             <TD colspan=2 width=164 height="17"><hr></TD>         </TR>         <TR>         <?php require_once('cssloggedin.php'); ?>                         <TR>             <TD colspan=2 width=164 height="30">             Game Stats:<br>         Name:            <?php         echo "$name ($playerid)";         ?><br>         Gender:         <?php            echo "$gender";         ?><br>         Gold:         <?php            echo "$gold";         ?><br>             Health:             <?php             echo "$health / $maxhealth";             ?><br>             Fatigue:             <?php             echo "$fatigue / $maxfat";             ?><hr>             <p></TD>         </TR>         <TR height=20>             <TD height="1" width="164"><!-SPACER-></TD>         </TR>         <TR>             <TD colspan=2 width=164 height="1">             </TD>         </TR>         <TR>             <TD width=164 bgcolor=#FFFFFF valign=top height="12"><samp>Logged             In:             <?php             echo date ('jS F'); ?><p></samp></TD>             <TD width=1 bgcolor=#FFFFFF height="12"></TD>         </TR>         <TR>             <TD colspan=2 width=164 height="12"> <hr>            </TD>         </TR>         </TABLE>         <BR>     </TD>     <TD align=left width=1%><!-- SPACER --></TD>     <TD align=left WIDTH=78% valign=top>     <TABLE width=744 border=0 cellpadding=0 cellspacing=0 height="12">             <TR>                 <TD valign=top align=left width=4 height="12"></TD>                 <TD valign=top align=center background=templates/default/images/menuback.gif width="736" height="12"><hr></TD>                 <TD valign=top align=right width=4 height="12"></TD>             </TR>         </TABLE><TABLE width=740 border=0 cellpadding=0 cellspacing=0>             <TR>                 <TD width=1 bgcolor=#FFFFFF></TD>                 <TD bgcolor=#FFFFFF width="733" > <?php $i=0; // Battle forumla for Player $damage=($power*3); $rand=rand(1,10); $rand=($rand/10); $dex3=($dex2*$rand); $dex2=($dex*2); $truedam=($damage-$dex2); // battle forumla for dragon $damage4=($power2*3); $rand=rand(1,10); $rand=($rand/10); $dex3=($dex2*$rand); $truedam2=($damage4-$dex3); while ( $health > 0 AND $health2 > 0 ) { echo "You Hit Dragon for $truedam.<br>"; // update dragon health $newhealth2=($health2-$truedam); $health2 = $newhealth2; $sql2="UPDATE players SET health='$newhealth2' WHERE user='Dragon'"; $query = mysql_query($sql2); if($health2 == 0) { echo "you have defeated the dragon"; die(); } echo "Dragon Hit You For $truedam2.<br>"; // update player health $newhealth=($health-$truedam2); $health = $newhealth; $sql2="UPDATE players SET health='$newhealth' WHERE user='$user'"; $query2 = mysql_query($sql2); if($health == 0) { echo "Dragon Has Killed You UNLUCKY"; die(); } } ?>                 <p>&nbsp;</p>                 <p>&nbsp;</p>                 <p>&nbsp;</p>                 <p>&nbsp;</p>                 <p>&nbsp;</TD>             </TR>         </TABLE>         <p>&nbsp;</p>         <TABLE width=748 border=0 cellpadding=0 cellspacing=0 height="39">             <TR>                 <TD valign=top align=left width=4 height="39">&nbsp;</TD>                 <TD align=center background=templates/default/images/menu_bottom.gif width="740" height="39"><hr></TD>                 <TD valign=top align=right width=4 height="39">&nbsp;</TD>             </TR>         </TABLE>         <br><CENTER>         <p></p>         </CENTER>     </TD>     <TD align=left width=10><!-- SPACER --></TD> </TR> </TABLE> </BODY> </HTML> [/code]
  2. I meant have you seen that what you are putting in the table is what is you put in the form.
  3. Can you see how it is being put into the database, before you extract it? I still think it is a db issue and not PHP I do not have to add any special funtions to pull quotes or quoted phrases out of my db tables.
  4. Do you have this in a function or a class? I tried to build this into a funtion and got the same results. Post up the full function if you can I'd like to take a look at it. If you built this into a function remember you need to bring the damage variable in, as it is not taking anything away and just looping forever.
  5. I do not understand what would make it need to be this confusing. Why noe just have a switch for the page, then if there is more info that is needed on that certian page then switch again within the called page. www.domain.com/index.php?page=page1&content=p1 or www.domain.com/index.php?page=page2$content=p3 this way you can have all your pages, and any amount of content inside. You just need to think back one more step and have one page that calls all of your numbered pages and it should work fine.
  6. not having your tables or other info I built this that works until zero, maybe you can peice the parts you need back in. I added variable to help me test it. [code] <?php $h1 = "5"; $h2 = "4"; $damage = "1"; while($h1 > 0 && $h2 > 0) {         $h1 = ($h1 - $damage);     print "The dragon hit you for $damage<br/>";     print "Your health is:$h1<br/><br/>";          if($h1 == 0 )     {         print "The Dragon Has Killed You";         exit;     }          $h2 = ($h2 - $damage);     print "You hit the Dragon for $damage<br/>";     print "The Dragon's health is:$h2 <br/><br/>";              if ($h2 == 0)     {         print "You have killed the Dragon<br/>";         print "Your health is now:$h1";         exit;     } } ?> [/code]
  7. How do you have your database table set up? I am using a text field and I can add quotes all I want. I have a feeling it is a mySQL issue not your PHP code.
  8. Thanks that works great, And thanks for the -1 in the substr(), that would have been my next question. Josh
  9. That works great for getting the values together, thanks. However it inserts "Array" into the db table and not the numbers. could I then insert the numbers as $categery[$i] after a count and a for stamement or am I over thinking this??
  10. I would like to have a list of check boxes and have each value entered into a db table feild seperated by a comma for separation later. I have tried having a group of check boxes with the same name posted into the db but it only grabs the last one. <input name='category' type='checkbox' dir='ltr' value='9,' /.> <input name='category' type='checkbox' dir='ltr' value='10,' /> <input name='category' type='checkbox' dir='ltr' value='11,' /> <input name='category' type='checkbox' dir='ltr' value='12,' /> <input name='category' type='checkbox' dir='ltr' value='13,' /> I want to $_POST['category'] and if all are checked I would get 9,10,11,12,13, Is this even possible? Thanks, Josh
  11. While creating my blog I have stumbled opun a problem. I want to keep the code and the design seperate for the most part so I am trying to do this: Post Function: [code] function blog_index()         {             $this->table = "blog_posts";             $this->query = mysql_query("SELECT * FROM $this->table ORDER BY 'id' DESC");                      if(mysql_num_rows($this->query) > "0")             {                 while($this->result = mysql_fetch_array($this->query))                 {                     global $topic, $cat1, $cat2, $post, $img, $image_text, $date, $count;                                          $topic = $this->result['topic'];                     $cat1  = $this->result['category1'];                     $cat2  = $this->result['category2'];                     $post  = nl2br($this->result['post']);                     $img   = $this->result['image'];                     $image_text = $this->result['image_text'];                     $date = $this->result['date'];                     $count = count($this->result['id']);                                                           }             }         } [/code] Then the function is called in the index page where the design template is called, the template looks like this [code] <div id="left_col">         <h2 class="blog_header"><?php print $topic ?></h2>         <h3 class="blog_date"><?php print $date ?></h3>         <p><?php print $post ?></p> </div> [/code] As you see I call the global variables within the template, but as you can also guess there is no repeating region, so it will only print the first record. I want to try and keep all the design info in the template and only call my variables when i need them. Is this possible?? Thanks for any info, Josh
  12. Barnes & Noble carries a bunch of books. (not sure where they ship too) For some good DMX info check out http://www.dmxzone.com
  13. homchz

    v2

    Looks nice, My onlu comment is on the Spirit, Responcibility, Envolvement. The text does not match anything else and looks off.
  14. Is your server your own or hosted? Try a clip under 2MB in size as most default PHP settings and hosts only allow for 2MB uploads at a time to help server performance. Most MP3's are over 2MB Josh
  15. You cannot use ASP extentions for PHP, and visa versa, most extentions do have two versions if needed.
  16. I do not beleive you need a testing sever to "edit" php files but you will need one to see if what you have edited works. DMX does not have a virtual server you have to set one up on your machine if you want a testing server without having to hook up to a second machine. I use phpdev from firepages a simple install for a tesing server. Download once and it installs everything. http://www.firepages.com.au/ Hope this helps Josh
  17. I believe you are making you query to complex for DMX SELECT * FROM tbl_recipes WHERE recipe_detail LIKE 'svar' do you want it to be like or equal what "svar" equals if you are going for exact I would do SO far I have set a recordset with: SELECT * FROM tbl_recipes WHERE recipe_detail = 'svar' I think DMX like the '-----' around the variable too for whatever reason so you might try just adding those.
  18. Not and expert but every Record Set I make the Variable always equals 1
  19. I don't use the hidden field until the confirm page. User enters there email address and hits submit Next page show Email address and name from a record set based on the search from previous page. I put all the information on this page in a form, as well as a hidden field with the email address in it. When they hit the delete button it goes to the "delete" page that runs the scrip and deletes the row based on the Email address provided, then redirect to a basic thank you page. That is how I have done it. But I might not be explaining it right. Record set to display what to delete, Hidden field on diplay page to pass to delete page Delete page runs script and redirects when done. Josh
  20. I think this extension could be set up to do that not cheap but easy. http://www.dmxzone.com/showDetail.asp?TypeId=3&NewsId=5628 I think you can set it up to deliver on submit and you could enter database information to display in the mail. They have an okay support forum be sure to ask question be fore you buy, I use it but not for your funtion, and I only think it will work. I am sure there is a Send mail sript out there that can do the same but will take some time to code.
  21. it still has to be done through a form with a hidden field containing the info to find and delete (I use Email addresses so people can unsubscribe from my mailing list) in the form to pass to the delete page. Then you link the form to the delete page. he delete page runs the script, and redirects to the page you tell it to when setting it up.
  22. Would it not be easier to use CSS for this then build what you need in PHP around that? How many colors? As I do not use CSS but.. I just put the colors in the backround of the table I want then use a repeating region for the table to repeat the look. I use it with images in tables and text here. http://www.joshua-jones.com
  23. I have never done it, but I am not sure it is possible. Though it could be What I think you might want to do is have a preview page to look at the info you just supplied to make sure it is right before you actaully insert it. I beleive that is done with hidden form fields holding the info and passing them to the next page. If you have trouble I can try a few things to make what you need and see if I can explain it. Not that I think of it though you could build a page that will just display the last part added buy making a query that displays by the id decsending so it woudl be SELECT 'id', title1, hadithid FROM bukharititle order id DESC if you only allow one record to show it will always be the last one. So when you enter the data and submit direct that page to a page running the above recordset, and you shoudl see what you just entered. I have not tested this but it makes sence in theory. Good Luck Josh Any questions let me know
  24. This one was very hard for me to get as well but I use a confirmation page the part I missed was passing the info through a hidden field to the delete page, and the fact the delete page was actually just blank page to run the delete script got me for a while too. In ecence you will need three pages to create this Page to enter record to delete w/ a hidden field to pass to the Page running the delete script that redirects to Page you choose to redirect to. I hope this helps some, but if you need more help I can try, I am not the best at explaining how to acheve things on the web. Good luck Josh
  25. Your Email would not go through Copied and pasted here Elyas, I found a few issues with your page I will try to explain them. First off you had your Form linked to form.php not form1.php The Record Set had a few problems. Your origonal looked like: SELECT 'id', title1, hadithid FROM bukharititle WHERE 'id' = 'colname' I belive when you use 'id' it means the word not the actual values (I am not sure about this but when I tested it searching by hadithid it it woudl only diplay id in the table not the actual id number. For some reason it was placing <?php echo id;?> in the form not the result of the record set. I changed the query to this SELECT id, title1, hadithid FROM bukharititle WHERE hadithid = 'colname' I did this for two reasons getting rid of the 'id' and making it just id will now bring up the actual number, searching by the id is not a very good idea (in my opinion) because that is set by the table not you, and I assume you know what the corresponding hadithid is so that provides a better search you may change this if you wish by simply changing the WHERE clause to say id not hadithid. One issue with seaching by id is (again I am assuming just because I cannot get it to work right and do not have all the answers) when you search by id it will always fill the first row of the whether there is a value or not when you open the page there will be a default result even before you search, however how you nwat to set that up is up to you. I hope this helps I am sending you back your php file as I have edited it, you will have to change the connection string as I did not know what yours was, ans you will have to change the record set as I made a new one using my connection, and it will not work on your server. Just follow the text above and you shoudl be all set. You can also just edit your as I have, and youshoudl be okay. The one to remember is the form link, you have ot point that to form1.php as that is the location of the results. Hope this helps Joshua Jones
×
×
  • 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.