austonb Posted September 4, 2006 Share Posted September 4, 2006 I need to know what needs to done in order to make this work I've got my php code that queries/results from my mysql db here[code]<?php$con = mysql_connect("localhost","userr","passw*rd);if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("databasee", $con);$result = mysql_query("SELECT * FROM fags");while($row = mysql_fetch_array($result)) { echo "<b>". $row['Question'] . "</b><br/> " . $row['Answer']; echo "<br />"; }mysql_close($con);?>[/code]and then I use this php include tag/command/function[code]<?php include("thefileurl/filename.php"); ?>[/code]and I use it in this javascript function, which is located in an external file on my server(lamp server)[code]function faqclick() { document.getElementById('sfhead').innerHTML="<br><h2>F.A.Q.</h2><h3>Frequently Asked Questions.</h3>"; document.getElementById('sfcontent').align="left"; document.getElementById('sfcontent').innerHTML="<?php include('http://hiphop-tops.com/testsite/header.php'); ?>"; }[/code]does anyone have any insight as to why it's not working and what I can do to make it work? Quote Link to comment https://forums.phpfreaks.com/topic/19682-php-include-being-written-to-div-using-js-dom/ Share on other sites More sharing options...
radar Posted September 4, 2006 Share Posted September 4, 2006 well #1 that i could see would be your query.. i highly doubt your table is named fags it's probably faqs Quote Link to comment https://forums.phpfreaks.com/topic/19682-php-include-being-written-to-div-using-js-dom/#findComment-86009 Share on other sites More sharing options...
kenrbnsn Posted September 4, 2006 Share Posted September 4, 2006 Javascript runs on the client and PHP on the Server. By the time Javascript executes, PHP is nolonger active. To do what you want to do, you need to look at an AJAX solution. You can go to the sister forum to this one AJAXfreaks.com (http://www.ajaxfreaks.com/). You can also look at the YAHOO! User Interface Library Connection Manager module (http://developer.yahoo.com/yui/connection/) which takes alot of the pain of AJAX programming away.Ken Quote Link to comment https://forums.phpfreaks.com/topic/19682-php-include-being-written-to-div-using-js-dom/#findComment-86024 Share on other sites More sharing options...
Ninjakreborn Posted September 4, 2006 Share Posted September 4, 2006 [quote]well #1 that i could see would be your query.. i highly doubt your table is named fags it's probably faqs[/quote]For some wierd reason, this was the funniest post, I have ever read since I have been here. Quote Link to comment https://forums.phpfreaks.com/topic/19682-php-include-being-written-to-div-using-js-dom/#findComment-86026 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.