Jump to content

mysql won't retrieve from the recordset.. pls help


chessmonster

Recommended Posts

her is my code.. the problem is i cant let the contents of the database appear on the screen.

 

i assume that i am wrong with inserting the objects or how i retrieved the recordset's contents are wrong. but still, i can't get the answer.

 

<?php

$conn = mysql_connect("localhost","root","") or die(mysql_error());
//mysql_query("CREATE DATABASE lana",$conn) or die(mysql_error());
mysql_select_db("lana",$conn) or die(mysql_error());


$ctq = "CREATE TABLE itd
		(
		name varchar(100),
		address varchar(100),
		standing varchar(100),
		mukha varchar(100)
		)";



//if (!mysql_query($ctq,$conn)) echo "buracha " . mysql_error();


//mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('simon','cavite','balik','gwapo')");	
//mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('darwin','pque','balik','hindi')");
//mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('jayson','mindanao','balik','negative')");
//mysql_query("INSERT INTO (name,address,standing,mukha) itd VALUES ('dizo','visayas','balik2x','ungas')");


//echo "insert successful";


$result = mysql_query("SELECT * FROM itd");






while($row = mysql_fetch_array($result))
  	{
  	echo $row['name'] . "  " . $row['address'];
  	echo "<br />";
echo "acheche!";
  	}	





mysql_close($conn);

?>

 

tnx in advance

$result = mysql_query("SELECT * FROM itd");

while($row = mysql_fetch_array($result)){
   echo $row['name'] . "  " . $row['address'];
   echo "<br />";
   echo "acheche!";
} 

Looks correct for what it appears your database looks like. Have you tried using PHPMyAdmin to check the database is actually there and to see what's in it?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.