Help? Credit system script
Started on the old forum in August 2012 · view the original in the archive · old links redirect here
by credits,you think of? Phone bill, credit from user profile, .... Or what?
$("#mfreak").find(".head brain").clone();
Progress:
[|||___________________________] : 5%
Output:
Memory limit reached, unable to complete operation.
Support answer:
Try using a super uber strong mega computer to reach at least 10%.
👋
Busary wrote: 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 ?
$XTREME$ wrote: 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
Credit Deducting Code
Busary wrote: 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:
$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 !
$XTREME$ wrote: How Much of credit wanner be deduct ? I ll share you the code now ?
Added after 13 minutes:
$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
or just use one database query to increase performance.
$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.
$("#mfreak").find(".head brain").clone();
Progress:
[|||___________________________] : 5%
Output:
Memory limit reached, unable to complete operation.
Support answer:
Try using a super uber strong mega computer to reach at least 10%.
👋
mFreak wrote: or just use one database query to increase performance.
$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
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.
Rksk wrote: 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
Busary wrote: Thanks! How can my users view their remaining credit
just query the database for remaing credits sql:
SELECT credit FROM table_name WHERE username = ?
where ? Is username of user whose credit you want to fetch.
$("#mfreak").find(".head brain").clone();
Progress:
[|||___________________________] : 5%
Output:
Memory limit reached, unable to complete operation.
Support answer:
Try using a super uber strong mega computer to reach at least 10%.
👋
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....
I'm Proud to be a Sri Lankan!
nimeshka wrote: 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
well,
in the page where user submits the form (to send the msg), you can add the sql query to subtract the credits.
// 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
I'm Proud to be a Sri Lankan!