Reply to Re: Creating Mysql DB with PHP

Your name:

Reply:


Posted by Tony on 06/07/05 03:13

"MS" <nospamplaesegr8t_ukuk@yahoo.co.uk> wrote in message
news:d81sbd$5st$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
>
>
> My current DB is on my Linux Server, and I don't have access to any MYSQL
> directories.
> So I think what you are suggesting is not viable for me.
>
> would another possibility be to...
>
> create a PHP file to run SQL that would create the DB and all the tables.
> This I don't see a problem with.

You were also asking to duplicate data, though - and that could present a
problem, depending on how much data you're copying. If it's not too much,
you may be ok.

As for setting up the database & tables, that's pretty straightforward -
just use mysql_query() to send the appropriate queries to the database. In
fact, you should probably use that for creating the database, too, since
mysql_create_db is deprecated - it's better practice to get into.

> but how do you set the connection values...'mysql_user' & 'mysql_password'
> within php and relate this to the DB that is to be created.
>
> mysql_connect('localhost', 'mysql_user', 'mysql_password') ;


basically, you just set them either as strings in the command, or as string
variables. So for user="root" and password="rootpw":

mysql_connect('localhost',' root','rootpw');

or

$host = "localhost";
$user = "root";
$password = "rootpw";
<... any other code can be here if it doesn't change these variables ...>
mysql_connect($host,$user,$password);


You just have to be sure that the user & password you're using have been
entered into the database.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация