i have 2 questions to ask:
first of all, in while ($row = mysql_fetch_object($result))
i have an object: $row->atitle
now through javascript, i want to print on the page an ++increment of the current object of the array.
i am doing this:
hidephp = document.write("<?php echo .$row->atitle.["+inc+"];"+" ?>");
the above doesnt seem to work. help would be much appreciated.
You’ve offered so little to work with, that I’m really not sure of where to begin. I assume that from your post, you’re not using any kind of templating process (you should really look into that)
Your problem is really that you’re mixing languages that span the client/server relationship. Javascript can do stuff with what the server sends the client, while PHP actually decides what to send in the first place. If you want Javascript to do something with variables in PHP, you should look into using PHP’s
json_encode()to do what you want: