Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 58

Thread: IF / THEN statement using data from MySQL

  1. #41
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi Folks,

    In trying the options presented I have created three examples that differ slightly from one another.

    Howver if I change the value of say 80 to 100 or 80 to 10, no change occurs which means that the counting portion is not working.

    Advice here would be welcome

  2. #42
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Works for me without a DB, must be a problem with your db query.

    To test it load your page with ?v=10 then ?v=1

    PHP Code:
    <tr class="alt2">
    <td>GLENDOWER</td>
    <td>27 FEBRUARY 2011</td>
    <td>?</td>
    <?php
    // name of tournament you wish to count entries from
    // maybe from a form entry?

    //$tournament = 'GLENDOWER - 27/02/2011';

    //  count the total entries with that tournament name

    //$c = mysql_query ("SELECT count(*) from `_Form_Nr_4` WHERE `I_wish_to_play` = '$tournament'");

    // add these two lines here:

    //$c = mysql_fetch_row($c);
    //$c = $c[0];
    $c $_GET['v'];
    // these lines take the result (a mysql resource)
    // and turn it into an array - something we can actually use
    // in php. The entry count is in the first index ( index 0 ). 
    $openORclosed $c >= 10 'Closed' 'Open';
    echo 
    "<td>";
    if (
    $openORclosed != 'Closed') {
    ?>
    <form action="https://www.payfast.co.za/eng/process" method="post"> 
    <input type="hidden" name="cmd" value="_paynow"> 
    <input type="hidden" name="receiver" value="junior@hayesgolf.co.za"> 
    <input type="hidden" name="item_name" value="Payment - Glendower - Glacier Series"> 
    <input type="hidden" name="item_description" value="payment"> 
    <input type="hidden" name="amount" value="120.00"> 
    <input type="hidden" name="return_url" value="http://www.gnjgf.co.za/entryform.php"> 
    <input type="hidden" name="cancel_url" value="http://www.gnjgf.co.za/Glacier_Main.html"> 
    <input type="submit" style="width:66px;height:20px;background-color:#B5CCE4;font-size:10px; font-family: arial, sans-serif;" value="PAY NOW">
    <?php 
    } else {
    echo 
    $openORclosed;
    }
    ?>
    </td>
    </tr>
    Corrections to my coding/thoughts welcome.

  3. #43
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Thanks for your reply.

    Am I correct in understanding then that I must substitute 'v' with 10 or 'v' with 1 to do the test?

    Regards
    Rob

  4. #44
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    No, v is the get request so...

    Load This should display the form. Then load This should display closed.
    Corrections to my coding/thoughts welcome.

  5. #45
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Cant seem to log into your two pages ( ERROR 404 )and view what you have tried to show

    Regards
    Rob
    Last edited by Rob (SA); 11-20-2010 at 05:35 PM.

  6. #46
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    those are example URLs, not actual links. He's demonstrating the ?get=variable syntax ( ?v=10 )

  7. #47
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi Folks,

    Thanks very much for the rplys.

    I have tried the inclusion as requested - no change

    Regards
    Rob

  8. #48
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I don't know what you mean by no change, can you be more specific. It shows closed for both, it shows the form for both, the page is blank, it shows the form and open? Please tell us what you are doing, what the response is, and what the response should be.
    Corrections to my coding/thoughts welcome.

  9. #49
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    The changes I refer to are what I would expect to see following the inclussion of the additional scripts.

    In veiwing a test page the status of the page remians the same in terms of OPEN / CLOSED which to me indicates that the information is not being retrieved from MySQL. (This is my veiw and could be wrong)

    The response as the entries happen is that the number of entires increase, thus the number changes until the ideal number of 80 is achieved. For this trial I have redueced the number to ten or one inrder for the open / closed status to be effected sooner.

    If the status is closed the "PAY NOW" button should not appear in the enter column.

    It should only appear when the "OPEN" status is in effect.

    I hope this helps in answering your questions.

    I would also like to say thanks for enduring in finding a solution.

    Regards
    Rob

  10. #50
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I see open, open blue, and closed how are these being set? The open blue are the only ones with the pay now button, correct?
    Corrections to my coding/thoughts welcome.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •