Jump to content

almightyegg

Members
  • Posts

    791
  • Joined

  • Last visited

Everything posted by almightyegg

  1. I don't know what I changed but the error has now gone. Still showing wrong info... $select = mysql_query("SELECT * FROM itemsowned WHERE userid = '{$mem['id']}'"); $howmany = mysql_num_rows($select); if($howmany == 0){ echo "You have no items.<br>"; }else{ echo "Alchemy<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details['section'] == '1'){ if($details['sell'] == 'No'){ echo " $details[name] ($amount)<br>"; }else{ echo " <a href='market/market.php?code={$item['code']}&sort={$mem['sortmarket']}'>{$details['name']}</a> ($amount)<br>"; } } } echo "Materials<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details['section'] == '2'){ if($details['sell'] == 'No'){ echo " $details[name] ($amount)<br>"; }else{ echo " <a href='market/market.php?code={$item['code']}&sort={$mem['sortmarket']}'>{$details['name']}</a> ($amount)<br>"; } } } echo "Pit Items<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details['section'] == '3'){ if($details['sell'] == 'No'){ echo " $details[name] ($amount)<br>"; }else{ echo " <a href='market/market.php?code={$item['code']}&sort={$mem['sortmarket']}'>{$details['name']}</a> ($amount)<br>"; } } } } This echos: Inventory Alchemy Blah (1) Blah (87) Blah(1,000) Blah (10) Blah (119) Blah (2) Materials Pit Items And there are definitely things that sould show up in materials and pit items....
  2. Still shows the error. But I really don't think it's an error with that anyway because the first one works fine...
  3. I changed that and it comes up with: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/lordofth/public_html/house.php on line 252 line 252: echo "<a href='market/market.php?code=$item &sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; I tried changing that to this: echo "<a href=\"market/market.php?code=$item['code']&sort=$mem['sortmarket']\">$details['name']</a> ($amount)<br>"; But no joy
  4. That bit works in the first one though...
  5. I've done 3 whiles that while the same content but pick out different parts but only the first one is working... $select = mysql_query("SELECT * FROM itemsowned WHERE userid = '{$mem['id']}'"); $howmany = mysql_num_rows($select); if($howmany == 0){ echo "You have no items.<br>"; }else{ echo "Alchemy<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details[section] == 1){ if($details[sell] == No){ echo "$details[name] ($amount)<br>"; }else{ echo "<a href='market/market.php?code=$item[code]&sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; } } } echo "Materials<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details[section] == 2){ if($details[sell] == No){ echo "$details[name] ($amount)<br>"; }else{ echo "<a href='market/market.php?code=$item[code]&sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; } } } echo "Pit Items<br>"; while($item = mysql_fetch_array($select)){ $details = mysql_fetch_array(mysql_query("SELECT * FROM items WHERE code = '{$item['code']}'")); $amount = number_format($item[amount]); if($details[section] == 3){ if($details[sell] == No){ echo "$details[name] ($amount)<br>"; }else{ echo "<a href='market/market.php?code=$item[code]&sort=$mem[sortmarket]'>$details[name]</a> ($amount)<br>"; } } } } It echos out the right stuff rom first while then the other 2 don't send anything out[/code][/code][/code]
  6. Is there any way to make sure a number is positive? so if my variable is -1024 it would turn it into 1024 Any help is greatly appreciated
  7. $searchtype = $_POST['searchtype']; $searchterm = $_POST['searchterm'];
  8. <?php $str = "Is your name O\'reilly?"; // Outputs: Is your name O'reilly? echo stripslashes($str); ?>
  9. The parent directory has chmod set to private probably.
  10. You don't want to do it by there name if there is to be 100s of members. You will need ifs though. Do you mean (from where you said counties) if($user[county] == Suffolk){ echo this }elseif($user[county] == Derbyshire){ echo that } ??
  11. you can create tables like <table><tr><td> <table><tr><td> <table><tr><td> <table><tr><td> </td></tr></table> </td></tr></table> </td></tr></table> </td></tr></table> But don't mix the tags round
  12. I managed to sort that but I have a similar issue elsewhere: $gaps = array($gap1start, $gap2start, $gap3start, $gap4start, $gap5start, $gap6start); $count = count($gaps); echo "$count"; I was hoping that would count the variables that are set. In my case for testing $gap1start, $gap2start, $gap4start and $gap4start are all empty, so I want it to count 2 (as only 2 of the array actually have any value) Is there another way?
  13. on the page have an update to column in the user table update users set pageview+1 etc... and then an if if($user[pageview] >= x amount){ insert timestamp if($timestamp was more than 24 hours ago){ reset timestamp to 0 and pageviews. echo "Please refresh to see this page."; }else{ echo "You've viewed this page too many times in the past 24 hours."; } }else{ }
  14. $numbers = explode("_", $variable); print_r($numbers); $numbers[0] = your first number; $numbers[1] = your second number;
  15. Didn't work.. $select = array($select1, $select2, $select3, $select5); $gap5fin = min($select); $gap5fin is blank... Unless it's counting the unset variables as 0s? Which would be lower
  16. I have this script: if($crops[start2] > $gap5start){ $select2 = "$crops[start2]"; echo "<br><br><br>$select 2<br><br><br>"; } if($crops[start3] > $gap5start){ $select3 = "$crops[start3]"; echo "<br><br><br>$select 3<br><br><br>"; } if($crops[start5] > $gap5start){ $select5 = "$crops[start5]"; } Then I want to put the $selectX variables into a min() function. As you probably know you need a comma and a space between eache vairable in the min() func. So I was wondering if there was a function that I could use to stitch these together into one variable: min($variable); The problem is that the values aren't always set, and if they aren't set then you don't need a comma space Hope that made sense
  17. Right I'll explain it in more detail because I think I've confused you on exactly what I want... This is an example table row: id = 1 code1 = mugh start1 = 1 fin1 = 25 code2 = fevh start2 = 26 fin2 = 144 code3 = wolh start3 = 156 fin3 = 200 code4 = NULL time4 = NULL start4 = NULL fin4 = NULL code5 = wilh start5 = 224 fin5 = 225 Crop 1 has squares 1-25 filled - meaning 25 squares in total. Crop 2 has squares 26-144 filled - meaning 119 squares in total. Crop 3 has squares 156-200 filled - meaning 45 squares in total. Crop 4 - none. Crop 5 has squares 224-225 filled - meaning 2 squares in total. Now from this I can find out the total amount of free squares fine. What I want to do is find how many gaps there are and how big they are. From the above example it would find 2 gaps: $gap1 = 11; $gap2 = 23; Can anyone think of a way to do this?
  18. Right, with the whole finding out what's in use thing: Your land is 15 by 15 squares. and the crops are planted as such: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ... etc... crop1 = somevalue start1 = 1 fin1 = 5 That means that land squares 1 to 5 are in use. crop2 = somevalue start3 = 6 fin4 = 19 That means that land squares 6 - 19 are in use From this I need to find out which squares aren't in use And I'll look into this normalizing thing
×
×
  • 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.