i am trying to display mysql data in html
table format is
table name:: App
appid | app | version | date | apk file |
1 sample 1.0.0 2012-10-12 sample.apk
//mysql query is
<?php
$query="SELECT * FROM `App` where appid=1";
$res=mysql_query($query);
$row=mysql_fetch_row($res);
$app=$row[1];
$vesion=$row[2];
$date1=date('M j,Y',strtotime($row[3]));
?>
//html code is given below
<html>
<body>
<div style="text-align:left"><p>App:<b><? $app.' '.$vesion ?></b></p></div>
<div style="text-align:left"><p>Date Uploaded: <b><? $date1 ?></b></p></div>
<ol class="instructions">
<li>Click <a href="http://localhost/downloads/$row[4]">Here</a> todownload.
<br></li>
</ol>
</body>
</html>
<?php
?>
but do not getting mysql data in html file
any one help me for correct solution
Ok so two things may be happening here.
You need to wrap any PHP code with the opening and closing PHP tags - <?php ?>
. This includes single variables like you did with row[4]
. You'll also need to echo out the variable -
<a href="http://localhost/downloads/<?php echo $row[4]; ?>">Here</a>
Make sure you HTML file has the .php
file extension. Other wise the server will simply not parse the file as PHP and your code will not be executed as PHP but rather as plain text. You can setup your server to parse PHP even in HTML files - this is done sometimes for security measures as to not let users know what technologies are being used on the server (but I'm not sure if that's what you are going for here).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With