ryeman98
Members-
Posts
286 -
Joined
-
Last visited
Never
Everything posted by ryeman98
-
lol, thanks for the correction ... it's been a long night Remember to click Topic Solved!
-
Put that line in a string or if they're already variables just do: $variable = str_replace(",", 'to', $variable); Wow, that's it.
-
Sorry about that, I kinda ran off too quick. <?php if ($_GET['act'] == "choose") { echo "<form action='rps.php?act=result' method='post'>"; echo "<table align='center' width='10%' border='0'><tr><td align='left'>"; echo "<input type='image' name='choice' value='rock' src='../images/rock.gif'>"; echo "<input type='image' name='choice' value='paper' src='../images/paper.gif'>"; echo "<input type='image' name='choice' value='scissors' src='../images/scissors.gif'>"; echo "</td></tr></table>"; echo "</form>"; } elseif ($_GET['act'] == "result") { $_SESSION['pageview'] = $_SESSION['pageview']+1; if ($_SESSION['pageview'] > 1) { echo "<a href='/rules.php'>No cheating!</a>"; } else { $user_choice = $_POST['choice']; $comp = array("rock", "paper", "scissors"); $rand_comp = rand(0, 2); $comp_choice = $comp[$rand_comp]; echo "You chose: ". $user_choice ."<br />"; echo "Comp chose: ". $comp_choice ."<br /><br />"; ?> As you can see, in IE ONLY, $user_choice is NULL. In Any other browser, it has what the user submitted.
-
I know, I know, we all hate IE but I made a Rock, Paper, Scissors game and it works fine and dandy in FF but breaks down in IE. The problem, the users guess won't submit. Any suggestions?
-
Curse questioning your own programming!
-
Well ... that helps out a little but I got that far. I guess I'm just looking for some kind of function to set the dimension of an array. Well hang on, this is how it works: Say 5 was the prob number: within your for loop $numbers[$counter]; // Same as: $numbers['1']; $numbers[$counter]; // Same as: $numbers['2']; and so on ...
-
Maybe this helps because this is what I want: $numbers = array(Lowest, Highest); And that sets the array's dimension ... does that help?
-
Let's see the code between lines 20 and 30 then. Just because it'll be easier to see what's going on.
-
Ok, this is what my array looks like: $numbers = array(); And it's like that because I don't know how much info is going to be inserted.
-
where line 21 is if(mysql_num_rows($result){ You're missing a closing bracket: if(mysql_num_rows($result)){
-
Bumping because I'm a little short for time
-
Is there an error message when you're trying to download it?
-
I'll try as best as I can. I have an array but I don't know how big it'll be. I count the number of columns in the database and then select a random number. rand(1, $row['COUNT(id)']); Then from that, it selects the column of the random number. There is a column called probability. It calculates the chances of the thing being true out of 100. Then, whatever the probability number is, that is the size the array is going to be and another variable adds a random number to each array. Then, there is some other stuff but it isn't relevant.
-
So I've got this one script. I need to know, how can I make an array work when I'm unsure of the size and values of it? If you don't understand, I'll try to go more in-depth but it's tough.
-
[SOLVED] Just can't seem to figure it out ... (mysql error)
ryeman98 replied to ryeman98's topic in PHP Coding Help
Sorry for double posting but there are users waiting to get onto the site ... -
No, the value must be 1. I'd say just starting out simple: <input type="checkbox" name="gSale" value="1"> <?php $gSale = $_POST['gSale']; if ($gSale == 1) { // Was checked } ?>
-
is using msql_fetch_array without a while loop possible?
ryeman98 replied to tet3828's topic in PHP Coding Help
If you're grabbing data from a specific row of data, then you don't need a while loop. If you're grabbing data from multiple rows, then you'll need a while loop as it will keep going through the data until there is nothing left for it to pull out. Hope this helps! -
You mean you didn't read it, tried to copy and paste, and nothing worked. Don't worry about it bud. If he wants to try to do it the easy way, that's his choice. He'll just end up hurting himself in the long run.
-
[SOLVED] Just can't seem to figure it out ... (mysql error)
ryeman98 replied to ryeman98's topic in PHP Coding Help
The connection stuff is correct. As a matter of fact, the site won't even let me log in to the FTP right now But the connections has to be (sql4.byethost13.com, database name, password) -
Everything else works though, right?
-
Well you can definitely google for such scripts but my cousin has been making really cool stuff with AJAX and he's online a lot of the time so if you want to ask him to point you in the right direction, just mail him: www.boedesign.com
-
Definitely possible using AJAX. I don't know how to do it though.
-
In your tag, just put value="1" in the checkbox tag. If it isn't checked, the value will be 0.
-
I'm not sure I fully understand ... do you want to post the code?