Hi, How do I print text from the database? I've tried with this code, but it only returns "Resource id #2".. Why?
<?
include("connect.php");
$result=mysql_query("SELECT un FROM login WHERE pw='expand'");
echo"$result";
?>
<? include("connect.php"); $result = mysql_query("SELECT un FROM login WHERE pw='expand'"); if(!$result) die(mysql_error()); $row = mysql_fetch_array($result); echo $row['YourField']; ?>
Aaight, thanx!,.. But when I write that it only prints the FIRST row from the database.. How do I make it print several rows?..
<? include("connect.php"); $result = mysql_query("SELECT un FROM login"); if(!$result) die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "".$row['YourField']."<br>\n"; } ?>