Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-05-2012, 05:11 PM   PM User | #1
qwertyjjj
New Coder

 
Join Date: Dec 2007
Posts: 59
Thanks: 1
Thanked 0 Times in 0 Posts
qwertyjjj is an unknown quantity at this point
check array for blanks

I have data as below.
I can't do this check in the SQL because my server is still on v 4 so I have to do it in PHP code.
If there is a blank line linked to an order ID but that orderID also has a PayPal entry then it's ok, I want to delete it from the array.
However, if it hast an OrderID and everything is blank, then I want to echo it.
In the example below:
9502 is incorrect
9503 only has 1 row but is ok
the rest may have 2 or more rows but as long as 1 row has PayPal in it, then it is ok.
How can I loop through an array but then delete everything from the array with that ID, and then carry on looping through the array again?

Code:
9511	3	PayPal IPN Verified [Completed (Verified; £24.99)]
9511	3	
9508	3	PayPal IPN Verified [Completed (Unverified; £3.99)]
9508	3	
9507	3	PayPal IPN Verified [Completed (Unverified; £1.99)]
9507	3	
9506	3	PayPal IPN Verified [Completed (Verified; £9.49)]
9505	3	PayPal IPN Verified [Completed (Verified; £9.49)]
9505	3	
9504	3	PayPal IPN Verified [Completed (Verified; £7.99)]
9504	3	
9503	3	PayPal IPN Verified [Completed (Unverified; £7.99)]
9502	3	
9502	3
qwertyjjj is offline   Reply With Quote
Old 11-06-2012, 06:04 AM   PM User | #2
Infect
New Coder

 
Join Date: Feb 2009
Location: United States
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Infect is an unknown quantity at this point
You've shown us no code, how are we supposed to fix what we can't see?
Infect is offline   Reply With Quote
Old 11-06-2012, 07:42 AM   PM User | #3
qwertyjjj
New Coder

 
Join Date: Dec 2007
Posts: 59
Thanks: 1
Thanked 0 Times in 0 Posts
qwertyjjj is an unknown quantity at this point
Quote:
Originally Posted by Infect View Post
You've shown us no code, how are we supposed to fix what we can't see?
Sorry, I was just asking in principle how you could do that with an array.
My initial attempt but not finished:

Quote:
$query = "
SELECT o.orders_id, o.orders_status, osh.comments
FROM orders o
INNER JOIN orders_status_history osh ON osh.orders_id = o.orders_id
AND osh.orders_status_id =1
AND o.orders_status =3
ORDER BY o.orders_id DESC ";

$result = mysql_query($query, $squid_conn_int) or die(mysql_error());

$oid = 0;
$arrToCheck = array();
while ($squid = mysql_fetch_array($result, MYSQL_NUM) )
{

//echo "<tr>";
//echo "<td>".$squid[0]."</td><td>".$squid[1]."</td><td>".$squid[2]."</td>";
//echo "</tr>";
//

if ($oid != $squid[0]
&& $squid[2] == ""
) {
$oid = $squid[0];
//add into array
$arrToCheck[] = $oid;
}
qwertyjjj is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:38 PM.


Advertisement
Log in to turn off these ads.