Re: First connection?

From: Date: Sun, 11 Feb 2001 22:01:33 +0000
Subject: Re: First connection?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39147@lists.php.net to get a copy of this message
Lonnie, Try something like this: create a file called db_connection_params.inc - I do this maintainability :) (change to match your specifics) <? $host="localhost"; $usr="username"; $pass="password"; $database="database_name"; ?> Here is a sample page with connection/query: <? $sql = "SELECT * from table WHERE field = something"; include("db_connect_params.inc"); $link_id = mysql_connect($host, $usr, $pass); //setup a connection handle mysql_select_db($database, $link_id); //select database catalog (schema, namespace, etc) $result = mysql_query($sql, $link_id); //return result set to php echo $result; ?> There are lot's of different ways to do this, check out the mysql functions: http://www.php.net/manual/en/ref.mysql.php HTH! regards, jaxon On 2/11/01 4:40 PM, "Info" <info@eprofitsys.com> wrote: > Hi, > > Fifteen years ago I did lots of Informix SQL on Unix -- including transaction > processing -- BUT I find there isn't a lot of immediate help from that > experience -- I tried using some webmonkey examples as "basic training" for > php with MySQL and got nowhere. > > I'm on Red Hat with Apache 1.3.9, PHP 4.02 and MySQL 3.22.32 > > Is there a good place to find typical PHP and MySQL code examples for that > configuration? > > My pages are "virtual" hosted and I have access to phpMyAdmin 2.0.5 which is a > menu access by my ISP. > > My php.ini is at /usr/local/lib > > I've built a very small database of five fields in database "eprofitsys" in > table "employees" and would like to connect to it within a .php file. So, > obviously, I am at ground zero. Anyone want to lift me up. > > Lonnie >

« previous php.general (#39147) next »