Problem with code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Goofan
Forum Contributor
Posts: 305
Joined: Wed Nov 04, 2009 2:11 pm
Location: Sweden

Problem with code

Post by Goofan »

Hi got a msall problem trying to fix it. would appriciate any help on resolving the problem :D

I get a parse error on the $pull line in the beginning

Code: Select all

 
<?php
$show = 0
--- --- --->        $pull = '<input style='width:75;height:25;font-weight:bold' name="Random" type="submit" value="Pull!">'
            $reset = '<input style='width:75;height:25;font-weight:bold' name="Reset" type="submit" value="Reset!">'
 
if ($show = 0) 
{
echo "$pull";
echo "$reset";
}
if (isset($_POST["Random"]))//Kollar om knappen RANDOM använts.
{
 
 
    if ($threeisthree < $usercanplay)
        {
        
        $rand = rand(0,5);
        $arand = rand(0,5);
        $brand = rand(0,5);
        $MoneyInput = rand(7500,65000);
            if ($rand == $arand && $brand == $rand && $arand == $brand)
                {
                    echo "<b>YOU WON:</b> " .$MoneyInput ." money";
                
                    $sql="UPDATE konto SET pengar=$pengar + $MoneyInput WHERE saved_id=$id";
                    $result = mysql_query($sql) or die(mysql_error());//Skicka info till tabell
                    header('Refresh: 3; url=refresh/three=three(main).php?saved_id='.$id);//Skickas till angiven sida.
                    
            $sql="UPDATE konto SET threeisthree=$threeisthree + 1 WHERE saved_id=$id";
            $result = mysql_query($sql) or die(mysql_error());//Skicka info till tabell
            $show == 1
                }
                else
                {
                echo "<b>"."Better luck next time!"."</b>"."<br>";
            $sql="UPDATE konto SET threeisthree=$threeisthree + 1 WHERE saved_id=$id";
            $result = mysql_query($sql) or die(mysql_error());//Skicka info till tabell
                }
 
            
        }
 
    else
        {
            echo "You have played Two By Two more then 105 times today";
        }
    echo "<table border='1' bgcolor='orange'>";  
        echo "<tr><td>";
    echo $rand." </td><td>".$arand."</td><td>".$brand."</td>"; //skriver ut innehållet radvis (inom kaninöron = html kod)
        echo "</tr>";
    echo "</table>";
}
else
{
    echo "<table border='1' bgcolor='orange'>";  
        echo "<tr><td>";
    echo "X"." </td><td>"."X"."</td><td>"."X"."</td>"; //skriver ut innehållet radvis (inom kaninöron = html kod)
        echo "</tr>";
    echo "</table>";
}
if (isset($_POST["Reset"]))//Kollar om knappen RANDOM använts.
{
                    $sql="UPDATE konto SET threeisthree= 0 WHERE saved_id=$id";
                    $result = mysql_query($sql) or die(mysql_error());//Skicka info till tabell
                    header('Refresh: 0; url=refresh/three=three(main).php?saved_id='.$id);//Skickas till angiven sida.
}
 
                
echo "<b>"."You have played this game " . $threeisthree . " times today" . "<br>"."</b>";
echo "<b>"."you got " . $finish . " times left"."</b>";
?>
 
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Problem with code

Post by califdon »

Well, yes, you are trying to use single-quotes within a single-quoted string. Your options are either to escape the single-quotes within the string, or to use either double-quotes to enclose the entire string and single-quotes within it, or the opposite.
Post Reply