View Full Version : Lottery problems :/
KaiSan
04-23-2005, 09:45 AM
Hey everyone! ^_^
When i set the lottery for the next day (or ever for that matter) it is enever drawn :/
and when i go to pick a winner i get this message:
Could not find phrase 'rpg_lottery_ticket_error'.
>___<
Help please!
Revan
04-23-2005, 10:25 PM
That means there's no tickets to draw from, and hence the lottery is never drawn.
neo88
04-24-2005, 04:19 PM
im also having this error, but i sold 21 tickets & im getting the exact error as Kaisan. Anyway of resolving this?
Revan
04-25-2005, 09:06 AM
Try the following:
// lotteryadmin.php, find:
$tickets = $DB_site->num_rows($ticketfetch);
if ($tickets == 0)
{
define('CP_REDIRECT', 'lotteryadmin.php?do=edit');
print_stop_message('rpg_lottery_ticket_error');
}
// move to AFTER the following
$lotteryinfo = $DB_site->fetch_array($ticketfetch);
// Replace:
$tickets = $DB_site->num_rows($ticketfetch);
// With:
$tickets = count($lotteryinfo);
If this works, I'll release it as an official fix (and also patch the mistake of forgetting to add that phrase to the XML file).
neo88
04-25-2005, 03:24 PM
That code didnt work. & add what phrase to the xml file...?
Revan
04-25-2005, 03:48 PM
rpg_lottery_ticket_error should have a text :P
And I'll look better into it in abit then.
balls. I see the mistake. Instead of count($tickets), count($lotteryinfo). Try that
asianboi
04-30-2005, 03:39 PM
arhhhh are you saying
// lotteryadmin.php, find:
$tickets = $DB_site->num_rows($ticketfetch);
if ($tickets == 0)
{
define('CP_REDIRECT', 'lotteryadmin.php?do=edit');
print_stop_message('rpg_lottery_ticket_error');
}
// Replace:
$tickets = $DB_site->num_rows($ticketfetch);
// With:
$tickets = count($lotteryinfo);
because when i move after
// move to AFTER the following
$lotteryinfo = $DB_site->fetch_array($ticketfetch);
I do not see
$tickets = $DB_site->num_rows($ticketfetch);
and can you please tell us where exactuly to add the phrase so that it will work?
Revan
04-30-2005, 04:28 PM
The $tickets line does not disappear even if it's moved.
And add the phrase:
ACP -> Phrase Manager -> Add New Phrase.
Phrase Type: Control Panel Stop Message
Varname: rpg_lottery_ticket_error
Text: This lottery does not have any tickets to draw from.
asianboi
04-30-2005, 07:22 PM
Hi Revan
Thanks for helping us with the phrase
I clicked on the PICK WINNER and this is what I received
"This lottery does not have any tickets to draw from."
But i do have 9 people buying the lottery ticket.
my lotteryadmin.php is now
$tickets = $DB_site->num_rows($ticketfetch);
if ($tickets == 0)
{
define('CP_REDIRECT', 'lotteryadmin.php?do=edit');
print_stop_message('rpg_lottery_ticket_error');
}
// Replace:
$tickets = $DB_site->num_rows($ticketfetch);
// With:
$tickets = count($lotteryinfo);
Revan
04-30-2005, 11:31 PM
$ticketfetch = $DB_site->query("
SELECT
rpg_lottery_tickets.*,
rpg_lottery.*,
user.username,
user.userid
FROM
`" . TABLE_PREFIX . "rpg_lottery` AS `rpg_lottery`
LEFT JOIN `" . TABLE_PREFIX . "rpg_lottery_tickets` AS `rpg_lottery_tickets` ON(rpg_lottery_tickets.lotteryid = rpg_lottery.lotteryid)
LEFT JOIN `" . TABLE_PREFIX . "user` AS `user` ON(user.userid = rpg_lottery_tickets.userid)
WHERE rpg_lottery.lotteryid = '$lottery[lotteryid]'
ORDER BY RAND() LIMIT 1
");
$lotteryinfo = $DB_site->fetch_array($ticketfetch);
$tickets = count($lotteryinfo);
if ($tickets == 0)
{
define('CP_REDIRECT', 'lotteryadmin.php?do=edit');
print_stop_message('rpg_lottery_ticket_error');
}
thats the relevant section of code, which I have every reason to believe works.
asianboi
05-01-2005, 02:14 AM
thanks.. i'll see if that works
Ok I used the same exact code you provided above and this is what happens when I click on the PICK winner link
Database error in vBulletin 3.0.7:
Invalid SQL: UPDATE user SET uttpoints = uttpoints + WHERE userid=
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE userid=' at line 1
mysql error number: 1064
My current Lottery is:
Lottery Name Started Ending Pick
Cash 5 04-30-2005 05-01-2005 [Pick]
Revan
05-01-2005, 09:11 AM
// #########################
$sub = 'Lottery Winner!';
$message = "Hi, $lottery[username]
You've won '$lotteryinfo[lotteryname]' lottery!
$lottery[prize] $vboptions[rpg_currency] has been added to your pocket!";
// ##########################
process_rpg_pm($lotteryinfo['userid'], $lotteryinfo['username'], $bbuserinfo['userid'], $bbuserinfo['username'], $sub, $message);
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET $vboptions[rpg_pointfield] = $vboptions[rpg_pointfield] + $lotteryinfo[prize] WHERE userid=$lotteryinfo[userid]");
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "rpg_lottery WHERE lotteryid = '$lotteryinfo[lotteryid]'");
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "rpg_lottery_tickets WHERE lotteryid = '$lotteryinfo[lotteryid]'");
Try using this code instead of the similar to above existing code then.
asianboi
05-01-2005, 01:00 PM
I still get the same error. It is either I understand you incorrectly. Please be specific, because I'm not a coder like you
$ticketfetch = $DB_site->query("
SELECT
rpg_lottery_tickets.*,
rpg_lottery.*,
user.username,
user.userid
FROM
`" . TABLE_PREFIX . "rpg_lottery` AS `rpg_lottery`
LEFT JOIN `" . TABLE_PREFIX . "rpg_lottery_tickets` AS `rpg_lottery_tickets` ON(rpg_lottery_tickets.lotteryid = rpg_lottery.lotteryid)
LEFT JOIN `" . TABLE_PREFIX . "user` AS `user` ON(user.userid = rpg_lottery_tickets.userid)
WHERE rpg_lottery.lotteryid = '$lottery[lotteryid]'
ORDER BY RAND() LIMIT 1
");
$lotteryinfo = $DB_site->fetch_array($ticketfetch);
$tickets = count($lotteryinfo);
if ($tickets == 0)
{
define('CP_REDIRECT', 'lotteryadmin.php?do=edit');
print_stop_message('rpg_lottery_ticket_error');
}
// #########################
$sub = 'Lottery Winner!';
$message = "Hi, $lottery[username]
You've won '$lotteryinfo[lotteryname]' lottery!
$lottery[prize] $vboptions[rpg_currency] has been added to your pocket!";
// ##########################
process_rpg_pm($lotteryinfo['userid'], $lotteryinfo['username'], $bbuserinfo['userid'], $bbuserinfo['username'], $sub, $message);
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET $vboptions[rpg_pointfield] = $vboptions[rpg_pointfield] + $lotteryinfo[prize] WHERE userid=$lotteryinfo[userid]");
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "rpg_lottery WHERE lotteryid = '$lotteryinfo[lotteryid]'");
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "rpg_lottery_tickets WHERE lotteryid = '$lotteryinfo[lotteryid]'");
Revan
05-01-2005, 07:35 PM
Argh, Ill have to run some tests on localhost as this goes beyond what I can troubleshoot without actually touching the files.
I'll have a fix ready tomorrow :)
asianboi
05-01-2005, 10:25 PM
Thank you sir! Hope to hear some good news from you =)
asianboi
05-04-2005, 04:07 PM
Argh, Ill have to run some tests on localhost as this goes beyond what I can troubleshoot without actually touching the files.
I'll have a fix ready tomorrow :)
I know you're busy, just wanting to let you know this problem has not been solved.
Revan
05-05-2005, 10:06 AM
It has been solved in the latest update. I sent out an email, and made an entry in the changelog.
If you still recieve the error, try redloading, reuploading the changed files, and post any errors you're still recieving.
asianboi
05-05-2005, 02:55 PM
thanks..works great! Thumb up!
asianboi
05-08-2005, 01:39 AM
is there a way to limit the lottery purchase? Seeems to me that the more lottery tickets a member buy.. the higher chance he/she would win
Revan
05-09-2005, 07:00 AM
No, theres currently no way of limiting the purchases per lottery.
I will add this to the next version though.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.