Help? Credit system script
Collapse
X
-
well,
in the page where user submits the form (to send the msg), you can add the sql query to subtract the credits.
once again....this is only a rough idea how to do it...as I have I no idea of how your script works.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";
}
hope this helps you. thanks
Leave a comment:
-
Thanks,i have gotten it allOriginally posted by nimeshka View Posthello 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:
-
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:
-
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..THANKSOriginally posted by Rksk View PostI 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:
-
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:
-
Thanks! How can my users view their remaining creditOriginally posted by mFreak View Postor just use one database query to increase performance.
$result should be true on successPHP Code:$result = mysql_ query("UPDATE Table_ Name SET credit=credit-'".$credit_to_deduct."' WHERE username='".$user."'");
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.
Leave a comment:
-
or just use one database query to increase performance.
$result should be true on successPHP Code:$result = mysql_ query("UPDATE Table_ Name SET credit=credit-'".$credit_to_deduct."' WHERE username='".$user."'");
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:
-
THANK YOU VERY MUCH!Originally posted by $XTREME$ View PostHow 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 !
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:
-
Credit Deducting Code
How Much of credit wanner be deduct ? I ll share you the code now ?Originally posted by Busary View PostYes exactly,anytime a message is sent some amount is removed from user credit,thanks for understanding
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:
-
ho , do you wanner create a site credit system ? And it must deduct when the message sent ?am correct ?Originally posted by Busary View PostPlease 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
Leave a comment:
-
by credits,you think of? Phone bill, credit from user profile, .... Or what?
Leave a comment:
-
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 webmastersLast edited by Busary; 03.08.12, 20:03.Tags: None
Leave a comment: