
tomtimms
Members-
Posts
114 -
Joined
-
Last visited
Never
Everything posted by tomtimms
-
So let me get this straight, you want a link that will take you to a page that will show even more information based on the product that was selected? If that is the case then you need to have a field in your database that will contain an ID.
-
so you want a link like so <a href="yourpage.php?id=id_generated">Link Name </a> if you want to create a unique id for each row then just give your loop a counter and replace id_generated with your variable.
-
your while loop is before your html tag, this doesn't make any sense. try and put it after your <body> tag if you want to loop multiple tables for each customer <?PHP while($row = mysql_fetch_array($result)){ echo "Customer: " . $row['Account_and_Name']; echo "<br />"; ?> <table> <tr> <th>Month</th> <th>Gallons Sold</th> <th>Sales Dollars</th> <th>Cost of Goods Sold</th> <th>Gross Profit</th> <th>Profit Per Gallon</th> </tr> </table> <?PHP } ?>
-
is there an "IF EXISTS" clause for a SELECT statement?
-
Thanks for the help, I was able to use the script posted and it works great, however what if the table doesn't exists? I have a date range picker and I don't want to adjust it to only be able to select a specific date range. How can I have it so that if a user selects current year and I only have 3 of the current 12 tables created that it won't show a sql error that the tables don't exists? I tried using while($current_table <= $end_table){ $Table = mysql_query("show tables like '" . $current_table . "'"); if(mysql_fetch_row($Table) === true) { $query .= "\n UNION SELECT * FROM reports_$current_table WHERE date BETWEEN '" .date("Y-m-d", strtotime($start)) . " 00:00:00' AND '" .date("Y-m-d", strtotime($end)) . " 23:59:59' AND source='" . $source . "' GROUP BY day(date)"; // append union query $current_table = next_table($current_table); // get the next table } } however it doesn't work.
-
I wish I could be putting it into 1 table however there is going to be too much data. Every month new tables will be created then eventually archived over time. Any clue on where to begin? I assume I would need to grab all the months/year and see how many there are between that range and get its value...
-
I agree, however what if my date range is 01/01/2009 to 06/01/2010? How could I obtain all the months in that date range then append it to my query to select each table for each month. So I would be selecting from a total of 18 tables. Just a starting point would be awesome from anyone.
-
I need to run a query for a report, however it needs to be taken from 2 tables on the same database. I have reports201005 and reports201006 as my tables (year and month). Say I need to run a report that gets data from may 15th (reports201005) to june 15th (reports201006). Each table has a date field (obviously), a total column, and a location column. So my query would need to select date, total, location FROM reports201005 and reports201006 from the date range BETWEEN 05-15-2010 AND 06-15-2010. Also keep in mind I have a table for each month so the user can also select a different date range. I have been making this really complicated in my head and just need a solid starting point on where to begin. Any logic would be great!
-
PayPal API Using Curl - How To Prevent Status In Error Log
tomtimms replied to tomtimms's topic in PHP Coding Help
here is my connection <?php function PPHttpPost($methodName_, $nvpStr_) { $API_UserName = $API_Password = $API_Signature = $API_Endpoint = "https://api-3t.paypal.com/nvp"; $version = urlencode('51.0'); // setting the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); // turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); // NVPRequest for submitting to server $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_"; // setting the nvpreq as POST FIELD to curl curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); // getting response from server $httpResponse = curl_exec($ch); if (!$httpResponse) { exit("$methodName_ failed: " . curl_error($ch) . '(' . curl_errno($ch) . ')'); } // Extract the RefundTransaction response details $httpResponseAr = explode("&", $httpResponse); $httpParsedResponseAr = array(); foreach ($httpResponseAr as $i => $value) { $tmpAr = explode("=", $value); if (sizeof($tmpAr) > 1) { $httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1]; } } if ((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) { exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint."); } return $httpParsedResponseAr; } ?> -
I am currently using the Pay Pal API and whenever I go to the page that connects it shows the complete connection in my error log. How can I prevent this? Below is what is printed out. I tried using "@" before each curl_ reference however this doesn't prevent the error from showing. Connected to api-3t.paypal.com (66.211.168.126) port 443 * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using DES-CBC3-SHA * Server certificate: * subject: /C=US/ST=California/L=San Jose/O=PayPal, Inc./OU=Information Systems/CN=api-3t.paypal.com * start date: 2009-09-24 00:00:00 GMT * expire date: 2011-09-19 23:59:59 GMT * issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa ©09/CN=VeriSign Class 3 Secure Server CA - G2 * SSL certificate verify ok. > POST /nvp HTTP/1.1 Host: api-3t.paypal.com Accept: */* Content-Length: 157 Content-Type: application/x-www-form-urlencoded METHOD=GetBalance&VERSION=51.0&PWD=6SZ4PMFR7879HBDB&USER=****_api1.*****.com&SIGNATURE=AFcWxV21C7fd0v3bYYYRCpSSRl31Adju6w2eRqw.IhcgUi1iU1NUsGrQ< HTTP/1.1 200 OK < Date: Thu, 10 Jun 2010 18:51:58 GMT < Server: Apache < Content-Length: 140 < Connection: close < Content-Type: text/plain; charset=utf-8 * Closing connection #0 * About to connect() to api-3t.paypal.com port 443 * Trying 66.211.168.126... * connected * Connected to api-3t.paypal.com (66.211.168.126) port 443 * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using DES-CBC3-SHA * Server certificate: * subject: /C=US/ST=California/L=San Jose/O=PayPal, Inc./OU=Information Systems/CN=api-3t.paypal.com * start date: 2009-09-24 00:00:00 GMT * expire date: 2011-09-19 23:59:59 GMT * issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa ©09/CN=VeriSign Class 3 Secure Server CA - G2 * SSL certificate verify ok. > POST /nvp HTTP/1.1 Host: api-3t.paypal.com Accept: */* Content-Length: 157 Content-Type: application/x-www-form-urlencoded
-
I thought I had it. How can I make this so that only "NET" is looped then I can put it all into a table? $sql = "SELECT company,net FROM accounts"; $result = mysql_query($result); while ($array = mysql_fetch_array($result) { foreach ($array AS $i => $amt) { if ($amt > 10000) { $d = intval($amt/10000); $r = $amt % 10000; for ($i = 0;$i < $d;++$i) { echo "10,000<br>\n"; } echo $r . "<br>\n"; } else { echo $amt . "<br>\n"; } } }
-
Thanks KEN the second one worked, however how could I use this when I am using mysql_fetch_array to get values from my database? Would I add a while loop before the foreach loop to get all the values?
-
It is for payments, no payment can be more than 10k. So if I have a payment going out that is more 10,000 it has to be broken down to numbers less than 10,000 so they can be sent. So if I had a payment of 25,000 I would need 10,000 - 10,000 - 5,000.
-
I have a table something like below. I need to display these results into a table however any number that is greater than 10,000 I need it split up so the number cannot be greater than 10,000. I am not sure where to begin or how to do this as I would need it to look like the example below. Table: ID : Amount 1 10,400 2 8,000 3 10,300 4 5,000 5 1,000 Example Result/Display 1 5,000 1 5,400 2 8,000 3 5,000 3 5,300 4 5,000 5 1,000 Is this possible? If anyone could assist or give a helping hand on where to start I would be very thankful.
-
My database is fine, I just shortened it up and changed things around to show what I am trying to accomplish. yes and on file are fields that are required from a user in order for them to get paid. So yes represents if they were verified and on_file represents there tax information. If both of those are in the table then they get paid, however if they both are not then they don't. I am trying to get a query that shows either 1. there both missing and 2. if they have one inserted, to get the field that is missing. I hope that clears it up a little bit.
-
I mean 2 tables instead of databases.
-
I am trying to see if a database either doesn't have a record, or if it contains 1 of 2 results. I have a total of 2 databases and there are joined by ID. Database 1 contains the following. ID | Amount 1 100 2 200 3 300 4 400 5 500 Database 2 has ID : Type 1 : on_file 1: yes 2. on_file 2: yes 3: on_file 4: yes I need a query that will join database 1 to database 2 on ID then it will return the results where ID doesn't have either "on_file" or "yes" or both. So my results would end up like. ID | Misssing 3 yes 4 on_file 5 yes,on_file I can't wrap my head around this on where to start, I figured out how to get the results where "on_file" and "yes" are both found however can't figure out how to get the results where they are not. Any starting point would be great.