Jump to content

snowman2344

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

snowman2344's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello I am looking for help with the following function. What it does is get all the Wednesdays and Saturdays between 2 given dates. For that it works perfectly. I then use those dates with some more php to scrape a lottery site for the winning numbers and winning cash amounts. I am running into a problem when I use the function on a draw date. The lottery posts results after 11pm and if it is run before that time on the day of it returns the correct dates including the day of but the rest of my php errors because that lottery site is not updated. SO WHAT I AM LOOKING FOR is to run the function on the day of ONLY after 11pm EG If the start date = Wednesday July 11th And today = Wednesday July 25th And I run the function at 2pm in the afternoon I want the script to return the following Array ( [0] => 11 Jul 2012 [1] => 14 Jul 2012 [2] => 18 Jul 2012 [3] => 21 Jul 2012 ) If I run it after 11pm I want the function to return the following Array ( [0] => 11 Jul 2012 [1] => 14 Jul 2012 [2] => 18 Jul 2012 [3] => 21 Jul 2012 [4] => 25 Jul 2012 ) But any date before 11pm the day of return all Wednesdays and Saturdays function getDays($start,$end) { $t = new DateTime($start ."12:00"); $e = new DateTime($end ." 12:00"); if ($e == 'Today'){ } $out = array(); for (; $t<=$e; $t->modify("+1 day")) { $day = $t->format("D"); if (in_array($day, array('Wed','Sat'))) { $out[] = $t->format('d M Y'); } } return $out; } //to call function i use the following $dates = getDays($start_date, 'Today'); Thanks in advance
  2. Thanks for the response. I know how to use the Parser but am running into a specific problem. The problem is that the HTML is coded badly and is missing the closing tag. Therefore the parser is not getting the correct value for each set of tags. As in the following example the closing <P> tag is missing causing the error. Just wondering if the parser can somehow account for this and get the correct values?? <p class=”blue”> blaa blaa blaa<p> <p class=”blue”>hey hey hey <------------- missing <p> <p class=”blue”>ha ha ha<p> Values i get $r = blaa blaa blaa $s = hey hey hey ha ha ha <-------------- Wrong $t = ha ha ha Values i want $r = blaa blaa blaa $s = hey hey hey $t = ha ha ha
  3. I am trying to scrape a page with simple_html_dom.php but have run into a problem. I am looking for an html tag but the page only has an opening tag on some of the elements to be scraped. EG <p class=”blue”> blaa blaa blaa<p> <p class=”blue”>hey hey hey <p class=”blue”>ha ha ha<p> Note the missing p tag on the second element. I scrape for the class blue and get the following $r = blaa blaa blaa $s = hey hey hey ha ha ha $t = ha ha ha What i want is $r = blaa blaa blaa $s = hey hey hey $t = ha ha ha I scrape for the class blue and get the following How can i scrape this??? I cannot change the html to be scraped. Thanks in advance
  4. im working whith this but is is not working correctly if ($_GET['do'] == 'up') { // Selected line $posQuery = "SELECT Id, page_order FROM winning_numbers WHERE page_order = '".$_GET['order']."'"; $posResult = mysql_query($posQuery) or die(mysql_error()); $posObj = mysql_fetch_object($posResult); // Position above selected line $moveQuery = "SELECT Id, page_order FROM winning_numbers WHERE page_order = ".$posObj->page_order."+1"; $moveResult = mysql_query($moveQuery) or die(mysql_error()); $moveObj = mysql_fetch_object($moveResult); $checkPos = mysql_query("SELECT page_order FROM winning_numbers ORDER BY page_order DESC LIMIT 1") or die(mysql_error()); $check = mysql_fetch_object($checkPos); if($posObj->page_order != $check->page_order) { mysql_query("UPDATE winning_numbers SET page_order=page_order-1 WHERE Id='".$moveObj->Id."'") or die(mysql_error()); mysql_query("UPDATE winning_numbers SET page_order=page_order+1 WHERE Id='".$posObj->Id."'") or die(mysql_error()); } }else if (isset($_GET['down'])) { // Selected line $posQuery = "SELECT Id, page_order FROM winning_numbers WHERE page_order = '".$_GET['order']."'"; $posResult = mysql_query($posQuery) or die(mysql_error()); $posObj = mysql_fetch_object($posResult); // Position above selected line $moveQuery = "SELECT Id, page_order FROM winning_numbers WHERE page_order = ".$posObj->page_order."-1"; $moveResult = mysql_query($moveQuery) or die(mysql_error()); $moveObj = mysql_fetch_object($moveResult); $checkPos = mysql_query("SELECT page_order FROM winning_numbers ORDER BY page_order DESC LIMIT 1") or die(mysql_error()); $check = mysql_fetch_object($checkPos); if($posObj->page_order != $check->page_order) { mysql_query("UPDATE winning_numbers SET page_order=page_order+1 WHERE Id='".$moveObj->Id."'") or die(mysql_error()); mysql_query("UPDATE winning_numbers SET page_order=page_order-1 WHERE Id='".$posObj->Id."'") or die(mysql_error()); }
  5. I want to be able to move one record up or down in the order.
  6. I need some help with the above page. I cannot figure out the code to move the lines up and down with the arrow keys. The back end is MySQL here is an example Table name winning_numbers Id | date | day | numbers | bonus | page_order 1 | 01feb01 | Wed | 02 34 04 05 06 | 49 | 2 2 | 01feb01 | Wed | 02 34 04 05 06 | 49 | 1 3 | 01feb01 | Wed | 02 34 04 05 06 | 49 | 3 I have links on each image up and sown up link ?do=up&order='.$wn1[page_order].' down link ?do=down&order='.$wn1[page_order].' the PHP at the top of the page if ($_GET['do'] == 'up') { HERE IS THE MAGIC }else if ($_GET['do'] == 'down') { MORE MAGIC } thanks a bonus code might include deleting the line with the delete icon Thanks Again
  7. No one done any work with a mainframe?? Too bad Thanks Anyway
  8. Has anyone had any experience connecting PHP and the IBM mainframe z/OS I am trying to figure out how to get data to and from the OS. I see there is a PHP extension but I have no idea where to start with this. http://pecl.php.net/package-changelog.php?package=IMS I need to use IMS connector to connect to the mainframe. So basically I need PHP and IMS connector to connect. A simple example using this extension or another way to make this connection would get me in the right direction What I am trying to do is have a simple form to validate people against the mainframe data. I will have a form with one field in it ‘name’ and submit. The mainframe will return valid or not valid Any idea how to make this work in PHP ???????
  9. I am trying to add a txt file to a mysql database. Is there any one that can help? Here are the details TEST.TXT contains the following A00120091001999999990000020000000000000000000000000000000000000000000000000 A00220091001999999990000061000000000000000000000000000000000000000000000000 A00320091001999999990000068750000000000000000000000000000000000000000000000 A00420091001999999990000033500000000000000000000000000000000000000000000000 A00520091001999999990000062650000000000000000000000000000000000000000000000 A00620070401999999990000042350000000000000000000000000000000000000000000000 A00720091001999999990000032350000000000000000000000000000000000000000000000 A00820070401999999990000010250000000000000000000000000000000000000000000000 And so on up to 200 rows long I need to split each row the same way and add them to a table I will use the first row as an example Character 1 to 4 (A001) entered into a field called name Character 5 to 12 (20091001) entered into a field called efdate Character 13 to 20 (99999999) entered into a field called exdate Character 21 to 31 (00000200000) entered into a field called prfee Character 32 to 42 (00000000000) entered into a field called assfee Character 43 to 53(00000000000) entered into a field called spfee Character 54 to 64 (00000000000) entered into a field called anfee Character 65 to 75 (00000000000) entered into a field called nanfee Thanks in advance for the help
  10. Works good except when the value is 0. it replaces the 0 with . Any way around this Thanks for the quick responce
  11. I have the following code that works great except when the variable is blank. I need to replace any blank varibles with Is there a Guru that can help $game_results = file("include/game_results.csv"); foreach ($game_results as $game_result) { list($date, $h_a, $w_l_t, $us, $them, $vs_team) = explode(",", $game_result); echo "<tr><td align='center'>$date</td> <td align='center'>$h_a</td> <td align='center'>$w_l_t</td> <td align='center'>$us</td> <td align='center'>$them</td> <td align='center'>$vs_team</td> </tr>"; }
  12. I have a field in mysql named PAYMENT as follows PAYMENT 25 15 10 10 10 25 25 25 15 I need to count how many of each payment types there are and add them up EG output would be 3 people paid $10 for a total of $30 2 people paid $15 for a total of $30 4 people paid $25 for a total of $100 The total revenue for the show is $160 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.