paulman888888 Posted May 29, 2008 Share Posted May 29, 2008 Is there a simple way of outputing a simple file (eg when you look at the souce code all you see is simple text)? Or do i have to receate a new php script. Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 29, 2008 Share Posted May 29, 2008 Just "read" the file as text and then echo to the page: "stolen" example from tizag.com: http://www.tizag.com/phpT/fileread.php $myFile = "testFile.php"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); echo "<pre>$theData</pre>"; Quote Link to comment Share on other sites More sharing options...
AndyB Posted May 29, 2008 Share Posted May 29, 2008 http://ca.php.net/manual/en/function.show-source.php might help Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted May 29, 2008 Author Share Posted May 29, 2008 Am not sure that is what am looking for. This is my code and it outs html. I would like it to out simple text. Each row on a new line. <?php // Get all the data from the "example" table $result = mysql_query("SELECT * FROM example ORDER BY score DESC") or die('O no. Theres an error'); echo "<table border='1'>"; echo "<tr> <th>Name</th> <th>Score</th> </tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['name']; echo "</td><td>"; echo $row['score']; echo "</td></tr>"; } echo "</table>"; ?> Thankyou for all the help Quote Link to comment Share on other sites More sharing options...
Guardian-Mage Posted May 29, 2008 Share Posted May 29, 2008 Not sure what you are looking for, but this displays the source properly, not the HTML <?php // Get all the data from the "example" table $result = mysql_query("SELECT * FROM example ORDER BY score DESC") or die('O no. Theres an error'); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { echo $row['name'] . "\n"; } ?> Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted May 29, 2008 Author Share Posted May 29, 2008 i am looking for a php script that will show mySql results in a simple file. For example, i use firefox and i click on souce code. When i click on it i would like to see something like this, (result1.php) someonesname tony jimmy bobby tony again and-so-on (result2.php) 10000 5500 333 33 this will be shown in an applitcation and it will show a list of names (result1.php) and next to it scores (result2.php). So it will read someonesname 10000 I think the main problem is getting the name and score to stay with each other on different pages if you know what i mean. Thankyou for the help. Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted May 30, 2008 Author Share Posted May 30, 2008 Ill try something else. Thankyou all the same Quote Link to comment 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.