this is my php code for my profile.php. it is to display the users name after login.
<?php
session_start();
require "connect.php";
if($_SESSION['name'])
{
$name = $_SESSION['name'];
$query = mysql_query("SELECT name FROM register WHERE name ='$name'");
$numrows = mysql_num_rows($query);
if(1 == $numrows)
{
while ($rows = mysql_fetch_assoc($query))
{
echo "Welcome, ".$rows['name']."!";
}
}
}
?>
i want to display this:
while ($rows = mysql_fetch_assoc($query))
{
echo "Welcome, ".$rows['name']."!";
}
inside html. ive tried but it isnt working. this is the code i did:
<?php while (@$rows = mysql_fetch_assoc(@$query))?><h3><?php echo "Welcome, ".@rows['name'] ?></h3>
but error : Parse error: syntax error, unexpected '[', expecting ',' or ';' in C:\xampp\htdocs\CashFlow\profile.php on line 37