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


Setting up a Database





NjRocket
Hi guys, once i make a database on my phpadmin, have the user name and password set up, what's next. I want to be able to have the database automatically update the news articles, and have a storage system where they can be archived or found on my site. I don't understand the following:
1) What is the coding for my database?
2) Where do I place the coding?
3) How do I update the database so that it automatically updates the site?

If anyone can answer these for me, that would be great, my site is www.sportsnightcap.com
LukeakaDanish
NjRocket wrote:
Hi guys, once i make a database on my phpadmin, have the user name and password set up, what's next. I want to be able to have the database automatically update the news articles, and have a storage system where they can be archived or found on my site. I don't understand the following:
1) What is the coding for my database?
2) Where do I place the coding?
3) How do I update the database so that it automatically updates the site?

If anyone can answer these for me, that would be great, my site is www.sportsnightcap.com


1: The coding for a MySQL database is called "SQL", funnily enough Smile - its VERy easy to learn, as you almost write what you want in plain english.

2: You place the coding inside a serverside script. An example of this would be php, where the syntax is:

Code:
mysql_query('query');


3: Once you've written your page, so that it gets the data from the database, you can either update the database through phpMyAdmin, or write a visual editor and then use that, or even ask me for a VERY SIMPLE visual editor i wrote some months ago and use that.


HOWEVER:

If you dont know php, or any other Server side language, you will have to learn AT LEAST the basics of one of these before you can use mySQL for anything. examples of SSL's are: PHP, Python, ASP, Ruby - out of which i suggest PHP, simply because its the most widely used, and therefor the one which is easiest to get help with.
purcebr
hey,

once you've got the mysql database structure set up the way you want it in phpmyadmin, create a new text file named *whatever*.php

Code:


<?php

$DBhost = "localhost";
$DBuser = "root";
$DBpass = "";
$DBName = "whatever you named the db";

mysql_connect($DBhost,$DBuser,$DBpass) or die(mysql_error());

@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$query = mysql_query('SELECT * FROM `your table`');
$result = mysql_result($query);
while($row=mysql_fetch_array($result)){
print $row['any column'];
}
?>


this should help,assuming you've got php installed.
NjRocket
ok that helps a little bit, just not sure how i apply my design i already have on my front page with the news so that it automatically updates. When you say php installed, you mean the database on phpadmin?
Related topics
WTF! A strange database just appeared lol
Help me with MySQL Account Maintenance and phpBB 2.0.15 :((
setting it up...
Connect to database that is a not localhost
Sports Database
Setting up a database
mysql database table structure
Database for (x,y) coordinates
WordPress Manual Setting
database not establish???
Database error during install of drupal
Need help With editing a mysql setting
Move database to different SQL server
somethings wrong on database
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.