Jump to content

Phpfr3ak

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Everything posted by Phpfr3ak

  1. Yea, use UPDATE instead of INSERT
  2. Hi, it worked what you coded up, thanks i now have a much better understanding of it, only issue is with it being messages a user can then delete someone elses messages, im getting an error saying that its not there message to delete and i dont see why, any clues? if (isset($_POST["submit"]) == "DELETE SELECTED") { $checks = $_POST['chkMsg']; $where = ''; foreach($checks as $check) { $where .= 'id = "' . $check . '" OR '; } $where = rtrim($where, ' OR '); $sql = "SELECT * FROM messages WHERE id = $where"; $que = mysql_query($sql) or die(mysql_error()); $result = mysql_fetch_array($que); $name = $_SESSION['name']; $delname = strtolower($result['to_name']); $pname = strtolower($name); if($delname != $pname){ echo "This is not your message."; exit; }else{ } if (!empty($where)) { mysql_query("DELETE FROM messages WHERE " . $where); } }
  3. Hey basically i'm working on a multi checkbox way to delete messages stored in "crew_messages", i'm getting the error message "Unknown column 'Array' in 'where clause'" from the following code and i'm unsure as to why if (isset($_POST["submit2"]) == "DELETE SELECTED") { for($i=0;$i<count($_POST["chkColor"]);$i++) { if(trim($_POST["chkColor"][$i]) != "") { $rawr = $_POST['chkColor']; $sql = "DELETE FROM crew_messages WHERE id = $rawr"; mysql_query($sql) or die(mysql_error()); } } } the check box itself <input type="checkbox" name="chkColor[]" value="27"> any clues? cheers
  4. The alias form isn't being read for some reason, with having $alias = $_POST['alias']; i don't quiet understand why this isn't it isn't being picked up as a variable below, any clues? cheers <?php include("header.php"); if(isset($_POST['formAlias']) && $_POST['formAlias'] == 'Yes') { $alias = $_POST['alias']; $alias = preg_replace("/[^a-zA-Z0-9_]/", "", $alias); $namelength = strlen($alias); if($namelength < 3){ $error1="Your alias must be at least 3 characters!</span></div>"; echo $error1; }else{ } $query = sprintf("SELECT COUNT(id) FROM players WHERE UPPER(alias) = UPPER('$alias')", mysql_real_escape_string($alias)); $result = mysql_query($query); list($count) = mysql_fetch_row($result); if($count >= 1) { $error1="$alias is already taken."; echo $error1; }else{ } $sql = "updatehereble"; mysql_query($sql) or die(mysql_error()); }else{ } ?> </p> <p> <input name="alias" type="text" id="alias"> </p> <form action="alias.php" method="post"> Do you wish to use an alias? <input type="checkbox" name="formAlias" value="Yes" /> <input type="submit" name="formSubmit" value="Submit" /> </form>
  5. Thanks appreciate the time you've took to provide me with that critique kinda late here but will def start working on what you've mentioned in the morning, cheers!
  6. Hey all, Basically working on the images/Layout of a site im working on currently just wondering if i could get some feedback on the following layout, would like to know how i could make it more user friendly etc, cheers, threw a few images il be using on the site on the page to pad it out a bit. http://doperunners.com/tester.php
  7. Just a selection of the code that's relevant basically its always showing as over 1 hour, even if its one minute i really cannot see why i want it to countdown to 55 of every hour but instead of being 1 minute for example it will say 61, any ideas from my code below? <?php $HourOn = date('G'); $MinuteOn = 55; if($HourOn == $HourOn || $MinuteOn > $MinuteOn){ $HourOn = date('G') + 1; $MinuteOn = 55; } else { $MinuteOn = 55; $HourOn = date('G'); } ?> dateFuture1 = new Date(<?php echo date('Y'); ?>,<?php echo date('m') - 1; ?>,<?php echo date('d'); ?>,<?php echo $HourOn;?>,<?php echo $MinuteOn; ?>,0);
  8. Yea, can you phrase this better, as currently makes no sense. can possibly help then.
  9. Sorry the echo is further down the page, that's just the php side showing that $price has actually being set to a value, i'm just confused as when im calling it to echo, nothing is showing at all. I hope this is better explained?
  10. For some reason i cannot for the life of me find, from the below code, <? echo $price ?> is returning nothing, could someone please take a look at this and explain to me where I'm going wrong, Would appreciate it tonnes, Thanks Freddy. <?php //get item information $AttributeID = mysql_real_escape_string($_GET['AttributeID']); $sql = "SELECT * FROM attributes as a WHERE a.id = $AttributeID"; $query = mysql_query($sql) or die(mysql_error()); $attribute = mysql_fetch_array($query); $price = $attribute['SkillPoints']; //check for attribute $sql = "SELECT * FROM player_attributes WHERE player_id = $playerID AND attribute_id = $AttributeID"; $query = mysql_query($sql) or die(mysql_error()); $att = mysql_fetch_array($query); $quan = $att['quantity']; if ($quan == 0){ $quan = 0; }else{ $quan = ($quan); } if($quan == 0) { $price = ($price); }else{ } if ($quan >='1'){ $price = ($quan + $price); } ?>
  11. In short i want to use the following code below, when someone selects there option and submits it, it would bring up details from the database on this user from the selected table, can you explain what it would be called doing this so i can look it up, Sorry to be a pain, Cheers. <select name="target2" id="target2"> <option value=""></option> <?php $sql = "SELECT player_id, friend_id, name, is_active FROM contacts as c JOIN players as p ON c.friend_id = p.id WHERE c.player_id = $playerID AND is_active = 1 ORDER BY name ASC"; $que = mysql_query($sql) or die(mysql_error()); while($list = mysql_fetch_array($que)) { ?> <option value="<?php echo $list['friend_id'] ?>"><?php echo $list['name'] ?></option> <?php } ?> </select>
  12. Wondering what the heck is wrong with it, worked before i varied the error messages, had a pal check it out, he couldn't really spot anything wrong either, obviously were both being blind at what is missing, if someone would be kind enough to explain the segment of code that's causing the error is below. if ($amount < 1); echo "You must enter the number of troops you wish to hire."; exit; }else{ if ($amount > $maxdef); echo "You cannot hire over your housing limit."; exit; }else{ if ($amount = ""); echo "You must enter the number of troops you wish to hire."; exit; else if ($HireCost > $CashOnHand); echo "You do not have enough cash on hand to hire these troops."; exit;
  13. Yea, i meant to set it to a variable also, sorry i'm not that great in php can you explain how thats not set as a variable? :/
  14. Can anyone explain to me why this isn't working , and explain how i would rectify the problem, Many Thanks. <? $rawr = mysql_real_escape_string($_GET['type']); "SELECT COUNT(id) FROM items Where type = $rawr" ?>
  15. Thanks guys, done jcbones worked great thanks alot!
  16. sorry for being so vague MASTERPLAYERID is in the player table, its basically used to control more than one account without having to use a password that works fine, the ban works as is just using; $sql = "UPDATE players SET is_banned = 1 WHERE id = $id"; mysql_query($sql) or die(mysql_error()); But id also like it to ban everyone with thesame MASTERPLAYERID as well as the id that im banning. hope this makes more sense?
  17. $sql = "UPDATE players SET is_banned = 1 WHERE id = $id"; mysql_query($sql); Sorry really not all that great i want to also ban MASTERPLAYERID i assumed it would be; $sql = "UPDATE players SET is_banned = 1 WHERE id = $id AND WHERE MASTERPLAYERID = $MASTERPLAYERID"; mysql_query($sql); But its not could someone inform me how to pull this off, Thanks.
  18. Thanks for that i now get how i went about it wrong, will know in future most appreciated still getting an odd message: Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files\EasyPHP-5.3.3\www\public_html\crons\payprizes.php on line 4 Any clue? i'll try and work it out for myself if not just a tad lost atm
  19. <?php include("server.php"); $sql = "UPDATE players SET points = points + 5 WHERE is_active = 1 ORDER BY score DESC LIMIT 50"; $sql = "INSERT INTO credit_logs(player_id,Description,amount,end_balance) VALUES ($playerID,top 50 finish,5,5)"; mysql_query($sql) or die(mysql_error()); echo "Prizes Paid" ?> Unsure as to why im getting; 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 'top 50 finish,5,5)' at line 1 sorry my php isnt too great any help would be great thanks.
  20. Thanks i didn't spot that at all, Fixed the initial error, And corrected that, Thanks alot!
  21. How does puttin the string right in there effect it, i'm not that advanced in php and dont really see how it would be fixed in all honesty.
  22. Hey, The code below for some reason is showing; Hoes: 20000 Morale: 4.10 (hoes * hoe_morale * 2)); cred. Any ideas why i need it to show the actual result not the Maths thanks. <?php if($_GET['password']!="1234") { die("You do not have access to this page."); } else { include("functions.php"); include("db_connection.php"); $sql = "UPDATE users SET cash = cash + hoes * hoe_morale * 150, cred = cred + hoes * hoe_morale * 2 WHERE is_active = 1"; mysql_query($sql) or die(mysql_error()); $sql2="INSERT INTO messages (to_username,message,type, timestamp) VALUES('$playerdata[username]',' Hoes: $playerdata[hoes] Morale: $playerdata[hoe_morale] (hoes * hoe_morale * 2)); cred','player', NOW())"; mysql_query($sql2) or die(mysql_error()); echo "Ho Income complete"; } ?>
  23. That was it, Thanks for that! Taught me something i didn't know :]
  24. Hmmm odd i tried: Notice: Undefined index: $ReportType in C:\Program Files\EasyPHP-5.3.3\www\htdocs\playerranks.php on line 60 if i echo $reporttype the actual colum is echo'd, but i cant echo the specific reportype based for the users, Rather odd. <?php $ReportType = mysql_real_escape_string($_GET['ReportType']); ?> <?php echo $users['$ReportType'] ?>
×
×
  • 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.