HI , I basically have made something that I require work in html but now trying to convert to get the results from data base but get this error and cant work out how to change it, if someone could help

unexpected T_STRING, expecting ',' or ';' on line 69

***********all my css and database connection and query stuff**********************











while($row = mysql_fetch_array($result)){

            echo '<div class="BoxContainer">
    <div class="contentBox">
        <span class="inBoxTitle green">green 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">



    $("#botSmallPic1").click(function(){
        $.smallBox( 
        {
            title: "",
            content: "",

            color: "#ec008c",
            img: "",
            icon: ""
        }
        );

    });


 </script>';
}

?>
</body>
</html>

Recommended Answers

All 10 Replies

post complete code, $row is not used anywhere in your code,
so better you write php code where needed,
dont include all static html code in php echo.

Hi

Thanks for the reply

Yeah im adding the $row info later as there is a lot of it, that why im trying to get rid of these issues first

It looks like the problem is with this area

{
            title: "",
            content: "",
            color: "#ec008c",
            img: "",
            icon: ""
        }
        );
    });



with the fetch result also wanting info between the } this means it obviously thinks it stops there, hoiw do i get round this please?

Thanks

just need whole code otherwsie cant find error

Sorry here you go

<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>

i dont find error in ur code, its compiles well

thanks for the reply but it says there is an error and I think there is around the

// ======== Box
    $("#botSmallPic1").click(function(){
        $.smallBox( 
        {
            title: "",
            content: "",
            color: "#ec008c",
            img: "",
            icon: ""
        }
        );
    });

    due to the { } which are in the code as the php result code says in between { }. I have no idea how to get round it

are u sure u going to put some $row value in this javascript?, if not, then just keep this script out of php, becasue if u keep it in loop, the script will generate number of times the records are in ur query.

or use something like,
title="<?php echo $row['somevalue']; ?>";

yes im going to be putting the $row information in, im getting rid of this problem then i can go and add all that information

Do what urtrivedi has advised and remove all your html and javascript from the php and see if your problem is resolved

while($row = mysql_fetch_array($result)){ ?>

    <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 type="text/javascript">

    // ======== Box
    $("#botSmallPic1").click(function(){
        $.smallBox( 
        {
            title: "",
            content: "",

            color: "#ec008c",
            img: "",
            icon: ""
        }
        );

    });

 </script>

<?php } ?>

And you won't need to call the external js file in your while loop so move <script src="/css/static/js/box.js"></script> to your head

prefect thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.