0
<body>
<p>
  <?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("select", $con);

$result = mysql_query("SELECT * FROM view");
?>
  </p>
<form id="form1" name="form1" method="post" action="">

  <table width="100%" border="1" cellspacing="0" cellpadding="0">
  <?php while($row = mysql_fetch_array($result))?>
   <?php  

                {
            ?>
            <tr bgcolor="#F5F5F5"> 
              <td > 
                <?php echo $val['name']; ?>
              </td>           
             </tr>
        <?php mysql_close($con);   
         }   ?>

  </table>  
   </form>  
</body>

Edited by mike_2000_17: Fixed formatting

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by khushhappy
0

hi, dear

Try this
<?php
$result=$val;

echo "<tr bgcolor="#F5F5F5"><td >".$result."</td></tr>";
?>

0

Problem is stil there :(
paste of error is shown at the end of the code.


<form id="form1" name="form1" method="post" action="">

<table width="100%" border="1" cellspacing="0" cellpadding="0">
<?php while($row = mysql_fetch_array($result))?>
<?php
{
?>
<?php
$result=$val;

echo "<tr bgcolor="#F5F5F5"><td >".$result."</td></tr>";
?>

<?php mysql_close($con);
} ?>

</table>
</form>

ERROR

Notice: Undefined variable: val in C:\wamp\www\danicolums\connectivity.php on line 32


LINE 32: $result=$val;

0

Hi, here is the code.....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="70%" border="1" cellspacing="1" cellpadding="1">
<tr>
   <td colspan="2">NAME RESULTS TO DISPLAY</td>
</tr>

<?php
$server = "localhost";
$username = "root";
$password = "";
$db_name = "select";
$db = mysql_connect($server,$username,$password) or DIE("Connection to database failed, perhaps the service is down !!");
$db1=mysql_select_db($db_name) or DIE("Database name not available !!");

$login = mysql_query("select name,Designation from view");

while ($row = mysql_fetch_array($login, MYSQL_ASSOC))
{
echo"<tr>";
echo "<td>" .$val= $row["name"]."</td>";
echo"<td>" .$val= $row["Designation"]."</td>";
echo "</tr>";
}
?>

</table>
</body>
</html>

0

@monica singh :
ya this was the one , i was waitin for..
this worked..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.