<html>
<head>
<title>Nutrient</title>
</head>
<body>

<?

    $filName = "resource.txt";
    $objWrite = fopen($filName, "w");

    $objConnect = mysql_connect("localhost","u52030177","guillaume") or die("Error Connect to Database");
    $objDB = mysql_select_db("u52030177");
    $strSQL = "SELECT * FROM Nutrient";
    $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");


    //$link = mysql_connect("localhost","u52030623","u52030623");
    //mysql_select_db("u52030623");
    mysql_query("SET NAMES UTF8");
    //$sql = mysql_query("select * from Nutrient;");

    //if(!$link) die('ERROR: '.mysql_error());

?>


<h1 style="color:black;">Nutrient</h1>

<table align=left width=100%>
    <?
    while($row = mysql_fetch_array($objQuery))
    {
        ?>
    <tr>
        <td>
        <div style="background-color:white; padding:5px; margin-bottom:5px;">
        <table>
        <tr>
            <td valign=top>
                <font color=blue><b><?=$row['FoodID']?></b></font><br>
                <font color=blue><b><?=$row['Protein']?></b></font><br>
                <font color=blue><b><?=$row['Fat']?></b></font><br>
                <font color=blue><b><?=$row['Carbohydrate']?></b></font><br>
                <font color=blue><b><?=$row['Sodium']?></b></font><br>
                <font color=blue><b><?=$row['Energy_Person']?></b></font><br>
            </td>
        </tr>
        </table>
        </div>
        </td>
    </tr>
        <?
    }
    ?>
</table>
<?
while($objResult = mysql_fetch_array($objQuery))
{
fwrite($objWrite, "$objResult[Protein],$objResult[Fat],");
fwrite($objWrite, "$objResult[Carbohydrate],$objResult[Sodium] \r\n");
}
echo "<br>Generate Text File Done.<br><a href=$filName>Download</a>";
fclose($objWrite)
?>
</body>
</html>

i'm trying to download a file name "resource.txt" to my pc but when i click download nothing happens (atleast it should show the data i want in new page)

this is link : http://wangmuk.informatics.buu.ac.th/~52030177/index1.php

Er, where is C++ involved in this?

sorry.how can i remove this post?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.