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

I need to learn how to create and manage a server side database, so i can include all the information on my site into a searchable format. I am on a MAC. I have web design knowledge, but do not know anything about server side creation. I cant afford to pay a pro to do this for me, so how can i learn, and what programs do i need? Remember that this is for a MAC, not a pc. Thanks in advance

2007-06-30 00:26:20 · 5 answers · asked by vareynick2001 1 in Computers & Internet Programming & Design

5 answers

You will need the following:
database: to store the information you want to search
server: to host the files that will search and display results
server code: the files that will search and return results.

Good suggestion is this:
MySQL database
Apache Server
PHP for programming

The three come in package from WAMP
http://www.wampserver.com

As to how to learn, Google for:
php tutorial
mysql tutorial
php mysql tutorial

2007-06-30 00:48:19 · answer #1 · answered by Guybrush 2 · 1 0

Perhaps this won't be the answer you expect but one of the best ways to learn is by 'doing'. Why not install an existing content management system? (cms) eg Joomla!, Mambo or Drupal. You will soon learn the basics of MySql and php although with these systems you don't even have to understand or use them. All the development has already been done for you and all you have to do is add your information which you can do in either html or plain text with an editor. I had a similar problem and went with Joomla!:
http://joomla.org and haven't ever looked back.
ps: by install I mean install on your server. Whether it is a Mac or PC doesn't matter. You can do all your work online if you want without setting up a local server whilst you get used to it.

2007-06-30 02:07:36 · answer #2 · answered by Anonymous · 0 0

The w3 schools site is ok as are http://php.org http://apache.org.

But if you want the easiest way to get the idea I suggest a book from SAMS..
Called Teach Yourself PHP/Mysql/Apache in 24 Hours its written by Meloni and comes with a CD you can use for learning (and for great code "snippets") It not too expensive and well worth keeping around!

PC or MAC or Linux -- Apache PHP and MySql all work the same.. once they are installed and running the actual underlying OS is not important (other than security issues) !!!

2007-06-30 01:19:27 · answer #3 · answered by Tracy L 7 · 0 0

PhP and MySQL are NOT on your machine: they are on your server.
Check first that your "site" server offers you these, through something like "Cpanel". Most servers (website hosts) have them included when you bought the domain and booked the storage on the server.
Then...
To learn a bit of PhP, go to www.php.net. If you know a bit of C or similar, you will see that most stuff is very similar in PhP.
You search for a function? Just enter the function in C in the search. It returns the similar functions. Check the parameters, read the code snipets that others have added and there you go.
Write a piece of code, upload to the server and check the result. Your new page will have ".php" extention, and the PhP code will be enclosed with "" at the end.
So your HTML page (say "test.html") would be:
"
....
....
the body text.
echo ("Hello world!
"); // to display "hello world!"
?>
the rest of the body text

And you save it as "test.php", then upload.
This will teach you to use PhP...
Now for MySQL...
First, you will have to get your username and password, and to create a data-base, directly, through the control panel of your site.
After that, you can create tables in your DB
Bit more complicated, but you mearly need a few functions:
Connect, make a table, add entries, delete entries, fetch entries...
function dbconnect()
{
$link = mysql_connect("localhost", "username", "password") or die(" Could not connect : " . mysql_error());
mysql_select_db("dbasename") or die("Could not select database");
return($link);
}

function makedbtable()
{
$tablename = "stories";
$link = dbconnect();
$cmdd = "DROP TABLE IF EXISTS " . $tablename;
mysql_query($cmdd) or die("Query failed : " . mysql_error());
$cmdd = "CREATE TABLE `".$tablename."` (
`number` VARCHAR(10) NOT NULL,
`title` VARCHAR(100) NOT NULL,
`text` LONGTEXT
) TYPE = MYISAM" ;
mysql_query($cmdd) or die("Query failed : " . mysql_error());
mysql_close($link);
}
function addstories($_POST)
{
while(list($name,$value) = each($_POST))
$$name=$value;
$link=dbconnect();
$txt = 'VALUES ("'.$number.'","'.$title.'","'.$text.'")';
$sql = 'INSERT INTO `stories` ( `number`,`title`,`text`) ' . $txt;
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
mysql_close($link);
return ($result);
}
function delstories($_POST)
{
while(list($name,$value) = each($_POST))
$$name=$value;
$link=dbconnect();
$query="DELETE FROM `stories` WHERE `title` = '" . $title . "' AND `number`= '".$number."' LIMIT 1 ";
mysql_query($query) or die("Query failed : " . mysql_error());
mysql_close($link);
}
function getentries()
{
$link=dbconnect();
$query="SELECT * FROM `stories` WHERE 1";
$list = mysql_query($query) or die("Query failed : " . mysql_error());
while ($lst = mysql_fetch_array($list))
{
echo ($lst[0]."
");
echo ($lst[1]."
");
echo ($lst[2]."
");
}
mysql_free_result($list);
mysql_close($link);
}
?>
That's all you need to know to get started.
You will soon get the grip of it!
Good luck.

2007-06-30 05:32:25 · answer #4 · answered by just "JR" 7 · 0 0

w3c schools website
http://www.w3schools.com/

2007-06-30 01:00:55 · answer #5 · answered by Pandora 5 · 0 0

fedest.com, questions and answers