PDA

View Full Version : installing a database in front page ?



eapj1
05-23-2006, 09:56 PM
How do you install a database in front page ?
I have it set up according to the tutorial,
how do i get it in there to have the input from
the form to go in to it ?
Thank you for your help.
eapj1

navaldesign
05-24-2006, 06:11 AM
Frontpage has nothing to do with writing the data in your database. After you have created your form in frontpage, you need a script (usually in php, to process the info submitted by the form. If you are using a php script to process your form info, you will have to add some lines of code in the script, in order to have the info writen in the database. Then, of course, you will need another script to retreive the info from the database, and have it presented in one of your pages.
Although there are such script examples on the net, they are usually hard to create and use, unless you have some knowledge of php and MySQL.



Lets suppose that you already have in your script a part that will define three variables $address, $lastname and $name getting them from the array submitted by the form. You now want to write these three values in your database.

Here is an example of what the writing piece of code could look like:

@$pfw_strQuery = "INSERT INTO `clients`(`address`,`lastname`,`name`)VALUES (\"$address\",\"$lastname\",\"$name\")" ;
@$pfw_host = "localhost";
@$pfw_user = "dbusername";
@$pfw_pw = "bdpassword";
@$pfw_db = "dbname";
$pfw_link = mysql_connect($pfw_host, $pfw_user, $pfw_pw);
if (!$pfw_link) {
die('Could not connect: ' . mysql_error());
}
$pfw_db_selected = mysql_select_db($pfw_db, $pfw_link);
if (!$pfw_db_selected) {
die ('Can not use $pfw_db : ' . mysql_error());
}
//insert new record
$pfw_result = mysql_query($pfw_strQuery);
if (!$pfw_result) {
die('Invalid query: ' . mysql_error());
}
mysql_close($pfw_link);

These lines will write the three variables, name, lastname and address in the database, in the table "clients", in their respective fileds.

eapj1
05-24-2006, 04:26 PM
Navaldesign,
If i am just using the database to store info like firstname, lastname, zipcode, email address, Date and Time, with the info hide from others.
Would i use the script like you wrote it, except add the other varibles ?
I am located in the US, so i'm not on line when you are.
Thank you for your help.
eapj1

Watdaflip
05-24-2006, 04:53 PM
yes, that will store the data into the a database, but you also need a script to display the data

navaldesign
05-24-2006, 09:18 PM
Data writen in the database are only visible to only who can connect to the database, with the correct loggin info. Usually the info can be retreived from the database using another script, and then it is displayed in one of your pages, using some more code. To create the necessary code, you can either hand compile it, if you have the necessary knowledge, or use one of the commercial php/html code generators. In both cases, it requires some effort from you.

eapj1
05-27-2006, 12:56 AM
Where is a good place to find a frontend script, for taking info and putting it into a database table ?
thank you for your input.
eapj1

navaldesign
05-27-2006, 12:28 PM
You must create a form in one of your pages and make a script as shown above. There are no ready made scripts for such kind of application, as each case is a case appart. Your problem will be more to create the necessary script for data retrieval and presentation.

eapj1
05-27-2006, 03:46 PM
I already have the form set up to receive the first and last name,
the zipcode and email address. and it is going into a html area
of the website. Can i install any table in the database or
is there a place to find a table, to install into the database ?
Then i would just need some script like what was sent above.

1 more question, to send back an email to those that hit the summit
button on the form, would you you'se a php script or a java script
to take their input and send it to them in an email ?

Thank you for getting back with me.
eapj1

navaldesign
05-27-2006, 09:00 PM
The above script, in php, after writing the data in the database can also send an email to you as well as to the visitor (like an autoresponder) . Youcan personalize the message sent to them as you wish.

You must CREATE the database. There is no database in your account initially. You create it through CP. Then use phpMyAdmin to set up the table (name it as you like it, f.e. "clients". Then set the type and lenght of the fields.

As i told you, it is not simple: if the ifo is of vital importance, you will need field validation to make sure that the fields have been completed, taht they are the appropriate type of data, etc. The hardest part will be the data retreival and presentation script, especially if you want the presentation page to suit the rest of your site.

eapj1
05-29-2006, 05:44 PM
Navaldesign,
Happy memorial day !
What is the best way to set up a table in phpMyAdmin ?
Thank you for your help !
eapj1

navaldesign
05-29-2006, 10:22 PM
There is only one procedure: select the database you want to create the tble in, then from the field Create new table, select the name and number of fields you want. Are you sure you want to do this? I still don't feel very confident about MySQL....

eapj1
05-30-2006, 05:36 PM
You told me that a database was the best way to collect the peoples info in. Unless you know of another way of collecting this info. i am open for a better suggestion. I just need to collect the first name, last name, zipcode and thier email address. However i need to be able to read it easily and be able to delete it easily if some one wants out of the mailling list.
eapj1

navaldesign
05-30-2006, 05:48 PM
The meaning of my post was not to discuss on which way is the best. A database IS the best way to collect and search info. My post was about your ability (and mine as well ) to create the necessary frontend scripts to manage the database directly from your site. If you need to only collect the info and then manually edit it or delete it through phpMyadmin, it becomes easier.

eapj1
05-31-2006, 03:47 PM
in the php and data base forum i ask witch would be the best to do.
a database or excell. you said a data base, that is why i came to this forum.
eapj1

navaldesign
05-31-2006, 07:27 PM
Again: a database is the best way to manage info. The problem is not the database itself, but creating the scripts that will do the editing, updating, managing, and searching of the database stored info.

rinahearts
08-21-2006, 02:19 AM
sorry to interrupt naval but where can i get this php generators ?

navaldesign
08-21-2006, 06:20 AM
What do you mean php generators ? i'm asking because i have re-read the above posts and there is no mention (or at least i didn't see any) on php generators.
Anyway, php code generators are programs that usually create the necessart php code as well as the necessary html frontend templates for managing (usually) databases. Take php Magik (http://www.websitedatabases.com/)for example.

But they usually require a remote connection to the database, wich is not available with VH nor with many other hosters. Have a look at this thread (http://www.vodahost.com/vodatalk/mysql-php/11378-question-about-voda-host-readarding-php-mysql.html#post66471)

rinahearts
08-21-2006, 07:51 PM
Data writen in the database are only visible to only who can connect to the database, with the correct loggin info. Usually the info can be retreived from the database using another script, and then it is displayed in one of your pages, using some more code. To create the necessary code, you can either hand compile it, if you have the necessary knowledge, or use one of the commercial php/html code generators. In both cases, it requires some effort from you.





that's what i was asking

navaldesign
08-21-2006, 07:54 PM
Ok, i had writen php code generators, you wrote php generator, that got me a bit confused.

rinahearts
08-25-2006, 06:38 AM
no prob