PHP - What Is Being Done Wrong? Problem While Looping.
Here's the situation and scenario.
I am pulling variables from a text file and looping them through a function in order to get a result, problem is, that something is happening that is not allowing the results to pass through correctly. Weird thing is, that if there is only one variable present, the script works, if more than one variable is in the list, then that's where the problem comes in. The script only returns the correct result with the last variable in the list, all other variables seem to no be passing correctly. Here is the process: grab first line of text file use that variable to request data from an ssl site using fsock returns a result based on returned data from the post query loops back around to start over with next variable in list. I have tried everything that i could think of. I basically want the script to reset completely as if only one variable were submitted. I am suspecting that it has something to do with the foreach() function. Does it have anything to do with the session since its ssl? Like I said when only one variable is present in the text file, it works accordingly. When more than one variable, it only works correctly with the last variable. The other variables return the incorrect result. at the end of the file, i even manually unset every variable in the script to make sure that i starts with all variables undefined just in case and still... no dice. code that i am using can be viewed at http://fontestad.net/personal/jf/pt/t.phps thank you. Similar TutorialsI've made a loop here.. Code: [Select] <form name="formdeliver" method="post" action="addOrder.php" onSubmit="return confirm('Are you Sure the data inputed are correct? Click Ok to continue.')"> <div id="apDiv2" style="overflow:auto "> <?php $host="localhost"; $username="root"; $password=""; $db_name="SEdatabase"; $tbl_name="bottlenumbers"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $name = $_SESSION['customername']; $q = $_SESSION['quantity']; echo "<table border='1'> <tr> <td><font size = '2'>Customer Name : $name </font></td></tr><tr> <td><font size = '2'>Quantity : $q </font></td> </tr> </table><br>"; for($i = 0; $i < $q; $i++){ echo "Bottle Number :"; echo "<select name=\"bottlenum[]\" onChange=\"this.name\"> <option>Select</option>"; if(mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)) { echo "<option>" .$row['BottleNumber']. "</option>"; } echo "</select>"; } else { echo "<option>No Customer Encoded</option></select>"; } echo "<font size = 2 >Type :</font> <select name=\"bottletype[]\" onChange=\"this.name\"'>'; <option selected>Select .. </option> <option> Slim </option> <option> Round </option> </select><br>"; } ?> <br> <input type="image" src="continue.png" width="100" height="25" name="login" border="0" /> </div> </form> So what it basically do is.. User will input some data w/c i included as $_POST['customername'] and $_POST['quantity'] So when the user will input 5 quantity.. i want my loop to have 5 pairs of 2 drop down list.. well i suceeded there. but, my problem is the 1st pair will output the .$row['BottleNumber']. w/c i included at the loop, and then the rest will have no output.. when i clicked them the dropdown list will only show the Select one. but for the 1st pair its working fine. Sorry for the bad english.. someone help me pls Hi all, I am trying to show information on a page if a value collected from a $_GET value is the same as a value in a Mysql database provided that the users email address links the email address next to the value in the mysql database. I have created the script however as there are more than one $row['value'] I can not get a foreach loop to work to scroll through all the $row['value'] values until it finds a matching one. Hope you can see from the code what I am talking about. The code I have is below: <?php $email = $_SESSION['logname']; $sql = "SELECT reg FROM sales WHERE email='$email'"; $result = mysqli_query($cxn,$sql) or die ("Couldn't execute query"); while($row = mysqli_fetch_assoc($result)) // NEED HELP INSERTING A FOREACH $ROW['REG'] SEE IF IT MATCHES $_GET['REG'] TYPE OF SCRIPT// { if ($row['reg'] == $_GET['reg'] ) { echo $row['reg'] . " is registered by you!"; } elseif ($row['reg'] != $_GET['reg'] ) { echo $_GET['reg'] . "<br>"; echo $row['reg']; echo $email . "<br>"; echo "I am sorry but the $_GET[reg] does not seem to be registered by you!"; exit(); } } ?> I am trying to get it to display the table where only some rows will be shown. It works on picking up each indivual value from the othere page but when it comes to displaying the table it only pics up the first value and only displays that. Here is my code bellow Code: [Select] <? session_start(); if ($_SESSION['userName']) {} else { header('location:../index.php'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Deliver-Pizza Order</title> <link href="css/order.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <div id="header"> <img src="images/logo.jpg" alt="logo" /> <a href="log-off.php" id="logg-off" >log off</a> <ul id="nav"> <li><a href="home.php" target="_self">Home</a></li> <span> | </span> <li><a href="Pizza-Topping.php" target="_self">Pizza Topping</a></li> <span> | </span> <li><a href="order.php" target="_self">Order</a></li> <span> | </span> <li><a href="Account.php" target="_self">Account Details</a></li> <span> | </span> </ul> </div> <div id="Featured"> <img src="images/banner1.jpg" alt="banner" name="banner"" ID="banner"></div><!--end Featured--> <div class="featuredimage" id="main"> <div id="content" class="tiles"> <h1>Order</h1><hr /> <div id ='staff'><div style="width:920px; height:autopx; overflow:auto; heightmax:300px"> <table> <tr> <th>pizza number</th> <th>Type</th> <th>Size</th> <th>Topping</th> <th>Cost</th> <th>Information</th> </tr> <?php mysql_connect("localhost", "root", "")or die("cannot connect"); mysql_select_db("deliverpizza")or die("cannot select DB"); $sql="SELECT * FROM `pizzatopping` "; $result= mysql_query($sql); while($row = mysql_fetch_assoc($result)) { $pizza = $row['id']; if(isset($_POST["pizza$pizza"])) { if ($_POST["pizza$pizza"] == $row['id']){ $id = $row['id']; $dis="SELECT * FROM `pizzatopping` where id='$id'"; $result= mysql_query($dis); while($row =mysql_fetch_assoc($result)){ ?> <tr> <td><?php echo $row['id'] ?></td> <td><?php echo $row['type'] ?></td> <td><?php echo $row['size'] ?></td> <td><?php echo $row['topping'] ?></td> <td><?php echo $row['cost'] ?></td> <td><?php echo $row['info'] ?></td> </tr> <?php } } } } ?> </table> </div> </div> </div> </div> <!--end content--> <div id="footer"><span><p>Created By Ryan Williams</p></span></div><!--end footer--> </div><!--end container--> </body> </html> I am getting repeat results, need help to stop this Code: [Select] $sqlgb ="SELECT * FROM `guestbook`JOIN `obituaries` ON (guestbook.obits_id = '$id') "; $results=mysql_query($sqlgb) or die("Error: ". mysql_error(). " with query ". $sqlgb); $num = mysql_num_rows($results); if ($num > 0 ) { $i=0; while ($i < $num) { $id = mysql_result($results,$i,"id"); $obits_id = mysql_result($results, $i, "obits_id"); $name = mysql_result($results,$i,"name"); $email = mysql_result($results,$i,"email"); $message = mysql_result($results, $i, "message"); $postdate = mysql_result($results,$i,"postdate"); //$deceased = mysql_result($results, $i "fname"); $date = convertdate($postdate); ?> <p class="ptext">Message From: <a href="mailto:<?php echo $email; ?>"><?php echo $name; ?></a></p> <p class="ptext"><?php echo $postdate; ?></p> <p class="ptext"><?php echo $message; ?></p> <p> <div align="center"><h2> <a href="gbview.php?id=<?php echo($id); ?>">View Guestbook</a> | <a href="gbpost.php?id=<?php echo($id); ?>">Sign the Guestbook</a></h2></div> </p> <?php ++$i; } } else { echo($results['obituaries.fname']); } mysql_close(); ?> hi, i have mysql table like table1 table2 ----------------------- ------------------------ | A | B | | 1 | 2 | | C | D | | 3 | 4 | | E | F | ---------------------------- ------------------------ now i want to display them in html table cells(td)... like -------------------------------------------------------------------------------- A | B | 1 | 2 -------------------- C | D | 3 | 4 --------------------- E | F | ---------------------- ok i was trying this it in while looping but unable to do soo........... Hi guys,
I am trying to echo multiple calendar events from a mysql table and order them by the date column.
There are several events on each day so I am trying to echo the date once then list the associated events under that date.
Such as
2014-05-10
Event 1, event 2, event 3
2014-05-11
Event 1, event 2, event 3
instead of
2014-05-10 event 1,
2014-05-10 event 2,
2014-05-10 event 3,
2014-05-11 event 1 etc...
This is my coding so far:
while($row = mysqli_fetch_assoc($result)) { $dutydate = $row['MyDate']; if($dutydate != $previousdate) { echo $dutydate.'<br />'; } elseif(!empty($dutydate)) { echo $dutydate.'<br />'; } echo $event1.' | '.$event2.' | '.$event3.'<br />'; $previousdate = $dutydate; } ?> how come the lines: PHP Code: echo $form['catcher_id']; $catcher_names = $form['catcher_id'] foreach($catcher_names as $val) { echo "testing loop"; } produce nothing?? its not doing the foreach. $form['catcher_id']; is a dropdown list containing catcher names please help? thanks Hi all, I wrote a download script for some protected files a little while back. And on the whole, its works pretty well but occasionally, zip files will not completely download and will end up corrupted. It happens more with bigger files but that i'm guessing is due to the fact it takes longer to download them? I've searched intensively on Google for the past few days and implemented a few new ideas, which hasn't made a difference. Its annoying, in the fact you can try the same file a few times over and it'll download 8 out of 10 times no problem. I even added in the apachesentenv after a recommendation, as the rest of my site is gzip php'd. But that hasn't worked either. Part of the code as follows: apache_setenv('no-gzip', '1'); // if file exists and user access granted: // define the path to your download folder plus assign the file name $path .= $filename; // check that file exists and is readable if (file_exists($path) && is_readable($path)) { // get the file size and send the http headers $size = filesize($path); // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); //content type switch(strtolower(substr(strrchr($filename,'.'),1))) { case "pdf": $mime="application/pdf"; break; case "mp3": $mime="audio/x-mp3"; break; case "zip": $mime="application/zip"; break; case "rar": $mime="application/zip"; break; case "tar": $mime="application/zip"; break; case "sit": $mime="application/zip"; break; case "doc": $mime="application/msword"; break; case "xls": $mime="application/vnd.ms-excel"; break; case "ppt": $mime="application/vnd.ms-powerpoint"; break; case "gif": $mime="image/gif"; break; case "png": $mime="image/png"; break; case "jpeg":$mime="image/jpg"; break; case "jpg": $mime="image/jpg"; break; default: $mime="application/force-download"; } header("Cache-Control: public"); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Content-Type: " .$mime); header("Content-Disposition: attachment; filename=\"{$filename}\""); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($path)); readfile("$path"); if($logging == 1){ $status = "Granted"; include('logit.php'); } exit; } Live http Headers in Firefox displays the following upon clicking a download: http://www.website.com/filedownload.php?file=12 GET /filedownload.php?file=12 HTTP/1.1 Host: www.website.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://www.website.com/downloads.php Cookie: __utma=100661891.2064943237.1286446219.1290502952.1290505322.70; __utmz=100661891.1290502952.69.8.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=lighthouse%20cjpro; __utmc=100661891; __utmb=100661891.43.10.1290505322; PHPSESSID=8aadcc17930b9e146f103f180f30f470 HTTP/1.1 200 OK Date: Tue, 23 Nov 2010 11:22:13 GMT Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.12 X-Powered-By: PHP/5.2.12 Expires: 0 Cache-Control: must-revalidate, post-check=0, pre-check=0 Pragma: public Content-Description: File Transfer Content-Disposition: attachment; filename="Version_5_Software.zip" Content-Transfer-Encoding: binary Content-Length: 62654423 Keep-Alive: timeout=2, max=100 Connection: Keep-Alive Content-Type: application/zip ---------------------------------------------------------- Are my headers wrong? or in the incorrect order? If not, any ideas? I'm a bit stumped! Thanks for taking the time to read my query. I am querying... $sql = "SELECT `messages_inbox`.`message_id`, `users`.`firstname`, `users`.`lastname`, `users`.`username` AS `from`, '${user_info['username']}' AS `to`, `subject`, LENGTH(`files`) AS `len`, 'inbox' AS `box`, DATE_FORMAT(`messages_inbox`.`time` ,'%T %D-%M-%Y') AS `time` "; $sql .= "FROM `messages_inbox` INNER JOIN `users` ON `messages_inbox`.`from_id` = `users`.`id` WHERE `to_id` = ${user_info['uid']} AND `messages_inbox`.`deleted` = 0 ORDER BY `messages_inbox`.`message_id` DESC"; and I am trying to output $displayName = ucwords("${message['firstname']} ${message['lastname']}"); by using $messages = pm_fetch_all($_GET['box']); I know my fetch works but for some reason firstname and lastname are only returning the logged in users first name and last name, not the person who sent the message. Take a look he http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=YahooDemo&query=test That is a generated XML file from Yahoo's API. If you take a look, it has a node titled "Question". With PHP, how can I loop through each "Question" node and grab all of it's children as well? I tried this code, but apparently it did not work: $req = "http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=YahooDemo&query=php"; $res = file_get_contents($req); $xml = simplexml_load_string($res); foreach ($xml->xpath('//Question') as $question) { // "//question" means for each question node echo((string)$question['Subject']." - ".(string)$question['Content']); // you get all the child nodes in $question } ok I'm a bit stuck here were I would think something would work easily im getting an error. What I am trying to loop is.. $data="UPDATE ts12 SET djid='$_POST[TS0]' WHERE id=1"; $data="UPDATE ts12 SET djid='$_POST[TS1]' WHERE id=2"; This would go on for 84 id's. So I figured I could just loop this line so I only have to type it once. Right now I have it set up for just testing 7 ids and I have this code.... if ($edit == yes) { for ($i=0; $i < 7; $i++){ $n=($i+1); $data.="UPDATE ts12 SET djid='$_POST[TS$i]' WHERE id=$n"; } if (!mysql_query($data,$con)) die('Error: ' . mysql_error()); }else{} The error I am getting is... PHP Parse error: syntax error, unexpected T_VARIABLE, expecting ']' in dir/page on line 6 What am I doing wrong here? I am pulling data from an sql data base. I want it to displayed (Item # | Error button | Link) however as its looping with a while on the database info I cant seem to get it to loop on the item number so it shows 1, 2, 3,.... on each row. Current coding is: while ($info = mysql_fetch_array($data)){ Print '<tr>'; Print"<td style='width: 15px;' class='cat-list'>$D</td>"; if ($info['id']==""){ Print"<td class='cat-list'> </td>"; }else{ Print"<td class='cat-list' style='width: 20px;'><img border='0' src='images/error.png' width='16' height='16'></td>"; } if ($info['link']==""){ Print"<td class='cat-list'> </td>"; }else{ Print"<td class='cat-list'><a target='_blank' href='".html_entity_decode(stripslashes($info[link]))."'>".substr(html_entity_decode(stripslashes($info[link])), 0, 85)."</a></td>"; } } How would I get the $D item to show 1 2 3... ect? Thanks, Jim ok, here is some code: Code: [Select] <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM products"); while($row = mysql_fetch_array($sql)){ $product = $row["product"]; ?> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#myform").validate({ debug: false, submitHandler: function(form) { // do other stuff for a valid form $.post('process.php', $("#myform").serialize(), function(data) { $("#price").load("index.php #price"); $('#results').html(data); }); } }); }); </script> <form name="myform" id="myform" method="POST" action=""> <input type="hidden" name="hiddenField" id="hiddenField" value="<?php echo $product; ?>" /> <input type="submit" name="submit" value="Submit" style="background-color:lightgreen; height:50px; width:100px;"> </form> <?php } ?>and here is process.php Code: [Select] <?php include_once("/connect.php"); ?> <?php $price=$_POST['hiddenField']; $sql = "INSERT INTO cart (price) VALUES('$price')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); ?>. what is happening is it is supposed to be submitting form without page reload.......but only the first one in the loop does it. I want all of them to do it. can anyone help me do this properly. Hey, I have the following code that gets the name of the course from the XML. XML Snippet Code: [Select] <?xml version="1.0"?> <courses> <course> <id>70</id> <name>Marketing and Social Media</name> <dates> <date> <instance_id>6747</instance_id> <location /> <course_type>Day</course_type> <date_available>2011/07/13</date_available> <time_start>9:30</time_start> <time_end>17:00</time_end> <availibility>7</availibility> <running_dates> <running_date>2011/07/13</running_date> <running_date>2011/07/14</running_date> </running_dates> </date> </dates> </course> <course> </courses> PHP Code: [Select] $dom = new DomDocument(); $dom->load("courses.xml"); $xp = new domxpath($dom); $titles = $xp->query("/courses/course/name"); foreach ($titles as $node) { print $node->textContent . " "; } This prints out the course name fine. My question is how Can i get the rest of the data from the same query. For example why cant I do something like.. Code: [Select] ... foreach ($titles as $node) { print $node->name. " "; print $node->time_start. " "; print $node->course_type. " "; etc.. } So I want to loop through get the name and assign the rest of the nodes in there to variables or something. ANYONE WHO CAN HELP ME WITH MY LOOP? THIS IS THE CODE THANKS IN ADVANCE.
<?php $testTwo = 'bakit ayaw po gumana paulit ulit bakit'; $testOne = 'bakit paulit ulit bakit ulit'; $tTwo = explode(' ', $testTwo); $tOne = explode(' ', $testOne); echo"SIMILARITIES:</br>"; foreach($tOne as $first) { foreach($tTwo as $second) { if($second == $first) { echo $second.' '; } } echo"</br>"; } ?> THIS IS THE OUTPUT SIMILARITIES: bakit bakit paulit ulit bakit bakit ulit THIS IS MY EXPECTING OUTPUT. bakit paulit ulit bakit ulit lang i have this bit of code which is supposed to do a while loop of rows from a database then inside that does a while loop of columns, so its basically creating a html table of dynamic data from mysql. the column loop works fine, but the row one isnt, it only goes through and echos out the first row then stops. ive spent hours now trying to see why and i cant see it hence my call for help. $totalrows = 4; $columns = 5; $columncount = 1; $rowcount = 1; echo "<table>"; while ($rowcount <= $totalrows) { echo "<tr>"; $sql = "SELECT * FROM ville_map WHERE id = '$rowcount'"; $sql_result = mysql_query($sql, $connection); while ($row = mysql_fetch_array($sql_result)) { $c1 = explode(',', $row["c1"]); $c2 = explode(',', $row["c2"]); $c3 = explode(',', $row["c3"]); $c4 = explode(',', $row["c4"]); $c5 = explode(',', $row["c5"]); while ($columncount <= $columns) { $arraynum = ${'c'.$columncount}; if ($arraynum[2] > 0) { $playerimage = '<img src="images/player' .$arraynum[2]. '.png"'; } else { $playerimage = ""; } echo '<td background="images/' .$arraynum[0]. '.jpg" width="50" height="50">' .$playerimage. '</td>' ; $columncount++; } } echo "</tr>"; $rowcount++; } ?> </table> any help would be much appreciated. How come this doesn't loop? Everything is in the while loop.
My database connection is in the included file you see to begin the code which is what db_conx refers to just to be clear. Database connection is not an issue nor is getting values. I just get the first one and nothing more. No looping taking place here.
What I miss?
require('includes/db_connect.php'); $query = "SELECT * FROM events ORDER BY displayorder ASC"; $result = mysqli_query($db_conx, $query); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $pid = $row["id"]; $title = $row["title"]; $date = $row["date"]; $info = $row["info"]; $linkTxt = $row["linkTxt"]; $link = $row["link"]; $message = "<div id='events_holder'><table width='500' border='0' cellspacing='0' cellpadding='10'> <form action='edit_event_parse.php' method='post'> <tr> <td class='prayer_title'>Title:</td> <td><input type='text' name='title' class='admin_input' value='" .$title."' /></td> </tr> <tr> <td class='prayer_title'>Date:</td> <td><input type='text' name='date' class='admin_input' value='".$date."' /></td> </tr> <tr> <td class='prayer_title'>Link Text:</td> <td><input type='text' name='linkTxt' class='admin_input' value='".$linkTxt."' /></td> </tr> <tr> <td class='prayer_title'>Link URL:</td> <td><input type='text' name='link' class='admin_input' value='".$link."' /></td> </tr> <tr> <td class='prayer_title'>Event Details:</td> <td><textarea name='info' cols='20' rows='10' class='admin_area'>".$info."</textarea></td> </tr> <tr> <td><input type='hidden' name='pid' value='".$pid."' /></td> <td><input name='submit' type='submit' value='Edit Event' class='admin_submit'/></td> </tr> </form> </table> <p> </p> <hr /> <p> </p> </div>"; }Thanks! I have a select field in my join form which allows users to select one of my speicifed counties. In the table the county is link to a country. I am trying to echo in a select statement a loop of all the available counties in england. here is the code <?php $qGetCounty = "SELECT * FROM Counties"; $rGetCounty = mysql_query($qGetCounty); echo " <select name=\"County\"> <optgroup label=\"England\"> "; while ($county = mysql_fetch_assoc($rGetCounty)){ if($county['country']=='England') { echo " <option value= '{$county['county']}'>{$county['county']}</option> "; }} echo " <optgroup label=\"Wales\"> "; while ($county=='Wales'){ echo " <option value= '{$county['county']}'>{$county['county']}</option> "; } echo " <optgroup label=\"Scotland\"> "; while ($county=='Scotland'){ echo " <option value= '{$county['county']}'>{$county['county']}</option> "; } echo " </select> " ; ?> It is not erroring but also it is not worlking correctly. It shows all the counties in England and both the labels for scotland and wales but does not show any counties in these two areas. I am new to loops so do not know how to fix this. I have tried changing the line while ($county=='Wales') to while ($county = mysql_fetch_assoc($rGetCounty)) But this makes no difference This is the array Array (2) ( | ['0'] => Array (6) | ( | | ['name'] = String(7) "Pikemen" | | ['hp'] = Integer(3) 100 | | ['atk'] = Integer(1) 5 | | ['def'] = Integer(1) 5 | | ['rng'] = Integer(2) 15 | | ['amt'] = Integer(2) 30 | ) | ['1'] => Array (6) | ( | | ['name'] = String(8) "Champion" | | ['hp'] = Integer(3) 150 | | ['atk'] = Integer(1) 8 | | ['def'] = Integer(1) 6 | | ['rng'] = Integer(1) 5 | | ['amt'] = Integer(2) 10 | ) ) I have an attack value ( say 300 ). I want to take this value and minus the first key amount $array[0]['amt']. If that value then comes to 0 I then want to skip to the next array key and do the same $array[1]['amt'] until the attack value runs out or every array keys amount is equal to 0. Any ideas? |