my project for school. was supposed to allow users to pick #s, make sure they cant pick # twice for white ball. quick play is a random play of #s, "draw" draws the winning #'s when not quick played(quick play and draw both draw random winning #'s that are compared to see prize $. please help its confusing :/. parse error line 13 which is "for ($i = 0; $i ! 6; $i++){" i just dont see where that could be... probably more errors than just that...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/199/xhtml">
<head>
<title>MEGA MILLIONS</title>
</head>
<h1>WIN SOME CASH!</h1>
<body>
<?php
function draw(){
for ($i = 0; $i ! 6; $i++){
switch ($i) {
case 0:
echo "<img src=\http://131.118.95.215/users/teschlauch0/Projects/White/\$array[0].jpg\" alt=\"1\"/>";
break;
case 1:
echo "<img src=\http://131.118.95.215/users/teschlauch0/Projects/White/\$array[1].jpg\" alt=\"2\"/>";
break;
case 2:
echo "<img src=\http://131.118.95.215/users/teschlauch0/Projects/White/\$array[2].jpg\" alt=\"3\"/>";
break;
case 3:
echo "<img src=\http://131.118.95.215/users/teschlauch0/Projects/White/\$array[3].jpg\" alt=\"4\"/>";
break;
case 4:
echo "<img src=\http://131.118.95.215/users/teschlauch0/Projects/White/\$array[4].jpg\" alt=\"5\"/>";
If you post your code here within [php]...[/php] bbcode tags, it will be much easier for us to read.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
! is not a PHP operator. (I suspect you meant != ?)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
! is not a PHP operator. (I suspect you meant != ?)
PS: The "!" character is a logical operator, but it's not a comparison operator.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Nog did you really just reply to yourself? that's great.
Yeah, no moderator powers here, and I couldn't edit my post by the time I realized I sort of misspoke.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
now i just got parse errors for all the prize winnings at the end i am not sure how to use the index to count the amount of white balls. hopefully i'll figure it out
One hint (or 2): "=" (assignment operator) is very different than "==" (comparison operator). Also, "&" (bitwise 'and' operator) is different than the "&&" (logical "and" operator). The first two ("=" and "==") trip up even experienced coders from time to time with difficult to find bugs.
Also, you might find it easier to get the number of matches by putting the user's selections into one array, and the numbers drawn into another array, then use array_intersect() to get an array of matching numbers, which you can the process with count() to get the number of matches, e.g.:
Then you would not have to mess around with those convoluted if() statements.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks