Jump to content

[SOLVED] simple format


paulman888888

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/107886-solved-simple-format/#findComment-553043
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/107886-solved-simple-format/#findComment-553046
Share on other sites

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";
} 
?>

Link to comment
https://forums.phpfreaks.com/topic/107886-solved-simple-format/#findComment-553056
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/107886-solved-simple-format/#findComment-553059
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.