Announcement

Collapse
No announcement yet.

If then script using information from MySQL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • If then script using information from MySQL

    Hi folks,

    I am in urgent help.

    I have data of members in a MySQL database which is populated from a form.

    What I would like is an if /then script that once the toatl members =80 then a note will appear "yes" or "no"

    Thus informing them that they can continue with thier process or not.

    Much like a shopping cart I guess that would say stock is avaialbe or not when selecting an item

    I hope someone can help
    Kind Regards
    Rob
    www.gnjgf.co.za
    www.oryan-projects.com

  • #2
    Re: If then script using information from MySQL

    You need something like:

    $query = "SELECT * form tablename WHERE ......your where clasue";
    $result = mysql_query($query, $db);
    $num_rows = mysql_num_rows($result);
    if($num_rows >= 80){
    //Code to be executed if more than 80;
    }
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment


    • #3
      Re: If then script using information from MySQL

      Hi George,

      Thanks for the reply.

      Whist the information from the tournament happens on one page - is it possible then to include this on another page

      If this be the case do I insert the formula one on th elater page or do it for each row that is shown?

      Thanks again for your help
      Kind Regards
      Rob
      www.gnjgf.co.za
      www.oryan-projects.com

      Comment


      • #4
        Re: If then script using information from MySQL

        You should include this in the Start of Page of the initial page they need to fill in.
        So if the 80 positions are already covered, it will not even allow them to start, and will display a "Sorry, tournament Closed" or similar message.
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment


        • #5
          Re: If then script using information from MySQL

          Hi George,

          Thats exactly what I am looking to do - but at the same time they can se the entry status is OPEN / CLOSED.

          I would like the CLOSED to show as RED text.

          If at all possible when the entry status is "CLOSED" and the "PAY NOW" button selected it will show a pop up note - "Sorry entries for this event are closed".

          That should all happen on this page
          Kind Regards
          Rob
          www.gnjgf.co.za
          www.oryan-projects.com

          Comment


          • #6
            Re: If then script using information from MySQL

            Rob,

            what I provided is the code that you need to use in order to see how many players have already payed for a tournament. It is obvious that the "where" clause must be customized by you to retrieve this info for each tournament.

            Once you have the number of players and the number of allowed players for all tournaments (if different per tournament, otherwise 80 for all), you simply add the if...then statement in your "echo"... code so it will display (or will NOT display) whatever you want.

            In example instead of OPEN/CLOSED it will display OPEN or CLOSED (depending on IF ($num_rows >= 80)...) and will NOT display the Pay Now button. So no need for popup.
            Navaldesign
            Logger Lite: Low Cost, Customizable, multifeatured Login script
            Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
            DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
            Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

            Comment


            • #7
              Re: If then script using information from MySQL

              Hi George,

              I have managed to get a page to show how many players are in each tournament but seems to always add one less than there actually are.

              The code that you have presented I am sure wil work but it is understanding where I would place such code on this page as I dont have any echo statements.

              The last proposal is perfect.

              That is if the tournament reflects OPEN then the PAY NOW button will be visible. Alternatively if the status is CLOSED then the PAY NOW button should not show.

              Can you help me sort this please?
              Kind Regards
              Rob
              www.gnjgf.co.za
              www.oryan-projects.com

              Comment


              • #8
                Re: If then script using information from MySQL

                Here is an example of what I have.

                I dont mind doing the entry of script as long as I could see an example of where and how

                PHP Code:
                <tr class="alt">
                <
                td>HUMEWOOD</td>
                <
                td>18</td>
                <
                td>06 MARCH 2011</td>
                <
                td>?</td>
                <
                td>OPEN/CLOSED</td>
                <
                td><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 - Humewood - 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"
                </
                td>
                </
                tr>
                <
                tr class="alt2">
                <
                td>GARDENER ROSS</td>
                <
                td>18</td>
                <
                td>27 MARCH 2011</td>
                <
                td>?</td>
                <
                td>OPEN/CLOSED</td>
                <
                td><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 - Gardener Ross - 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"
                </
                td>
                </
                tr
                Kind Regards
                Rob
                www.gnjgf.co.za
                www.oryan-projects.com

                Comment


                • #9
                  Re: If then script using information from MySQL

                  Is this a static page ? not a dynamic one ?
                  Navaldesign
                  Logger Lite: Low Cost, Customizable, multifeatured Login script
                  Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                  DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                  Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                  Comment


                  • #10
                    Re: If then script using information from MySQL

                    <tr class="alt">
                    <td>HUMEWOOD</td>
                    <td>18</td>
                    <td>06 MARCH 2011</td>
                    <td>?</td>
                    <?php
                    if($num_rows >= 80){
                    echo '<td>CLOSED</td>
                    <td>&nbsp;</td>';
                    }
                    else {
                    echo '<td>OPEN</td>
                    <td><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 - Humewood - 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">
                    </td>
                    ';
                    }
                    ?>
                    </tr>
                    Navaldesign
                    Logger Lite: Low Cost, Customizable, multifeatured Login script
                    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                    Comment


                    • #11
                      Re: If then script using information from MySQL

                      Hi George,

                      This page is a static one - by this I understand that I have pepared the info as shown in the link below.

                      A bit laborious but I managed to get the page to work without having to know too much PHP.

                      Hence no echo statements.

                      The actual entry form which you helped me create would only appear after the "PAY NOW" or payment is made.

                      The page where the total entries per tournament are calculated is a dynamic one - that is the information is done by means of queries and the page populated with that information
                      Kind Regards
                      Rob
                      www.gnjgf.co.za
                      www.oryan-projects.com

                      Comment


                      • #12
                        Re: If then script using information from MySQL

                        Rob,

                        If you want to use a IF ... THEN statement, the page needs to be dynamic (PHP driven) even for this part only

                        So you need, for each row, to execute a query with the code I provided and the the necessary WHERE clause, to retrieve the number of players and then use the code example I provided above to echo the Status and the payment button.

                        Making this in a completely static page is out of the question (from me) as it would take me ages to build and update. Why should I, when all info is in the database, and the correct script can make decisions and display what needs be displayed ?
                        Navaldesign
                        Logger Lite: Low Cost, Customizable, multifeatured Login script
                        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                        Comment


                        • #13
                          Re: If then script using information from MySQL

                          HI George,

                          That portion of script works well.

                          I have tested the script in an OPENn staus which can now be seen.

                          Is it posssible that with this IF THENn opton working the PAY NOW button will show or not show?
                          Kind Regards
                          Rob
                          www.gnjgf.co.za
                          www.oryan-projects.com

                          Comment


                          • #14
                            Re: If then script using information from MySQL

                            Hi George,

                            Reading the script / insert you have presented I understand that the option of the button when closed will not show - Thanks that will really work.

                            Regarding the other option of doing everything in the static page - that I will do - I would benever expect you to do that.

                            What I was trying to request is an example of the query in order I can go make all these changes in the static page.

                            Your help so far is really going to help me
                            Kind Regards
                            Rob
                            www.gnjgf.co.za
                            www.oryan-projects.com

                            Comment


                            • #15
                              Re: If then script using information from MySQL

                              Originally posted by Rob (SA) View Post
                              HI George,

                              That portion of script works well.

                              I have tested the script in an OPENn staus which can now be seen.

                              Is it posssible that with this IF THENn opton working the PAY NOW button will show or not show?
                              Yes, the code I provided will show (depending on status) Open or Close and will or will not display the Pay Now button.
                              Navaldesign
                              Logger Lite: Low Cost, Customizable, multifeatured Login script
                              Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                              DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                              Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                              Comment

                              Working...
                              X