1,105,395 Community Members

php to javascript

Member Avatar
mpc123
Junior Poster
160 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi
Hope someone can help with this.
I have javascript set up how i want it in a normal html page but now need to ensure i can call a result using php with it. My code throws out an error
The code states Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

<body>
<?php
$con = mysql_connect("","","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("", $con);
$result = mysql_query("my query") or trigger_error(mysql_error().$sql);
while($row = mysql_fetch_array($result)){
            echo '<div class="BoxContainer">
    <div class="contentBox">
        <span class="inBoxTitle green">A box</span>
        <!-- Demo Button! -->
        <button class="botGreen" id="botSmallPic1">Picture 1</button>
    </div>
</div> <!-- .BoxContainer -->
<script src="/css/static/js/box.js"></script>
 <script type="text/javascript">
    // ======== Box
    $("#botSmallPic1").click(function(){
        $.smallBox( 
        {
            title: "",
            content: "",
            color: "#ec008c",
            img: "",
            icon: ""
        }
        );
    });
 </script>';
}
?>
</body>
</html>

the error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

The error comes up around this part
$("#botSmallPic1").click(function(){
            $.smallBox( 
            {
                title: "",
                content: "",
                color: "#ec008c",
                img: "",
                icon: ""
            }
            );
        });
LastMitch
Deleted Member
 
0
 

@mpc123

the error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

The error usually tells you which line that you need to add a comma or semi-colon.

Member Avatar
mpc123
Junior Poster
160 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

its this line

             title: "",
Question Answered as of 1 Year Ago by LastMitch
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article