When I print_r'm selected rows from the database it is showing 3 records, but in my second foreign foreach This is showing only 1 record
// productid $ product find = $ database-> Ready ( "bids, orders, selecting products * where bids.bids_username = now () & gt; bid products.enddate order .orders_status = 0 group. Bids_aitim order Biaidikbeeds_aunt Diissi"); $ Product- & gt; Execute (array ($ username- & gt; username)); $ Productid = $ product- & gt; Fatch ALL (); Print_r ($ productid); // checks the order in the database foreach ($ productid as $ product): $ order = $ database-> Ready (select from "Order * with * where orders_product = and orders_username ="); $ Order- & gt; Execution (array ($ product-> Bids_item, $ username- & gt; username)); $ Result = $ order- & gt; get receive; all (); Endforeach; // contains the command, then ($ result!): $ Createorder = $ database-> Ready (insert "commands (orders_username, orders_product, orders_firstname, orders_lastname, orders_address1, orders_address2, orders_zipcode, orders_city, orders_country, orders_btcaddress, orders_status) values (?????????? ,,,,,,,,, ,) "); Foreign Currency ($ $ as a Manufacture Product): Copy $ Product-> Bid_item; //, get the BTC address if it is valid, then check the isset run query below $ createorder-> gt; Execute (array ($ username- & gt; username, $ Products & gt; bids_item, $ username- & gt; firstname, $ username- & gt; lastname, $ username- & gt; the 1, $ username- & Gt; address2, $ username- & gt; zipcode, $ username- & gt; city, $ username- & gt; country, 'jkjkjk', 0)); Return 1; Endforeach; end if;
Whem I echo the bids it only looks 1 results when it should run through 3 and all should echo sound in my code wrong ?
error is contained in your second foreach loop The return statement causes all execution so that the first run can be stopped. Remove the return details and it should work as expected.
foreach ($ Manufacturer $ as product): Copy $ product- & gt; Bids_item; // Get a BTC address, if it is valid, check that if isset runs the query $ beloworder- & gt; Execute (Array ($ username- & gt; username, $ Products & gt; Beeds_aytm, $ username- & gt; Prthamnam, $ username- & gt;; last name, $ username- & gt; Address 1, $ user Name- & gt; Address2, $ username- & gt; zipcode, $ username- & gt; city, $ username- & gt; country, 'jkjkjk', 0)); Return 1; Endforeach;
No comments:
Post a Comment