tags:

views:

55

answers:

2

Hello,

How can I read from mysql and write the same in http output stream.

So its like if send a request http://www.xyz.com/download/A it should return me data for A from mysql through php.

The data is plain text.

Thanks PS: I am new to php.

A: 

Check out the tutorial over at:

http://www.freewebmasterhelp.com/tutorials/phpmysql

Brian Fisher
Why the down vote?
Brian Fisher
A: 

This should work, just adapt it to your code by replacing the variables, table and column nammes with yours.

$sql = 'SELECT text FROM table WHERE id='.$id;

$result = mysql_query($sql, $conn) or die('SQL error');
$text = mysql_result($result);

header('Content-Type: text/plain');
echo $text;

Note, that you should not output any HTML or whitespace before sending the header, though.

Hope this helps.

Franz
Does this work?
Franz