Jump to content

Canman2005

Members
  • Posts

    669
  • Joined

  • Last visited

    Never

Posts posted by Canman2005

  1. Thank you very much

     

    What would be the best way to grab the following from the external HTML

     

    <table id="Table1" cellspacing="1" cellpadding="1" border="1">
      <tr>
        <td height="18" colspan="2"><a id="_ctl5_DesktopThreePanes1_ThreePanes__ctl6_LbShoppingCart" href="javascript:__doPostBack('_ctl5$DesktopThreePanes1$ThreePanes$_ctl6$LbShoppingCart','')" style="font-size:X-Small;font-weight:bold;"> View Cart</a> </td>
      </tr>
      <tr>
        <td height="18"><span id="_ctl5_DesktopThreePanes1_ThreePanes__ctl6_Label3" style="font-size:XX-Small;">Line Items</span></td>
        <td height="18"><span id="_ctl5_DesktopThreePanes1_ThreePanes__ctl6_LblTotalLineItems" style="font-size:XX-Small;">0</span></td>
      </tr>
      <tr> </tr>
      <tr>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td><span id="_ctl5_DesktopThreePanes1_ThreePanes__ctl6_Label1" style="font-size:XX-Small;width:56px;">SubTotal</span></td>
        <td><span id="_ctl5_DesktopThreePanes1_ThreePanes__ctl6_LblSubTotal" style="font-size:XX-Small;">$Zero</span></td>
      </tr>
    </table>
    

  2. Hi all

     

    I have the following code

     

    if ($source = file_get_contents("http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm")) {
      $search = "<h1>Example of a simple HTML page</h1>";
      $newText = substr($source,strpos($source, $search)+strlen($search), 100);
      echo $newText;
    } else {
    print "error";
    }

     

    This grabs the first 100 characters of the HTML code from an external source starting from the defined section of code.

     

    Rather than grabbing the first 100 characters, is there a way to define an end tag? So it would grab everything from the start and end tags?

     

    Does that make much sense?

     

    Thanks very much

     

    Dave

  3. Hi all

     

    I have the following QUERY

     

    $sql = "SELECT * FROM content ORDER BY id ASC";
    $show = @mysql_query($sql,$connection) or die(mysql_error());
    while ($row = mysql_fetch_array($show))
    {
    print $row['id'].'<br>';
    }

     

    Is it possible to grab the ID of the first row in the table and the last row in the table?

     

    Thanks

  4. So it could look like

     

    SET checked='0'

    SET checked='1'

    SET checked='0'

    SET checked='0'

    SET checked='0'

     

    SET checked='0'

    SET checked='0'

    SET checked='0'

    SET checked='0'

    SET checked='1'

     

    SET checked='1'

    SET checked='0'

    SET checked='0'

    SET checked='0'

    SET checked='0'

     

  5. That works cool, but it always does

     

    SET checked='1'

     

    on the 5th row inserted.

     

    I'm trying to get it to add it randomly to one of each block of 5 rows that are inserted.

     

    So it might do

     

    SET checked='1'

     

    on the 2nd row inserted or it might do it on the 4th row

     

    but im trying to keep to blocks of 5

  6. Hi all

     

    Wondering if you can help;

     

    I have a simple table called `mydata`, it has the following fields

     

    `id`

    `checked`

    `date`

     

    I have the following INSERT script

     

    INSERT INTO `mydata` SET `checked`='1', `date`=date('Y-m-d')

     

    What I want to do is for every 5 rows of data INSERTED into my table, 1 of those 5 rows INSERTED to have the field `checked` set to 1 and the other 4 rows set to 0.

     

    A history of INSERTS might look like

     

    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='1', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')

     

    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='1', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')

     

    INSERT INTO `mydata` SET `checked`='1', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')
    INSERT INTO `mydata` SET `checked`='0', `date`=date('Y-m-d')

     

    As you can see, the INSERTS are split into 5's, because I want 1 out of every 5 rows INSERTED to have its value of the field `checked` to be set to 1, the other 4 rows should have the value set to 0.

     

    This should be a random thing, so it might set the `checked` value of the first row INSERTED to 1 or it might set the last row INSERTED to 1.

     

    Does that make much sense?

     

    Thanks

     

    Dave

  7. Hello

     

    We're in need of a freelance coder, you must be able to work for the next week on a project.

     

    We need someone who charges less than 50-60 euro a day and is fast at coding.

     

    We pay on 30 days of the job being complete, so after the job is complete and you have invoiced us, we pay within 30 days of getting the invoice.

     

    We will have lots more work for the person we find.

     

    Email me please

     

    mark.stuart@intelligentbean.com

     

    Thanks

  8. Hi all

     

    I have a database field called `date` this stores a datestamp in the following format

     

    YYYY-MM-DD

     

    I have a PHP page which I run everyday, I want to print the word

     

    "process"

     

    If it has been 3 weeks since the value of the field `date`.

     

    So for example, if my `date` value was 2009-02-01, and I loaded the page and it was 3 weeks since that date, it would print "process", if it was 6 weeks since that date it would print "process" and if it was 9 weeks since that date, it would print "process".

     

    So as you can see, im trying to figure out 3 week blocks since the `date` value

     

    Does that make sense? Can anyone help?

     

    Thanks in advance

     

    Ed

  9. Let me try and give an example of what I want to do next

     

    Say todays day was a Thursday and in the `orders` table we had a row which looked like

     

    id    startdate

    2    2009-01-01

     

    So as you can see, the `startdate` is set to '2009-01-01' which is a Thursday, then every Thursday it should return this row.

     

    Now say the assocated rows returned from the `items` table are the following;

     

    id    orderid    repeat

    32    2          1

    33    2          2

    34    2          2

    35    2          3

    36    2          4

    37    2          4

     

    So on the '2009-01-01' it would return all of the above, but then a week later on the '2009-01-07' it would just return rows which have a repeat value of 1 (because value 1 means return every week)

     

    Every 2 weeks since the `startdate` is would return rows with a `repeat` value of 1 and 2 (because 1 is every week and 2 is every 2 weeks)

     

    Then a week later it would return rows with a `repeat` value of 1 and 3 (because 1 is every week and 3 is every 3 weeks)

     

    Then a week later it would return rows with a repeat value of 1,2 and 4 (because 1 is every week, 2 is every 2 weeks and 4 is every 4 weeks)

     

    so depending on what repeat value is stored, that is when that row should be returned.

     

    Just to mention, on the 3rd week (or 6th week, or 9th week ....) from the `startdate`, it would return rows with a `repeat` value of 1,2 and 3 (simply because 1 is every week, 2 is every 2 weeks and 3 is every 3 weeks)

     

    As mentioned before

     

    1 = repeat every week

    2 = repeat once every 2 weeks

    3 = repeat once every 3 weeks

    4 = repeat once every 4 week

     

    I know this is a bit of a mess, but hopefully it makes some kind of sense.

     

    Does anyone understand what I am trying to do?

  10. Hi all

     

    I have a code I need to write and wondering if anyone can help;

     

    Basically I have 2 tables, ill explain what they both are;

     

    --orders--

    id (auto id number)

    startdate (yyyy-mm-dd)

     

    --items--

    id (auto id number)

    orderid (id number from `orders` table)

    repeat (either set to 1,2,3 or 4)

     

    In the `items` table I have several rows and they each have a number under the field `repeat`, the numbers mean the following;

     

    1 = repeat every week

    2 = repeat once every 2 weeks

    3 = repeat once every 3 weeks

    4 = repeat once every 4 week

     

    So what I want to do is grab all rows from the `orders` table which have a start date equal to or later than todays date.

     

    Lets say today was a Tuesday, it would only return rows that the `startdate` is also a Tuesday, so for example it would grab a row if it has a startdate of 2009-01-20 (which is a Tuesday) but would not grab a row which had a `startdate` of 2009-01-21 (which is a Wednesday).

     

    Then what I need to do is look in the `items` table and grab all the rows with the linked `orderid`.

     

    I want to add some more but didnt want to overflow this message with information.

     

    Does what im trying to do make sense so far?

     

    Thanks

     

    Ed

  11. Hi all

     

    I have a very simple QUERY which gets a list of products, the list is very long though, about 500 products.

     

    I'm trying to convert it to a PDF file and have tried tons of free PDF converters, my porblem is that when I try and convert this products list I keep getting

     

    Fatal error: Allowed memory size

     

    What can I do to try and fix this and also what is a safe MB limit to use?

×
×
  • 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.