We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,985 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

php to javascript

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: ""
            }
            );
        });
2
Contributors
2
Replies
18 Hours
Discussion Span
3 Months Ago
Last Updated
9
Views
Question
Answered
mpc123
Junior Poster
112 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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.

LastMitch
Industrious Poster
4,155 posts since Mar 2012
Reputation Points: 132
Solved Threads: 334
Skill Endorsements: 45

its this line

             title: "",
mpc123
Junior Poster
112 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 3 Months Ago by LastMitch

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0732 seconds using 2.89MB