I am trying to echo a file content (php stuff). So I have text.php for instance with this: <? $test='test';?> Code (markup): I have another php file, test1.php where I have this: <? include('text.php');?> Code (markup): After that include I am trying to find something that will echo everything (what I included) as a php code. So, my page should look like this: <? $test='test';?> Code (markup):
Something else seems to be the problem. The code above doesn't return anything. returns Resource id #34 if used in the above code. [edit] used in phpmyadmin returns the result I need.
<? require_once('./settings.php'); $sql = 'SELECT * FROM `currency` LIMIT 0, 30 '; $result = mysql_query($sql); if(!$result) die("Query Failed."); while($row = mysql_fetch_row($result)) { /* Put something in here, perhaps to test just: */ var_dump($row); } ?>
Err... you just said you could: Resource id #34... The return value of mysql_query is a resource, not a string or an int... etc Dan
Try this <? require_once('./settings.php'); $sql = 'SELECT * FROM `currency` LIMIT 0, 30 '; $result = mysql_query($sql); if(!$result) die("Query Failed."); while($row = mysql_fetch_row($result)) { echo $row['id']; } ?>
You are right there, just save the javascript with a .php extension - and if you want - just for security - add a header defining the content as Javascript. You can do this by, adding at the top of the PHP fie you wish to use as JS: <?php header('Content-type: text/javascript'); ?> //Javascript goes here. PHP: And..eurgh, clean up your HTML - keep tags in lowercase. That should be: <script type="text/javascript"> <!-- window.location='<?php echo $url;?>'; // --> </script> Code (markup):