PDA

View Full Version : Grabbing and entering data from using a mysql database



cheatpark
March 26th, 2002, 17:56
How do I do this using php? I know html and stuff. Just I need to know all the php stuff. I've tried loads of things but it won't work. Can some help me please.

invalid
March 26th, 2002, 18:06
i can;t explain the whole process here but basicly you have to:

Connect
Select a database
Query the table
Print Back Results

example


mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
$query = "SELECT rowname FROM `database` LIMIT 0, 30";
$result=mysql_query($query);
if ($result) {

while ($r = mysql_fetch_array($result)) {

extract ($r);
echo $rowname;
}
}


that connects, queries, selects database $dbname selects colum rowname from table database loads the values into an array and loops through the array printing everything in that coloum

confused?

read this:

http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html

it helped me when i was first learning

cheatpark
March 26th, 2002, 18:07
Thanks for the quick and detailed response.

invalid
March 26th, 2002, 19:57
sure, i hope i helped you like some other nice people helped me