Jump to content

almightyegg

Members
  • Posts

    791
  • Joined

  • Last visited

Everything posted by almightyegg

  1. Now it won't stop echoing that error message out, no matter what value the tings are
  2. I'll post the whole script: if($count1 != 1 && $item1 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count2 != 1 && $item2 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count3 != 1 && $item3 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count4 != 1 && $item4 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count5 != 1 && $item5 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif(!$item1 && !$item2 && !$item3 && !$item4 && !$item5){ echo "You didn't select any items to donate!"; }elseif($info1['amount'] < $input1 && $item1 != 0){ // IT SHOULD STOP HERE echo "You don't have enough of at least one of the items you wanted to give."; }elseif($info2['amount']<$input2 && $item2!=0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($info3['amount']<$input3 && $item3!=0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($info4['amount']<$input4 && $item4!=0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($info5['amount']<$input5 && $item5!=0){ echo "You don't have enough of at least one of the items you wanted to give."; }else{ if(count($no_zero) == count(array_unique($no_zero))){ // IT ENDS HERE }else{ echo "You selected the same item more than once!"; } } I added tags to show what happens
  3. I have an IF like so: if($info1[amount] < $input1 && $item1 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; } and with the variables I've set it should echo it out but it doesn't. $info1[amount] = 472 $input1 = 500 $item1 = dappp
  4. Great! It's all working! Thanks all who helped and merry christmas
  5. It echoed unique when $item3 and $item4 both = dappp
  6. Parse error: syntax error, unexpected '{' in /home/lordofth/public_html/society/stockpile.php on line 196 $array = array(); array_push($array, $item1, $item2, $item3, $item4, $item5); //according to the php manual, array_push shouldn't be used to add 1 var at a time.... It probably shouldn't even be used here, but I'm lazy $no_zero = array(); foreach($array as $v) { if($v != 0) $no_zero[] = $v; } if($count1 != 1 && $item1 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count2 != 1 && $item2 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count3 != 1 && $item3 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count4 != 1 && $item4 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count5 != 1 && $item5 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }else{ if(count($no_zero) == count(array_unique($no_zero)){ // line 196 //all unique echo "unique"; }else{ //not all unique echo "not unique"; } } Thanks loads for all this help
  7. Right, it didn't work... it just displayed: Do stuff.....Do stuff.....Do stuff.....Do stuff.....Do stuff..... Here's the code $array = array(); array_push($array, $item1); array_push($array, $item2); array_push($array, $item3); array_push($array, $item4); array_push($array, $item5); //Search through every item in the array for($i=0; $i<count($array); $i++) { //Make a counter, initialize to 0 every "i" iteration $counter = 0; //Compare array[i] to every element in the array //if there is an element, increment counter by one //counter should always reach at LEAST one for($j=0; $j<count($array); $j++) { if($array[$i] == $array[$j]) { $counter++; } } if($count1 != 1 && $item1 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count2 != 1 && $item2 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count3 != 1 && $item3 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count4 != 1 && $item4 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($count5 != 1 && $item5 != 0){ echo "You don't have enough of at least one of the items you wanted to give."; }elseif($counter >= 2 && $array[$i] != 0) { print $array[$i] . " is in the array " . $counter . " times!"; }else{ echo "Do stuff....."; } }
  8. Warning: array_push() [function.array-push]: First argument should be an array in /home/lordofth/public_html/society/stockpile.php on line 175 Warning: array_push() [function.array-push]: First argument should be an array in /home/lordofth/public_html/society/stockpile.php on line 176 Warning: array_push() [function.array-push]: First argument should be an array in /home/lordofth/public_html/society/stockpile.php on line 177 Warning: array_push() [function.array-push]: First argument should be an array in /home/lordofth/public_html/society/stockpile.php on line 178 Warning: array_push() [function.array-push]: First argument should be an array in /home/lordofth/public_html/society/stockpile.php on line 179 $array = array(); array_push($item1, $array); array_push($item2, $array); array_push($item3, $array); array_push($item4, $array); array_push($item5, $array); That's the problem area ^^^
  9. Wow thanks. I put it in but there's an unexpected T_VARIABLE on this line for(int $i=0; $i<count($array); $i++) {
  10. I got this far: $rawr = array("$item1", "$item2", "$item3", "$item4", "$item5"); $arraycount = array_count_values($rawr); How do I put it into an elseif??
  11. Hmmm, even the long way doesn't seem to work... if(($item1 == $item2 && $item1 != 0) || ($item1 == $item3 && $item1 != 0) || ($item1 == $item4 && $item1 != 0) || ($item1 == $item5 && $item1 != 0) || ($item2 == $item3 && $item2 != 0) || ($item2 == $item4 && $item2 != 0) || ($item2 == $item5 && $item2 != 0) || ($item3 == $item4 && $item3 != 0) || ($item3 == $item5 && $item3 != 0) || ($item4 == $item5 && $item4 != 0)){ echo "You have selected the same item twice...or more!"; }else{ echo "Do stuff....."; } With the values I've set for item1,2,3,4,5 it should say "You have selected the same item twice...or more!" but it says "Do stuff....." Is there a problem with the if?
  12. Is there any way to check if multipul variables are the same?? eg. $1 = 11 $2 = 18 $3 = 9 $4 = 3 $5 = 3 instead of: if(($1 == $2 && $1 != 0) || ($1 == $3 && $1 != 0) || ($1 == $4 && $1 != 0) || ($1 == $5 && $1 != 0) || ($2 == $3 && $2 != 0) ...etc.... *I also need to make sure that if they are the same that they aren't 0* <- reason for edit is there a way to do it quickly and easily??
  13. Sorry I didn't include the table tag, <table border='0' width='600' bgcolor='#121212'>
  14. I have code (I used view source because PHP is involved in the values) and it is: <tr> <td width='100'><b>Product</b></td> <td width='100'><b><a href='index.php?code=flamh&sort=higham'>Amount</a></b></td> <td width='100'><b><a href='index.php?code=flamh&sort=totalc'>Total Cost</a></b></td> <td width='100'><a href='index.php?code=flamh&sort=lowcost'><b>Cost per</B></a></td> <td width='100'><a href='index.php?sort=seller'><b>Seller</b></a></td> <td width='100><b>Actions</b></td> </tr> <tr> <td><a href='index.php?code=flamh&sortby=seller'>Flame Herb</a></td> <td>100</td> <td>5,000</td> <td>50.00</td> <td><a href='/player/view.php?id=1'>Lord of the Abyss</a></td> <td><a href='delete.php?id=1'>[Del]</a></td> </tr> </table> Yet it shows like But as you can see from the code it should have 2 rows...not 1 long one any help would be great
  15. If I have a $variable how would select just the last character. So if it was thomas, it would select s ?? Any help is greatly appreciated
  16. Look into using fopen() www.php.net/fopen
  17. no. That gets the information to put into the file
  18. Not entirely sure what you mean but I think this will do it: URL = mysite.com/items.php?id=XXX $id = $_GET['id']; $select = mysql_query("SELECT * FROM table WHERE id='$id'"); $item = mysql_fetch_array($select);
  19. $select = mysql_query("SELECT * FROM table WHERE type='laminate'"); echo "Laminate Floors<br>"; while($laminate = mysql_fetch_array($select)){ // get info on preduct here //echo it out } $select = mysql_query("SELECT * FROM table WHERE type='wood'"); echo "Wood Floors<br>"; while($wood = mysql_fetch_array($select)){ // get info on preduct here //echo it out }
  20. I have a bit of code that selects the first 5 words of a variable: $short = join(' ', array_slice (explode(' ', $posmes['message']), 0, 5)); Works great, butI want it to select the first 30 Characters instead...How do I change it from words to characters??
  21. I already changed it to this: mail($email, $subject, $message, "-f $email");
  22. It works on my domain but not on googlemail... It isn't in my spam, I've checked and double checked...
×
×
  • 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.