Hello, i am working on a script that will take info from a form and input it into a mysql database for later use. I am looking to make it so that I can search for the title or description and it will return the corresponding data. I know how to make forms and process them in PHP, but I am not sure on how to use MySQL to hold the data because I have only used .txt files in the past.
I believe the first step is to create the mysql columns like this:If anything in there is wrong, i would appreciate someone letting me knowHTML Code:CREATE TABLE `job_recorder` ( `id` mediumint(8) unsigned NOT NULL auto_increment, `job_title` varchar(20) NOT NULL default '', `client_email` varchar(20) NOT NULL default '', `client_name` varchar(20) NOT NULL default '', `description` varchar(20) NOT NULL default '', `price` varchar(20) NOT NULL default '', ) ENGINE=MyISAM ;.
The next step should be to insert the data into the database like this:Correct?HTML Code:INSERT INTO `job_recorder` VALUES (1, '$job_title', '$client_email', '$client_name', '$description', '$price', '');
And to call it up again I would do:Correct?PHP Code:<?php
$query = mysql_query("SELECT * FROM `site_config`");
while ($get = mysql_fetch_array($query))
{
echo '<title>$get[job_title]</title>';
echo 'Email: $get[client_email]';
echo 'Name: $get[client_name]';
echo 'Description: $get[description]';
echo 'Price: $get[price]';
}
?>
I guess this kinda turned out to be just me needing verification on if my ideas are right or not. But i do have a few questions, if I run this more than once, will it insert a second entry so that I can call that one too? Also, how might I go about searching for a certain entry?



.
Reply With Quote



Bookmarks