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

Link to comment
Share on other sites

$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?

Link to comment
Share on other sites

just check using this one

mysql_num_rows($result);

and see how many rows are coming using ur select query..

There obviously aren't any, since the syntax for output is correct given the information provided.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.