I'm still learning php, but I've always wanted to know how to make install scripts for my stuff. Now that I have learned it, I will pass it on :)
Terms of Agreement:
By using this article, you agree to the following terms...
You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
You may link to this article from another website, but ONLY if it is not wrapped in a frame.
You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
Remember, before you judge my code.. keep in mind that IT IS INTENDED FOR NEWBS
;)
Before you just TRY this, make sure you have a mysql database/username/password
on hand.
It's quite easy really, here:
<?php
mysql_connect("localhost", "Mysql_Username", "password");
mysql_select_db("Mysql_database");
mysql_query("mysql information goes here");
?>
The
purpose of this is for the script to completely run without the need of an include.
As long as you know how to run queries for mysql, then youll get the hang of
this.
Here is
an example of a mysql query:
CREATE TABLE Tablename (
userid int(25) NOT NULL auto_increment,
first_name varchar(25) NOT NULL default '',
last_name varchar(25) NOT NULL default '',
) TYPE=MyISAM
That's not an install script, that is just an example how to query a database. (If this comment was disrespectful, please report it.)
5/29/2004 5:39:25 PM:
As Jon said this isn't a "install script", however it is a kinda good example for a person just starting to learn mysql/php so, well done. (If this comment was disrespectful, please report it.)
6/1/2004 8:21:00 AM:
I'm not try it yet, sorry I'll try later (If this comment was disrespectful, please report it.)
Well, the sample SQL given creates a table if inserted into the PHP code; maybe that is what he meant by 'install' (If this comment was disrespectful, please report it.)
Hey guys, wow I forgot all about this. basically, what I did with this was make an install.php and call the file. It installed the mysql for me automatically instead of having to go through phpmyadmin and doing it myself. (If this comment was disrespectful, please report it.)
This is pretty much an install script.... Just a very basic one... It creates a database that is to be used by his application.... Without this script, there would be no database for said application to use.... It makes it so you don't have to use phpMyAdmin to create your database/tables...
(If this comment was disrespectful, please report it.)
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)