Jump to content

bsamson

Members
  • Posts

    150
  • Joined

  • Last visited

Everything posted by bsamson

  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. 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
  3. 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?
  4. 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.
  5. 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.
  6. 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!
  7. @Barand - You are a genius my friend! Thank you SSOO much!!!! @SocialCloud - Thanks for your help as well.
  8. 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?
  9. 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!
  10. Hello. I have a mysql database with an 'entrytime' field which contains the unix timestamp the record was added. How do I create a mysql query to select all records for a given month/year? For example, if I wanted to create a query to display all records for October 2010 how do I go about it? I am at a loss and can't find my answer via google. Thanks in advance for any help!
  11. Found this great code that lists the file by timestamp ... exactly what I needed. Hope this helps someone else. define ("FILEREPOSITORY", "/home/nxsap/public_html/uploads/"); if (is_uploaded_file($_FILES['priceguide']['tmp_name'])) { if ($_FILES['priceguide']['type'] != "application/pdf") { echo "<p>Class notes must be uploaded in PDF format.</p>"; } else { $name = "priceguide"; $result = move_uploaded_file($_FILES['priceguide']['tmp_name'], FILEREPOSITORY."$name.pdf"); if ($result == 1) echo "<p>File successfully uploaded.</p>"; else echo "<p>There was a problem uploading the file.</p>"; } #endIF } #endIF
  12. Hello. I have a directory with files that look like this: priceguide_20100809.pdf priceguide_20100808.pdf priceguide_20100807.pdf priceguide_20100806.pdf I am trying to come up with a function that will grab and save the filename with the biggest date .. ie: priceguide_20100809.pdf. Any assistance would be greatly appreciated!!
  13. THANK YOU!!!!! A "tired mans" mistake! Thanks again!
  14. <? ## CONNECT TO DB FUNCTION! function ConnectTo($db2con) { $hostName = "localhost"; $dbName = "people_".$db2con; $userName = "people_main"; $password = "normal123"; $link = mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName"); mysql_select_db($dbName, $link) or die( "Unable to select database $dbName"); return $link; } $conn = ConnectTo("estore"); $query = "SELECT * FROM CubeCart_inventory"; $result = mysql_query($query) or die(mysql_error()); $num = mysql_num_rows($result); while ($row=mysql_fetch_array($result)) { $prod = $row['productId']; $cat = $row['categories']; } ?> I have the above code ... EVERYTIME it runs I get this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/people/public_html/code/xml/scripts/loadCatIDx.php I do not understand this problem! I understand the error is implying my query returned an error, however when I add echo mysql_num_rows($result) it returns over 2700 records ... Any help would be greatly appreciated!!
  15. Thank you!!! It's been a while since I coded ... I knew it was a simple solution, but completely forgot about explode!!!! THANK YOU! THANK YOU!!!
  16. Hello. If I have a string in the this format: $models = "1603, 1802, 1527, 1782, 1817, 1598, 1666, 1781, 1970, 1939, 1889, 1762, 1761, 1885, 1821, 1827, 1857, 1921, 1942, 1756, 1930, 1414, 1856, 1920"; Now, an interesting thing about $models is that sometimes there will be only 1 model (ie: $models="1234"), and as you can see from above example it sometimes contains many ... but the constant is that it will always be in that format. Is there a quick function/script to store each of those numbers (ie: 1603) into an array? Any help would be GREATLY appreciated! Thanks!
  17. Hello. I am trying to create a query to show all result within 2 months ... Here's the query: $query = "SELECT * FROM v2callbacks WHERE store='96' AND (DATE_FORMAT(FROM_UNIXTIME(`cbdate`), '%Y/%m') = '2009/10') AND (DATE_FORMAT(FROM_UNIXTIME(`cbdate`), '%Y/%m') = '2009/11') AND cbstatus != 'c' ORDER BY lname ASC" or die(mysql_error()); I just added the second DATE_FORMAT ... and now it shows 0 results. Anyone have any suggestions what the problem is ... or if there is a better way to do this. Thanks in advance!
  18. Im sorry if this is the incorrect forum ... but my website is on a dedicated server running cpanel. How do I configure files w/ no extension a php file? Thanks in advance
  19. Great! Thanks for your help. It's a new dedicated server and the timezone was incorrect initially. When I set it correctly it did not update mysql. After restarting MySQL all was well. Thanks again!
  20. SELECT FROM_UNIXTIME(1225843575) = 2008-11-05 00:06:15 SELECT FROM_UNIXTIME(1225929544) = 2008-11-05 23:59:04 hhmmm ... im confused now. because in php if i run: echo date("m/d/Y", 1225843575)."<br>".date("m/d/Y", 1225929544) I get: 11/04/2008 11/05/2008
  21. I have a table that looks like this: ID entryDate storeNo 01 1225843575 5843 02 1225929544 5843 entrydate 1225843575 is 11/04/2008, and 1225929544 is 11/05/2008. Now, when I run this query: SELECT * FROM v2breakdown WHERE DATE_FORMAT(FROM_UNIXTIME(`entrydate`), '%m/%d/%Y') = '11/05/2008' phpMyAdmin returns both id 01, and id 02. Is there something wrong w/ the query? It should only return ID 02. Thanks in advance for any direction! Thanks!
  22. Awesome! Works, thanks for all your help!
  23. Thanks ... but is it a subdomain that is referenced via: http://sub.mydomain.com/ and cant be referenced the other way (such as http://www.sub.mydomain.com/)
  24. I know the values load on the Login.php page though. What would you recommend I do to test it? p.s.: Thanks for all your help in the past!
×
×
  • 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.