Help? Credit system script

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

  • Busary
    replied
    i would like t0 create the table first,any idea how,pls reply!

    Leave a comment:


  • nimeshka
    replied
    well,

    in the page where user submits the form (to send the msg), you can add the sql query to subtract the credits.

    PHP Code:
    // do the stuff for sending the msg....say it is sent by a function sendmsg();

    $result = sendmsg();

    if(
    $result){

    /////dEduct credits, if msg sent sucessfully

    mysql_query(UPDATE users SET credits=credits-5 WHERE username='".$username."');

    echo 
    "Message sent successfully";
    }else{

    echo 
    "Cannot send the msg";
    } 
    once again....this is only a rough idea how to do it...as I have I no idea of how your script works.

    hope this helps you. thanks

    Leave a comment:


  • Busary
    replied
    Originally posted by nimeshka View Post
    hello bro....I think first you should have a look on your script.

    we could show you so many ways to do it..but if u do not know what is happening there in the script, u are not going to catch how to use these....
    Thanks,i have gotten it all

    Leave a comment:


  • nimeshka
    replied
    hello bro....I think first you should have a look on your script.

    we could show you so many ways to do it..but if u do not know what is happening there in the script, u are not going to catch how to use these....

    Leave a comment:


  • mFreak
    replied
    Originally posted by Busary View Post
    Thanks! How can my users view their remaining credit
    just query the database for remaing credits sql:
    Code:
    SELECT credit FROM table_name WHERE username = ?
    where ? Is username of user whose credit you want to fetch.

    Leave a comment:


  • Busary
    replied
    Originally posted by Rksk View Post
    I think 1st you have to learn php and go to coding. U don't want to go to classes, just visit W3Schools Online Web Tutorials and read their php articles carefull.
    Also u have to study some simple php scripts like lavalair to learn how to use php n mysql.

    Else u wont understand those codes.
    I already learn php,but its just that i just dont understand them all,because they just look more complex as i learn,i think may be its just because am new,i know with time i would understand them all,please just keep Explaining..THANKS

    Leave a comment:


  • Rksk
    replied
    I think 1st you have to learn php and go to coding. U don't want to go to classes, just visit W3Schools Online Web Tutorials and read their php articles carefull.
    Also u have to study some simple php scripts like lavalair to learn how to use php n mysql.

    Else u wont understand those codes.

    Leave a comment:


  • Busary
    replied
    Originally posted by mFreak View Post
    or just use one database query to increase performance.

    PHP Code:
    $result = mysql_ query("UPDATE Table_ Name SET credit=credit-'".$credit_to_deduct."' WHERE username='".$user."'"); 
    $result should be true on success

    if yot want it to go a little faster use user id instead of username.

    Added after 5 minutes:

    you must put this code in script where, message is going to be sent. After you get confirmation that message is sent, you run the query.
    Thanks! How can my users view their remaining credit

    Leave a comment:


  • mFreak
    replied
    or just use one database query to increase performance.

    PHP Code:
    $result = mysql_ query("UPDATE Table_ Name SET credit=credit-'".$credit_to_deduct."' WHERE username='".$user."'"); 
    $result should be true on success

    if yot want it to go a little faster use user id instead of username.

    Added after 5 minutes:

    you must put this code in script where, message is going to be sent. After you get confirmation that message is sent, you run the query.
    Last edited by mFreak; 04.08.12, 08:06.

    Leave a comment:


  • Busary
    replied
    Originally posted by $XTREME$ View Post
    How Much of credit wanner be deduct ? I ll share you the code now ?

    Added after 13 minutes:

    PHP Code:



    $DEDUCT_CREDITS 
    = 2 ;



    $CR_XTREME = mysql_fetch_array(mysql_query("SELECT credit FROM Table_Name WHERE username='".$username."'"));
      
    $CR_XTREME = $CR_XTREME[0] - $DEDUCT_CREDITS;
      

         
    $SUCCESS = mysql_query("UPDATE Table_Name SET credit='".$CR_XTREME."' WHERE username='".$username."'");
      

    if(
    $SUCCESS)

    {

    echo 
    "Message Sent Successfully <br/>";

    } 










    Try This Code , It LL Work !
    THANK YOU VERY MUCH!
    Please where can i input this script,is it where i put d FORM TAG(where i send message)?
    Am sorry am New in php

    Please one more question-how can my users view the credit they have,Thanks for understanding

    Leave a comment:


  • $XTREME$
    replied
    Credit Deducting Code

    Originally posted by Busary View Post
    Yes exactly,anytime a message is sent some amount is removed from user credit,thanks for understanding
    How Much of credit wanner be deduct ? I ll share you the code now ?

    Added after 13 minutes:

    PHP Code:



    $DEDUCT_CREDITS 
    = 2 ;



    $CR_XTREME = mysql_fetch_array(mysql_query("SELECT credit FROM Table_Name WHERE username='".$username."'"));
      
    $CR_XTREME = $CR_XTREME[0] - $DEDUCT_CREDITS;
      

         
    $SUCCESS = mysql_query("UPDATE Table_Name SET credit='".$CR_XTREME."' WHERE username='".$username."'");
      

    if(
    $SUCCESS)

    {

    echo 
    "Message Sent Successfully <br/>";

    } 










    Try This Code , It LL Work !
    Last edited by $XTREME$; 04.08.12, 06:29.

    Leave a comment:


  • Busary
    replied
    Originally posted by $XTREME$ View Post
    ho , do you wanner create a site credit system ? And it must deduct when the message sent ?am correct ?
    Yes exactly,anytime a message is sent some amount is removed from user credit,thanks for understanding

    Leave a comment:


  • $XTREME$
    replied
    Originally posted by Busary View Post
    Please can someone give me a script that deals with credits,if you visit an exact page,it deducts a certain amount,i would be glad to get d script..THANKX

    Added after 2 minutes:

    i actually want to use it in a sms site,please great webmasters
    ho , do you wanner create a site credit system ? And it must deduct when the message sent ?am correct ?

    Leave a comment:


  • mFreak
    replied
    by credits,you think of? Phone bill, credit from user profile, .... Or what?

    Leave a comment:


  • Busary
    started a topic Help? Credit system script

    Help? Credit system script

    Please can someone give me a script that deals with credits,if you visit an exact page,it deducts a certain amount,i would be glad to get d script..THANKX

    Added after 2 minutes:

    i actually want to use it in a sms site,please great webmasters
    Last edited by Busary; 03.08.12, 20:03.
Working...
X