English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I’ve learned building a guestbook script using Apache, PHP and Mysql

I build a guestbook script and successfully… after submitting it will send the data to the mysql database.

Name: _________________
Location: ___________________
Email: ______________________
Message: ____________________

But how can I get from MYSQL Database and display it on HTML File.
If I browse the MYSQL Directory…. The format of the database is guest.myi and guest.frm inside the phpguest folder.

Sample format of desired html
Name Location Email Message
TonyPhilippines Tony@xxxx.com Hello
IlonahNew York Il@yyy.net Hi, How are You

Can someone give me the source code on the output getting from the a certain database with a format guest.myi and guest.frm

Thank you….

2006-10-09 16:14:53 · 3 answers · asked by edwinbiasbas 1 in Computers & Internet Programming & Design

3 answers

Well, I'll assume certain things:

1. You know how to connect to the database, as you can connect to it to save the data.
2. The data is stored in a table named "guestbook" and the fields are: "name", "location", "email" and "message".
3. You don't need pagination (show the results in more than one page). If you need to, post another question and I'll answer it.

$results = mysql_query("SELECT * FROM guestbook ORDER BY name"); //you can order by whatever you want
while ($result = mysql_fetch_array($results))
{
echo "Name: ".$result["name"]."
";
echo "Location: ".$result["location"]."
";
echo "Email: ".$result["email"]."
";
echo "Message: ".$result["message"]."

";
}

The way these results are shown can be different. That is something you can format with HTML (see http://www.htmlquick.com ). The values are stored in the $result["what"] variables.

2006-10-09 16:45:50 · answer #1 · answered by Diegosolo 2 · 0 0

HTML. it somewhat is it. pass to web pages, view the source from those web pages, and learn by potential of coping what persons do. in case you desire to construct dynamic pages that adjust finding on how people use the pages, you will would desire to earnings a language like Hypertext Preprocessor and MySQL. yet do no longer initiate studying that until eventually you have written some HTML pages.

2016-10-02 03:32:18 · answer #2 · answered by ? 4 · 0 0

$connection = mysql_connect($dbhost, $dbuser, $dbpass) ;
mysql_select_db($dbname) ;
$resultset=mysql_query("select name,emailid,msg from guestbook");
print "

";
while($row = mysql_fetch_array($resultset, MYSQL_ASSOC)){
print "".
"".
"";


}
print "
".$row['name']." ".$row['emailid']. " ". $row['msg']."
";
optionally use limit start,no to list nos in pages as
select name,emailid,msg from guestbook order by name limit $start,10

2006-10-09 16:46:21 · answer #3 · answered by howsureyouare 3 · 0 0

fedest.com, questions and answers