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 n开发者_StackOverflowew to php.
Check out the tutorial over at:
http://www.freewebmasterhelp.com/tutorials/phpmysql
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.
精彩评论