Jump to content

LOUDMOUTH

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

Everything posted by LOUDMOUTH

  1. Dont know much about this is why I am asking, looks to me like there should be a space in between, but still throws error
  2. I am trying to query this and am getting a syntax error, am I doing this completely wrong? haha query -- Table structure for table `adds` CREATE TABLE IF NOT EXISTS `adds` ( `id` int(10) NOT NULL auto_increment=1, `fid` int(15) default NULL, `added` int(15) defaultNULL, PRIMARY KEY (`id`), KEY `fid` (`fid`) ) TYPE=MyISAM AUTO_INCREMENT=2058469 ; -- Dumping data for table `adds` -- Table structure for table `admin` -- CREATE TABLE IF NOT EXISTS `admin` ( `id` int(10) NOT NULL auto_increment, `admin` varchar(10) NOT NULL, `password` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `username`, `password`) VALUES (1, 'username', 'password'); error i am getting Error SQL query: -- Table structure for table `adds` CREATE TABLE IF NOT EXISTS `adds` ( `id` int( 10 ) NOT NULL AUTO_INCREMENT =1, `fid` int( 15 ) default NULL , `added` int( 15 ) defaultNULL, PRIMARY KEY ( `id` ) , KEY `fid` ( `fid` ) ) TYPE = MYISAM AUTO_INCREMENT =2058469; MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=1, `fid` int(15) default NULL, `added` int(15) defaultNULL, PRIMARY KE' at line 2
  3. Here is the site so you can see live. http://pledgeresistance.com/guestbook.php
  4. Please Help I have a guestbook I am trying to setup and am having a problem getting the info to insert into the DB The info calls fine when I manually insert the info into the DB but only calls the time "ID" and "DATE" when I try to enter a guestbook submission on the site. here is what I have DB CREATE TABLE `guestbook` ( `id` int(4) NOT NULL auto_increment, `name` varchar(65) NOT NULL default '', `email` varchar(65) NOT NULL default '', `comment` longtext NOT NULL, `datetime` varchar(65) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; guestbook.php <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong>Test Sign Guestbook </strong></td> </tr> </table> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form id="form1" name="form1" method="post" action="addguestbook.php"> <td> <table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><input name="name" type="text" id="name" size="40" /></td> </tr> <tr> <td>Email</td> <td>:</td> <td><input name="email" type="text" id="email" size="40" /></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><textarea name="comment" cols="40" rows="3" id="comment"></textarea></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </td> </form> </tr> </table> <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong><a href="viewguestbook.php">View Guestbook</a> </strong></td> </tr> </table> addguestbook.php <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="guestbook"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $datetime=date("y-m-d h:i:s"); //date time $sql="INSERT INTO $tbl_name(name, email, comment, datetime)VALUES('$name', '$email', '$comment', '$datetime')"; $result=mysql_query($sql); //check if query successful if($result){ echo "Successful"; echo "<BR>"; echo "<a href='viewguestbook.php'>View guestbook</a>"; // link to view guestbook page } else { echo "ERROR"; } mysql_close(); ?> <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong>View Guestbook | <a href="guestbook.php">Sign Guestbook</a> </strong></td> </tr> </table> <br> <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="guestbook"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td>ID</td> <td>:</td> <td><? echo $rows['id']; ?></td> </tr> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><? echo $rows['name']; ?></td> </tr> <tr> <td>Email</td> <td>:</td> <td><? echo $rows['email']; ?></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><? echo $rows['comment']; ?></td> </tr> <tr> <td valign="top">Date/Time </td> <td valign="top">:</td> <td><? echo $rows['datetime']; ?></td> </tr> </table></td> </tr> </table> <BR> <? } mysql_close(); //close database ?> lights joint*
  5. I have the following code to update a players attributes on a game. right now it updates Awake and Nerve and Energy + HP in Different amounts. I am trying to make it update all attributes 25% each time instead. Can anyone help me convert the below PHP to refill 25% each update instead of the current amounts I have? $result = mysql_query("SELECT * FROM `5150players`"); while($line = mysql_fetch_assoc($result)) { $updated_user = new User($line['id']); if ($updated_user->rmdays > 0) { $multiplier = 2; } else { $multiplier = 1; } $username = $updated_user->username; $newawake = $updated_user->awake + (5 * $num_updated) * $multiplier; $newawake = ($newawake > $updated_user->maxawake) ? $updated_user->maxawake : $newawake; $newhp = $updated_user->hp + (100 * $num_updated) * $multiplier; $newhp = ($newhp > $updated_user->maxhp) ? $updated_user->maxhp : $newhp; $newenergy = $updated_user->energy + (25 * $num_updated) * $multiplier; $newenergy = ($newenergy > $updated_user->maxenergy) ? $updated_user->maxenergy : $newenergy; $newnerve = $updated_user->nerve + (25 * $num_updated) * $multiplier; $newnerve = ($newnerve > $updated_user->maxnerve) ? $updated_user->maxnerve : $newnerve; $result2 = mysql_query("UPDATE `5150players` SET `awake` = '".$newawake."', `energy` = '".$newenergy."', `nerve` = '".$newnerve."', `hp` = '".$newhp."' WHERE `username` = '".$username."'"); }
  6. How would I go about updating the last part of the script with the last_update part?
  7. I have a site that has some links on it to do an action. These actions give the players money and exp. After you click the link to do one of these actions, you can simply just press F5 to repeat the same action over and over. I would like to make it so when players press F5 or Click on Reload they will get a message that says "Refreshing not allowed." Like this. Can anyone help me out. My site is PHP but I have heard this is not possible unless I use Java. Looking for some help! Thanks in advance! -LM
  8. I have this code that updates a number $newenergy = $updated_user->energy + (25 * $num_updated) * $multiplier; I am looking to change it to + 25% * $multiplier Can anyone help me make my current string this way? I am not sure how to use percentages in php. Thanks in advance!
  9. Maybe <script language="javascript"> function readonlytextboxes() { document.getElementById(box1).readOnly=true; } </script>
  10. Thanks guys I have too many categories of staff to use the > or < dadamssg. This works perfect though, thank you both, dadamssg. and rhodesa! if ($user_class->admin != 1 && $user_class->admin != 2) { echo Message("You are not authorized to be here. YOU MOTHERFUCKER"); include 'footer.php'; die(); }
  11. I want to make this code so admin 1 and admin 2 can view this area. right now it is set to only display for admin 2 category. Can someone help me make it so that admin 1 and 2 can view it but not admin 0. if ($user_class->admin != 2) { echo Message("You are not authorized to be here. YOU MOTHERFUCKER"); include 'footer.php'; die(); } I can provide more info if needed, thanks in advance!
  12. Still not working right, anyone willing to come take a look at the site?
  13. This is working great to give me 495 exp per Level, but I need it to also add the prior level's exp to the new goal exp. Meaning if you are Level 1 you have 0/495 exp and when you are level 2 you have 0/900 exp, Level 3 you would have 0/1350 exp. function experience($L) { return $L * 495; } function Get_The_Level($exp) { return floor($exp / 495) + 1; } can anyone help get this right?
  14. Also view here if you are looking to make some money doing some PHP help http://www.phpfreaks.com/forums/index.php/topic,258134.0.html
  15. Yeah I wanted to keep people from pressing the Submit button and changing the info to blank in the DB thank you
  16. How can I block blank entries from this input box <input type='text' name='name' maxlength='15' value='$user_class->username'> <input type='submit' name='submit' value='Save Preferences'>
  17. Thanks for all the help sorry I didnt list more info from the start
  18. Best way would be to Make just one ITEMS table and then associate the items to the correct Store Locations? Thanks for the help guys
  19. I agree that one tables section would be more logical, but was just wondering if there was a way to join them all.
  20. Yes there are 40 different items tables. 1 for each store, I am trying to show all items tables in one Inventory page.
  21. I want to show 'items1' 'items2' 'items3' and all the way upto 'items40' <? $result = mysql_query("SELECT * FROM `inventory` WHERE `userid` = '".$user_class->id."' ORDER BY `itemid` ASC"); $howmanyitems = 0; while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $result2 = mysql_query("SELECT * FROM `items1` WHERE `id`='".$line['itemid']."'"); $worked2 = mysql_fetch_array($result2);
  22. I am trying to show info from more than one Database Table The 'items1' is working but I would like to know how to also display 'items2' 'items3' 'items4' tables in the same area. mysql_query("SELECT * FROM `items1` WHERE `id`='".$line['itemid']."'"); Thanks for any help
  23. This is showing 0/495 EXP no matter how much exp I gain right now echo 'EXP: '.($exp - experience($L)).' / '.experience($L+1); This one show syntax error echo 'EXP: '.($this->exp - experience($this->level)).' / '.experience($this->level+1); This one shows 495/1485 EXP <--close but I need it to set the exp to 0 towards next Levels' EXP requirement when you gain a level. <?php echo $user_class->formattedexp; ?></td> This is everything on the classes.php that has the exp codes in it. //level 2 - 500 //level 3 - 1500 //level 4 - 3500 //level 5 - 6000 function experience($L) { $a=0; $end=0; for($x=1; $x<$L; $x++) { $a += floor($x+1500*pow(4, ($x/7))); } return floor($a/4); } function Get_The_Level($exp) { $a=0; $end =0; for($x=1; ($end==0 && $x<100); $x++) { $a += floor($x+1500*pow(4, ($x/7))); if ($exp >= floor($a/4)){ } else { return $x; $end=1; } } } function Get_Max_Exp($L){ $end=0; if ($exp == 0){ return 457; $end =1; } for($L=1;($L<100 && $end==0);$L++) { $exp = experience($L); //echo $exp; if ($exp >= $user_class->exp){ return $exp; $end=1; } } } class User { $this->exp = $worked['exp']; $this->level = Get_The_Level($this->exp); $this->maxexp = experience($this->level +1); $this->exppercent = ($this->exp == 0) ? 0 : floor(($this->exp / $this->maxexp) * 100); $this->formattedexp = $this->exp." / ".$this->maxexp." [".$this->exppercent."%]";
×
×
  • 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.