FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


creating guestbooks (form) with php & mysql





bjwok
hi guys,

ok, my site http://www.bjwok.frih.net/ has a guestbook, but it is currently a free one hosted at htmlgear.com and i would like to create a database here on the fri, use a script and have it all part of my site.

my knowledge of php, mysql and scripting is pretty limited, but my html is pretty well on target so i will understand chunks of code if it is posted.

i guess my first question is really, how do i go about setting up a database here on the fri (using direct admin) and then how do i link to it via a form (ie, sign guestbook), then how do i bring that info back and display it (ie, view guestbook).

any help would be appreciated!

cheers
Atomo64
First you have to go to the mysql admin, then create a new database and a user. Once you've done that, follow this:
now execute this SQL by using phpmyadmin:
Code:
CREATE TABLE `guestbook` (
  `comment_id` int(11) NOT NULL auto_increment,
  `title` text NOT NULL,
  `comment` text NOT NULL,
  `poster_name` text NOT NULL,
  `poster_email` text NOT NULL,
  `poster_url` text NOT NULL,
  `time` int(11) NOT NULL default '0',
  PRIMARY KEY  (`comment_id`)
) TYPE=MyISAM;

Now you got the table... now let's try this:
create a new file called connect.php
Code:

<?php

if(!defined("OPENER"))
die("Get out of here!");

$sql_connection=@mysql_connect( "localhost" , "username_here" ,"password_here);
if(!$sql_connection)
die("couldn't connect to the database");
/* .............  */

?>


Err, sorry, as you can see my example is not complete because I've some other things to do... maybe tomorrow I'll finish it Razz sorry
bjwok
hi Atomo64,

thanks for the start anyway man, i am at work at the moment, so i won't be able to get going with it until sometime this weekend anyway...
Related topics
E-Cards with PHP & MySQL
HTTP AUTH with PHP and mySQL
Make search engine With PHP and mySQL, for your site
Crash course in PHP and MYSQL
Working with Excel, PHP & MySQL. Any Ideas
A very good PHP MySQL Tutorial
[man]Azlo tu mismo ShoutBox en PHP y mysql
Creating a Search Script with PHP for MySQL
PHP & MySQL auth system
Help regarding Php & MySQL
"Drop Down List Box" Using PHP and MySql
which host do u like put php&mysql?
php and mysql form
PHP-Fusion | An Open Source CMS | PHP & MySQL Based
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.