0

Greetings

i make a code to show spacific fields of a table is there anyway to make all fields with its records appear ?

this is my code

<?php
$db_host = "localhost";
$db_username = "root";
$db_pass = "";
$db_name = "el";


@mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect"); 
@mysql_select_db("$db_name") or die ("No database found");
echo"you are connected to the DB<br>";

$show= "SELECT * FROM sutdent_info";

$res= mysql_query($show);

while ($show =mysql_fetch_array($res))

{

$filed1 =$show[Name];
$filed2 =$show[ID];


echo "Name: $filed1   $filed2<br>  ";

}



?>

thank You

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Fresco Vivir
0

There are numerous ways. For example, you can use the mysql_field_name() function. Or you can alter your script. In the loop, do

foreach($show as $key => $value)
  echo "$key: $value\t";
echo "\n";
0

sorry but i don't think i understand you

i'm new to php would you explain more....

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.