Jump to content

[SOLVED] simple format


paulman888888

Recommended Posts

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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.