[PHP] First connection?

2001-02-11 Thread Info

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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] First connection?

2001-02-11 Thread Jaxon

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" [EMAIL PROTECTED] 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
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]