Jump to content

bsamson

Members
  • Posts

    150
  • Joined

  • Last visited

About bsamson

  • Birthday November 27

Profile Information

  • Gender
    Not Telling

bsamson's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hello. I am having a heck of a time figuring this one out. I have an array (output below) with info loaded. Everytime I run this, the output a blank page, no errors. Just curious, am I missing something? Thanks in advance for any help. print_r ($tmp_errors) output: Array ( [0] => cust_add1 ) <?php $styleForErrorBoxes = "style='border: 1px solid #FF0000'"; $tmp_errors = unserialize($result[0]['tmp_errors']); if ($tmp_errors) { if (array_key_exists('cust_email', $tmp_errors)) { $err_cust_email = $styleForErrorBoxes; } if (array_key_exists('cust_phone', $tmp_errors)) { $err_cust_phone = $styleForErrorBoxes; } if (array_key_exists('cust_first', $tmp_errors)) { $err_cust_first = $styleForErrorBoxes; } if (array_key_exists('cust_last', $tmp_errors)) { $err_cust_last = $styleForErrorBoxes; } if (array_key_exists('cust_add1', $tmp_errors)) { $err_cust_add1 = $styleForErrorBoxes; } if (array_key_exists('cust_add2', $tmp_errors)) { $err_cust_add2 = $styleForErrorBoxes; } if (array_key_exists('cust_city', $tmp_errors)) { $err_cust_city = $styleForErrorBoxes; } if (array_key_exists('cust_state', $tmp_errors)) { $err_cust_state = $styleForErrorBoxes; } if (array_key_exists('cust_zip', $tmp_errors)) { $err_cust_zip = $styleForErrorBoxes; } } echo $err_cust_add1; ?>
  2. THANK YOU SO MUCH @Guru!!!
  3. I'm running into some issues with cookies and after reading the documentation, I am still very confused on why the following code produces this output. Why is the cookie not deleted by using the second setcookie function? Any help is GREATLY appreciated. Code: <?php setcookie(custID, "Brian", time()+7200, "/"); echo "Cookie Value: ".$_COOKIE["custID"]."<br>"; setcookie(custID, "", time()-7200, "/"); echo "Cookie Value: ".$_COOKIE["custID"]; ?> Result: Cookie Value: Brian Cookie Value: Brian
  4. Essentially, I am trying to condense what can be achieved in nested while loops ... I believe the following loop will achieve what i'm looking for: $qry = "SELECT * FROM sapImport JOIN conStatus ON sapImport.id = conStatus.record WHERE store='3' AND conStatus.statusCode < '998'"; $res = mysql_query($qry); while ($row = mysql_fetch_array($res)) { $idNo = $row['id']; $customer = $row['customer']; $invoiceNo= $row['soldOn']; $ptn = $row['ptn']; $recID = $row['record']; $query = "SELECT * FROM conStatus WHERE record = '$recID' ORDER BY id DESC Limit 1"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $record = $row['record']; $stCode = $row['statusCode']; } } Any suggestions?
  5. Ah, I was hoping you'd be around to help with this one!!! If there is only one reference in the conStatus table to a customer in the sapImport table - it works as expected. However, if there is more than one reference in the conStatus to a customer record in the sapImport table - it returns zero rows.
  6. I appreciate the help. Sadly as it's not that easy. The sapImport table contains customer information while conStatus simply tracks interactions with the customers from sapImport. So, in what I need here the soldOn row isn't used.
  7. I thought I had this issue figured out last night with the help from this forum, but turns out it still isn't working as expected. I have two tables: Table: sapImport id invoiceNo invoicedAtID invoicedAtName soldOn soldBy customer 1 CICIN123 3 Cicero 1384832632 brian john smith 2 DESTIN12 5 Destiny 1384832632 brian Henry Will 3 VESTIN32 3 Cicero 1384832632 jason Peter Jenn Table: conStatus id store record statusCode 34 3 1 0 35 5 3 0 39 3 1 15 I do have more rows than this, but i'm just trying to give an idea ... I currently have the following query: SELECT * FROM sapImport si INNER JOIN conStatus cs ON si.id = cs.record INNER JOIN ( SELECT record, MAX(id) as id FROM conStatus GROUP BY record ) mx ON cs.record = mx.record AND cs.record = mx.id WHERE cs.store='$storeID' AND cs.statusCode < '998' Basically, the table sapImport contains customer information and the conStatus table contains all interactions with a record in the sapImport table. The 'id' row in sapImport is the primary key and is auto-incremented. The 'record' row in conStatus references the 'id' row from sapImport. I need a query that pulls the LAST record (from conStatus) for a particular customer (from sapImport) where the store=x and the statusCode is less than 998. I should only get ONE result set with this. Any help will be GREATLY appreciated! Thanks in advance!
  8. @Barand - You are a genius my friend! Thank you SSOO much!!!! @SocialCloud - Thanks for your help as well.
  9. Appreciate that. However, I don't want just one total row return. I need one row with the highest ID, then move on to the next match. Does that make sense?
  10. Here's my database: Table: sapImport id invoiceNo soldOn 1 123456 11/18/2013 2 156541 11/15/2013 Table: conStatus id record statusCode 1 2 999 2 2 000 3 1 213 I have a query that looks like this: SELECT * FROM sapImport JOIN conStatus ON sapImport.id = record WHERE store = '2' So, the row record matches the ID in sapImport. I only want to display the latest record the corresponds to the row with the highest id. I've been trying to accomplish this for a few hours, but still can't figure it out. Any help is greatly appreciated!
×
×
  • 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.