Saturday, 15 February 2014

html - How to echo php variable in div -



html - How to echo php variable in div -

i'm trying echo variable php script within div i'm not getting result.here code :

<?php session_start(); session_name(); $con = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("bloggers", $con) or die(mysql_error()); $data = "select * accountprofile username = '" . $_session['sess_user'] . "' , password = '" . $_session['sess_pass'] . "'"; $result = mysql_query($data); while($row = mysql_fetch_array($result)) { $row['fname']; $row['username']; $row['password']; } mysql_close($con); ?>

and here div want display variable $row['fname'];

<div class="title" style="font-size: 36px;"> <?php echo $row['fname']; ?> </div>

sorry new in html , php .please help thanks.

the variable $row loop-scope. you're creating variable within while , exist there.

php html mysql echo

No comments:

Post a Comment