Jump to content

jester626

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Everything posted by jester626

  1. I've got a snippet of code that accesses an email account using the the imap function. In my class file I can use 'sender' => $headerArr->sender[0]->mailbox . "@" . $headerArr->sender[0]->host, and it gives me the senders email address. However when I try to use 'reply_to' => $headerArr->reply_to[0]->mailbox. "@" .$headers->reply_to[0]->host, it does not give me the reply to address (which can be different when receiving e-mails from groups, forums, etc). Any help would be appreciated. Jess
  2. I have a script I am trying to write that will pull a unix timestamp from a MySQL database. I have no problem pulling the data using a WHERE starttime > ### AND endtime < ### which is good if I want to manually input a start and end time. My problem begins when i want to just pull the data out and want to simply pull the data in a GROUP By format by day. This is going to be a real simple appointment type of script. where the database has the following fields. RecID, Lastname,Firstname,AppointmentDate. The output would be something like: April 15, 2010 Appt. Time | Last Name | First Name April 17, 2010 Appt. Time | Last Name | First Name and so on. Any help would be appreciated. Jester
  3. OK, I know this is simple, but for some reason my brain is just not working through this for some reason. I have been able to successfully do a record count from an entire table, however in the table I have several categories that I want to list individually, next to each category I want to have a list of links under that category. For example: Personal Development (15) Leadership (10) Human Resources (5) I have gotten to the point of displaying each category by using the GROUP BY function ( SELECT * FROM TBL_ResourceLinks GROUP BY LinkCategory ) I have been trying to use the Sum function but I feel that is not the way to go. Can someone please help me get past this major brain cramp? Thanks,
  4. Solved it, Here is what I came up with $n = 12345 echo $english_format_number = number_format($n); This will display 12,345 Hope this is of some help to others
  5. That code adds decimal points not the commas. Thanks
  6. When running a total number of records in a database the results display as "4567" how would I tell the script to add a comma for thousands, millions, etc (ie. 4,567 or 1,234,567) Thanks
  7. I have a couple of questions regarding forms processing. I have a form that retrieves an e-mail address from my MySQL database. it is a simple form that has a text box for the subject field and a textarea for the message body. Here is where one of my issues arises. When I type a message and I hit the return key to start a new paragraph it all looks OK in the textarea box, however when I send the e-mail it appears as one single line on the recipient's mail client. how can I process the e-mail to send as it appears (to include the carriage returns) when entered. I have played with using the <BR> tag but that is cumbersome and I'm sure it may pose a problem on systems that display e-mails as text only. Secondly, I am wanting to include a URL (http://www.whatever.com) in the e-mail and make it so when it is displayed on the email client, the person can merely click on the link as opposed to having to copy and paste it in the browser. I know this is probably a very simple fix but I am at a lost. Thank in advance Jester
  8. You could simply save the file as .txt or .phps and that will display the source code in the browser then the viewer could simply use the "save as" feature of the browser.
  9. I have a DB where some fields are of the FLOAT nature. The Data that gets put into these field are 1.000, 1.500.1.250 etc. When I go to display them on PHP page I want to be able to drop any trailing zeros. Can anyone give me some insight on how to do this? Thanks, Jester
  10. Do you have shell access to your webhost? Meaning can you access it through a terminal window (such as putty)? If you can access your host via a terminal window then you can try and see if it will let you do a "cron -e" This may or may not work depending how your hosting provider has configured the domains. I would suggest you contacting them and asking them if it is possible. Hope this helps, Jester
  11. What did you use as the first line of your php file? Did you use #!/usr/local/bin/php -q ? Thanks
  12. I am trying to run a PHP Script in a crontab. I have added: #!/usr/local/bin/php -q at the top of the php page/script. I have also set up the crontab as follows: 00 40 * * * /var/www/the/rest/of/the/path/file.php This should run the script everyday at 00:40. But to no avail. I am using PHP 5.1.6 Any help would be appreciated Jester
  13. I have solved my own problem, I don't know exactly know how I did it, but this is what I came up with. If anyone would like to comment and explain what is actually happening here, I am sure we all would appreciate an explanation. foreach ($YourResults->SALES as $SALES) { // Use this section to insert into the machinesales info table print("<B>"); printf("ReadDate: %s\n", $SALES->ReadDate); print("</B>"); print ("<BR>"); // use this section to insert into columnsales info table foreach ($SALES->Items->Item as $Item) { printf("Coil: %s\n", $Item->ColumnName); printf("Price: %s\n", $Item->Price); printf("Vends: %s\n", $Item->Vends); printf("Sales: %s\n", $Item->Sales); print ("<BR>"); } }
  14. I have made some progress using the following code: <?PHP $xml = simplexml_load_file("report3.xml"); //echo $xml->getName() . "<br />"; foreach($xml->SALES->Items->Item[0] as $child01) { echo $child01->getName() . ": " . $child01 . "<br />"; } ?> The problem is that this example only provide me with the very first ColumnName Record of the very first ReadDate: ColumnName: 1 Price: 1.2500 Vends: 0 Sales: 0 It is some progress but not much. Thanks for your help Jester
  15. I have tried something very similiar, but due to the way the XML file is formatted, I am having a problem stepping down through the data tags. xml example: <YourResults> <SALES> <IDN>1234567891234567</TDN> <ReadDate>10/24/2007 10:55:00 AM</ReadDate> <TotalVends>1</TotalVends> <TotalSales>1.2500</TotalSales> <CashIn>1.2500</CashIn> <CashOut>0</CashOut> <BoxCash>0.2500</BoxCash> <TubeCash>0</TubeCash> <BillsToStacker>1.0000</BillsToStacker> <Items> <Item> <ColumnName>1</ColumnName> <Price>1.2500</Price> <Vends>0</Vends> <Sales>0</Sales> </Item> ..... ColumnName 2 through 9 in here .... <Item> <ColumnName>10</ColumnName> <Price>1.2500</Price> <Vends>0</Vends> <Sales>0</Sales> </Item> </Items> </SALES> </YourResults> The XML file could have multiple "ReadDate" meaning <SALES>....</SALES> could be displayed multiple times. I am trying to get the data into a MySQL database(which once I get the reporting part inplace I'll be able to perform the INSERT). The DB structure is as follows: [iDN][ReadDate][ColumnName][Price][Vends][sales] So using you example How do I get it to step through each ReadDate then through each ColumnName of Each Read Date? <CODE> $str = file_get_contents('report3.xml'); $xml = simplexml_load_string($str); echo $xml; foreach ($xml->SALES[0]->TDN as $a) { echo "TDN : {$a['TDN']}<br />"; echo "Title : $a->title <br /><br />" ; } </CODE> Thanks for any insight you can provide Jester
  16. This topic could go into so many different areas it is hard to determine which one, Sorry if I post this in the wrong area. I have a PHP Page that is Pulling an XML file in using XMLDOM which is javascript. I can traverse down the nodes and select the elements that I want to display buy using this code: document.getElementById("ColumnName").innerHTML=xmlDoc.getElementsByTagName("ColumnName")[0].childNodes[0].nodeValue; Then using an id tag to display. The problem is I have no clue how to make the php page display (loop through) every "record" inside the XML file. At present it only gives me the first record. Any help would be greatly appreciated
  17. I have a page with javascript (yea no DUH!) The problem is. The script seems pretty simple and straight forward and works like a champ in IE. However, the code constantly throws up the Firefox error console every time I "run it". No errors show in the console, but the box keeps popping up. Could someone have a look at my code and tell me if they see a potential problem that may be causing this situation. Thanks in advance, Jester <CODE> <head> <title>Untitled Document</title> <script language="JavaScript"> function answer(t){ document.getElementById('1').style.display='none'; document.getElementById(t).style.display='block'; } </script> </head> <body> <a onClick="answer('1')" href="javascript:">Question</a><br> <br> <div id="1" style="display:none";> Answer <br><br> </div> </body> </CODE>
  18. I have a simple XML file that I am trying to get PHP to display in a format that is easier to read. I am using the following code to get the xml data <SNIPPET> if (file_exists('raw.xml')) { $xml = simplexml_load_file('raw.xml'); print_r($xml); } else { exit('Failed to open raw.xml.'); } </SNIPPET> and the results page displays the data as such: SimpleXMLElement Object ( [ADN] => 680605000008000 [Date] => 6/6/2007 5:55:00 AM This is where I am totally lost. How can I make PHP remove the "SimpleXMLElement Object" text as well as the other extraneous characters so it only displays the actual data (i.e. 680605000008000, 6/6/2007 5:55:00 AM ) my end result is to format the display so I will be able to add additional MySQL INSERT syntax for adding to a DB. Thanks for your help. Jester
  19. This is probably pretty simple but I can't seem to find the exact answer I am looking for. I am pulling a couple of numbers from a database (productcost and productprice). I am trying to subtract the cost from the price to calculate the profit of the item. I have this part working with no problem. My problem lies when the final number has a trailing zero it will drop that number (i.e. 1.2 as opposed to 1.20) Here is what I am using: $profit = $row_viewcoils['ProductPrice'] - $row_viewcoils['ProductCost']; echo $profit; Any help would be greatly appreciated
  20. OK, got a DB with TimeIn and TimeOut Fields, they are set up as INT and am using strtotime when these fields are populated. I can get the math to find out the amount of time allotted between the two times <SNIPPET> $doseconds = $row_getLastPunch['TimeOut'] - $row_getLastPunch['TimeIn'] </SNIPPET> Now I know to take the number and divide by 60 to get the minutes, and then another 60 to get the hours. here is where my problem starts and my skill level stops. Say I have a final answer that breaks down to 98 minutes (5880 seconds) when I go to get the hours (98 divide by 60) I get '1.6333~ hours' which is correct math, I would rather it display '1:38 hours' or something close to that. Any help and assistance would be greatly appreciated. Jester
  21. I am pulling info from a MySQL DB. When I go to use Round like this: echo round($containers,1); It will give me an answer of 5.1 which is mathematically correct. However, I want it to give me an answer to the next highest half (.5) of a container so in this instance I would want the answer of 5.5 not 5.1. Is there a way to round to the next highest half? Thanks in advance Jester
  22. Still stuck on this one, Ideas anyone? Thanks
×
×
  • 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.