Jump to content

jakebur01

Members
  • Posts

    885
  • Joined

  • Last visited

Everything posted by jakebur01

  1. That's the way PHP was for me when I first starting dealing with it. I finally went and bought a good book on it and started from the beginning and gradually worked my way through it. It actually had a shopping cart in the back of it. By the time I got to the shopping cart, I knew my way around in the code.
  2. You might could implement some sort of redirect or page refresh into some of your pages. Put it within an if statement so it doesn't continuously refresh or reload over and over. This is javascript, but I use it sometimes after a database insert or form submit to keep people from being able to refresh the page or hit the back button and submit the same form twice. <script type="text/javascript"> <!-- window.location = "http://www.google.com/" //--> </script>
  3. Find a shopping cart tutorial. Build a basic cart that works off a MySQL table then add this other stuff in later. It would be that hard to do what your wanting to do, but you should build your foundation first.
  4. Or rather find the number of how many months it is back to November? Example: If I could calculate that November is 6 months back. Store it in $backtoNov. I could subtract 6 from 27. That would help me in knowing that last November would be column SALES_PD_21. * The sum of the totals between SALES_CUR_PD and SALES_PD_21 would give me (CYTD)"current year to date sales". I know that 27 - 12 is 15, giving me the current month a year ago as SALES_PD_15. I could subtract $backtoNov from this, which is 6 in this case, giving me 9. So, last year to date's starting year in November would be SALES_PD_9. * The sum of the totals between SALES_PD_15 and SALES_PD_9 would give me (LYTD)"last year to date sales".
  5. Well just as a starting place, how do I find last November? $Currmonth = mktime(0, 0, 0, date("m"), date("d"), date("y")); echo date("m", $Currmonth);
  6. No. I can't do much of anything with it. It was built in a language called ProvideX. So, I do as much cool stuff as I can using PHP and the ProvideX ODBC. I've been using wget with a scheduled task to generate e-mail reports.
  7. I have a table with Territory Representative Sales. It has columns that go back 26 months. The columns are SALES_OLDEST_PD_1, SALES_PD_2, SALES_PD_3, ..... SALES_PD_25, SALES_LAST_PD_26, & SALES_CURR_PD_27. SALES_CURR_PD_27 is the current month. I want to build a table with "Last Year To Date Sales" (LYTD), "Current Year To Date Sales" (CYTD), (May 2011), and (May 2010). I know that (May 2011) will be SALES_CURR_PD_27 and (May 2010) will be SALES_PD_15. The trick is that the sales year starts in November. So, I need to figure out a way to match the table columns with "Nov. 09 - May. 10 TOTAL" for (LYTD) and "Nov. 10 - May. 2011 TOTAL" for (CYTD). I am familiar with using mktime() to subtract months. But, I am not sure where to start yet on this project. Jake while (odbc_fetch_row($rs)) { $M1 += odbc_result($rs,"SALES_OLDEST_PD1"); $M2 += odbc_result($rs,"SALES_PD2"); $M3 += odbc_result($rs,"SALES_PD3"); $M4 += odbc_result($rs,"SALES_PD4"); $M5 += odbc_result($rs,"SALES_PD5"); $M6 += odbc_result($rs,"SALES_PD6"); $M7 += odbc_result($rs,"SALES_PD7"); $mate += odbc_result($rs,"SALES_PD8"); $M9 += odbc_result($rs,"SALES_PD9"); $M10 += odbc_result($rs,"SALES_PD10"); $M11 += odbc_result($rs,"SALES_PD11"); $M12 += odbc_result($rs,"SALES_PD12"); $M13 += odbc_result($rs,"SALES_PD13"); $M14 += odbc_result($rs,"SALES_PD14"); $M15 += odbc_result($rs,"SALES_PD15"); $M16 += odbc_result($rs,"SALES_PD16"); $M17 += odbc_result($rs,"SALES_PD17"); $M18 += odbc_result($rs,"SALES_PD18"); $M19 += odbc_result($rs,"SALES_PD19"); $M20 += odbc_result($rs,"SALES_PD20"); $M21 += odbc_result($rs,"SALES_PD21"); $M22 += odbc_result($rs,"SALES_PD22"); $M23 += odbc_result($rs,"SALES_PD23"); $M24 += odbc_result($rs,"SALES_PD24"); $M25 += odbc_result($rs,"SALES_PD25"); $M26 += odbc_result($rs,"SALES_LAST_PD26"); $M27 += odbc_result($rs,"SALES_CURR_PD27"); } Note: By the way SMF is changing $M"8" to $M"ate". lol
  8. In your html form, put action="your_page.php". At the top of your page, put something like. if(isset($_POST['name'])) { $name =$_POST['name']; //connect to sql //then //mysql_query("UPDATE name WHERE `user` = '$user'"); }
  9. I am having trouble transferring data from provideX ODBC to MySQL using Navicat. So, I am wanting to write a php script that will write all of the data to a text file, then do a MySQL "DATA LOAD INFILE". I am VERY limited as far as the SQL functions that are available to me with the ODBC connection. The table does not have a special unique identifier other than the item number. This table I am pulling from has a little over 100,000 items. How can I get php to process the full 100,000 rows. I thought about getting it to process 5,000 rows sorted by item #> break > pass the last item to the next page > then process the next batch of 5,000 sorted by item # where the item is greater than the item processed on the last page. ?? Jake I have not tested this code yet. I just kind of threw it together. <?php set_time_limit(900); ini_set('max_execution_time', '999'); $myFile = "item_master.txt"; unlink($myFile); $fp = fopen("item_master.txt", "w"); require("..\inc/data.inc"); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT ITEM_NUM, DESCRIPTION_1, DESCRIPTION_2, ITEM_CLASS, ALPHA_SORT, STANDARD_PACK, GL_TABLE, PRIMARY_VND_NUM, VENDOR_ITEM_NUM, ACTIVE, ITEM_PRICE_CLS FROM ic_inventry_mast"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} while (odbc_fetch_row($rs)) { $ITEM_NUM=trim(odbc_result($rs,"ITEM_NUM")); $DESCRIPTION_1=trim(odbc_result($rs,"DESCRIPTION_1")); $DESCRIPTION_2=trim(odbc_result($rs,"DESCRIPTION_2")); $ITEM_CLASS=trim(odbc_result($rs,"ITEM_CLASS")); $ALPHA_SORT=trim(odbc_result($rs,"ALPHA_SORT")); $STANDARD_PACK=trim(odbc_result($rs,"STANDARD_PACK")); $GL_TABLE=trim(odbc_result($rs,"GL_TABLE")); $PRIMARY_VND_NUM=trim(odbc_result($rs,"PRIMARY_VND_NUM")); $VENDOR_ITEM_NUM=trim(odbc_result($rs,"VENDOR_ITEM_NUM")); $ACTIVE=trim(odbc_result($rs,"ACTIVE")); $ITEM_PRICE_CLS=trim(odbc_result($rs,"ITEM_PRICE_CLS")); $ITEM_NUM=str_replace('@','',$ITEM_NUM); $DESCRIPTION_1=str_replace('@','',$DESCRIPTION_1); $DESCRIPTION_2=str_replace('@','',$DESCRIPTION_2); $ITEM_CLASS=str_replace('@','',$ITEM_CLASS); $ALPHA_SORT=str_replace('@','',$ALPHA_SORT); $STANDARD_PACK=str_replace('@','',$STANDARD_PACK); $GL_TABLE=str_replace('@','',$GL_TABLE); $PRIMARY_VND_NUM=str_replace('@','',$PRIMARY_VND_NUM); $VENDOR_ITEM_NUM=str_replace('@','',$VENDOR_ITEM_NUM); $ACTIVE=str_replace('@','',$ACTIVE); $ITEM_PRICE_CLS=str_replace('@','',$ITEM_PRICE_CLS); $row="$ITEM_NUM@$DESCRIPTION_1@$DESCRIPTION_2@$ITEM_CLASS@$ALPHA_SORT@$STANDARD_PACK@$GL_TABLE@$PRIMARY_VND_NUM@$VENDOR_ITEM_NUM@$ACTIVE@$ITEM_PRICE_CLS\r\n"; fwrite($fp, $row); } fclose($fp); ?>
  10. Any query you try to do with it is slow as all get out. I was using navicat to import the item data over to MySQL and it has been loosing its connection during the middle of the transfer. There are a little over 100,000 items. I know it can't be navicat, because I have imported from other ODBC connection types with about 300,000 rows and 20 or more columns. I'm think about building some kind of custom update/transfer script with php. Jake
  11. I do not have the option that I know of to do a LIMIT 10 in my odbc query. How can I get it to count the number of while loops and stop at 10? while (odbc_fetch_row($rs)) { }
  12. I think in this odbc query the select where the purchase date is greater that the scan date is not working. Here is an example of one row: Scan date=03/21/11 Purchase date=09/07/06. SELECT PURDATE1, RECNO5 FROM ARVEND WHERE PURDATE1 > '03/21/11' AND ITEM = '0270' AND PURDATE1 <> '' Query: SELECT PURDATE1, RECNO5 FROM ARVEND WHERE PURDATE1 > '$checklastdate' AND ITEM = '$ITEM' AND PURDATE1 <> ''
  13. Basically, this part of the code is checking the "scanned" table in my mysql database to get the last scanned date for the item at hand. It then takes that date and selects all the vendor items in the odbc table "ARVEND" that are greater than the last purchase date. || This is where I am running into a problem. When it loops through each vendor item it selects from the "associated" mysql table to see if the vendor item has been scanned. If it does not find anything I am trying to get the $checkpurdate variable to add 1 to itself. | In the second script you will see the elseif($checkpurdate>0) .... Here I am saying if there are any vendor items that have not been scanned, highlight the row in yellow. But, this part of my code $checkpurdate = $checkpurdate + 1; does not seem to be counting correctly. Sometimes it counts '4' for an item when there are only two vendor items available. All of this may sound confusing since you may not know what I am trying to do. But, the main problem I am having is the counting part is returning wrong numbers. $checkpurdate = $checkpurdate + 1; /* $checkpurdate */ $query3 = "SELECT date FROM scanned WHERE `item` = '$ITEM' ORDER BY date DESC LIMIT 1"; $result3 = mysql_query($query3); $checklastdate = ""; while($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) {$checklastdate= $row3['date']; $checklastdate=date("m/d/y", strtotime($checklastdate)); } //checkpurdate loops $checkassoc="0"; $checkpurdate="0"; $sqlc="SELECT RECNO5 FROM ARVEND WHERE PURDATE1 > '$checklastdate' AND ITEM = '$ITEM'"; $rsc=odbc_exec($conn,$sqlc); if (!$rsc) {exit("Error in SQL");} while (odbc_fetch_row($rsc)) { $checkrecno5=odbc_result($rsc,"RECNO5"); $checkassosquery = "associated WHERE `VENDORID` = '$checkrecno5' AND ITEM = '$ITEM'"; $checkassoc = get_rows($checkassosquery); if($checkassoc>0) { // do nothing } else { $checkpurdate = $checkpurdate + 1; } } elseif($checkpurdate>0) { echo"<TR class=\"NV\"> <TD>"; }
  14. Don't have that option right now. Just trying to do the best with what I have to work with. I need to figure out a way to generate a preview of the 1st page of pdf document.
  15. Is there any way to generate a small image of the 1st page of a pdf document without using a 3rd party like imagemagic. The site is hosted a register.com so I am thinking I am going to be limited to the basic php functions.
  16. What is the correct way to use the backslash here? I am using an ftp script and retrieving the brand directory name through url. I want to catch it if they try to use \ in the url to list all directories. elseif($_GET[f]=="\") { echo "You have entered an invalid vendor."; $_SESSION['brand_path'] = "INVALID"; }
  17. cmd output: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\bruser>php C:\Inetpub\wwwroot\test.php <html> <body> <table><tr><th>UPC</th><th>ITEM</th></tr><tr><td></td><td></td></tr><tr><td>7895 9-02120</td><td>6105</td></tr><tr><td>2959900038</td><td>8623</td></tr><tr><td>0 72564053048</td><td>0553</td></tr><tr><td>03874402233</td><td>0898</td></tr><tr> <td>03874402277</td><td>0899</td></tr><tr><td>85771-24508-9</td><td>6940</td></t r><tr><td>10099709600120</td><td>8972</td></tr><tr><td>052100010762</td><td>8252 </td></tr><tr><td>41799853811</td><td>0634</td></tr><tr><td>72714100113</td><td> 0992</td></tr><tr><td>9357388262</td><td>1000</td></tr><tr><td>9357388263</td><t d>1002</td></tr><tr><td>9357388264</td><td>1004</td></tr><tr><td>9357388265</td> <td>1006</td></tr><tr><td>9357388794</td><td>1008</td></tr><tr><td>9357388266</t d><td>1010</td></tr><tr><td>9357728040</td><td>1428</td></tr><tr><td>9047821211< /td><td>1552</td></tr><tr><td>9047821241</td><td>1553</td></tr><tr><td>904782121 2</td><td>1554</td></tr><tr><td>9047821240</td><td>1556</td></tr><tr><td>9047821 214</td><td>1558</td></tr><tr><td>9047821243</td><td>1560</td></tr><tr><td>90478 21213</td><td>1562</td></tr><tr><td>9047821218</td><td>1563</td></tr><tr><td>904 7821621</td><td>1564</td></tr><tr><td>9047821622</td><td>1566</td></tr><tr><td>9 047821628</td><td>1568</td></tr><tr><td>9047821630</td><td>1570</td></tr><tr><td >9047821623</td><td>1572</td></tr><tr><td>8615415131</td><td>1574</td></tr><tr>< td>4230100006</td><td>1576</td></tr><tr><td>8615475139</td><td>1578</td></tr><tr ><td>2986000101</td><td>1580</td></tr><tr><td>9047821220</td><td>1582</td></tr>< tr><td>5100001296</td><td>1606</td></tr><tr><td>93573882639</td><td>1002</td></t r><tr><td>30908382380</td><td>0776</td></tr><tr><td>21952006229</td><td>0398</td ></tr><tr><td>93573882622</td><td>1000</td></tr><tr><td>51353001025</td><td>0089 </td></tr></table> </body> </html> C:\Documents and Settings\bruser>^A^A safari/ie output: <html> <body> <br /> <b>Warning</b>: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: [simba][simbaEngine ODBC Driver][DRM File Library]No such database., SQL state 08004 in SQLConnect in <b>C:\Inetpub\wwwroot\test.php</b> on line <b>6</b><br /> Connection Failed:
  18. Does anybody have any idea why I can access the data from this odbc connection through the command prompt but not through my web browser?
  19. If you are updating existing data, you probably could just add a column to the database and call it ticket_id and update the ticket id into that column. Just have php generate the unique number, have php check to be sure this number is not already being used, if so create another id, check again, then update the number into the column. If you could post your html form code and the php you are using to update or post, I might could help you better.
  20. Oh... and I'm running php 5.3.6 with IIS 5 on xp professional.
  21. It is some kind of permission issue. If I run: php C:\Inetpub\wwwroot\test.php from the command line, it prints out all the table data. What permissions do I need to set in order to be able to access this data through my browser?
  22. I have "UPC" setup as a system dsn, type "CodeBaseOdbcStand", and I can connect to it from access. However, I am not having success yet using php. This is a connection to .dbf /.cdx files for data associated with our inventory program. ERROR PHP Warning: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: [simba][simbaEngine ODBC Driver][DRM File Library]No such database., SQL state 08004 in SQLConnect in C:\Inetpub\wwwroot\test.php on line 6 CODE <html> <body> <?php $conn=odbc_connect('UPC','',''); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT * FROM ARUPC"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo "<table><tr>"; echo "<th>UPC</th>"; echo "<th>ITEM</th></tr>"; while (odbc_fetch_row($rs)) { $UPC=odbc_result($rs,"UPC"); $ITEM=odbc_result($rs,"ITEM"); echo "<tr><td>$UPC</td>"; echo "<td>$ITEM</td></tr>"; } odbc_close($conn); echo "</table>"; ?> </body> </html>
×
×
  • 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.