List:General Discussion« Previous MessageNext Message »
From:Sommai Fongnamthip Date:June 6 2001 5:50am
Subject:RE: Need help on mysql/php
View as plain text  
split code for use username and password to connect to MySQL into other 
file and use include in every php program instead have username and 
password code.

connect.inc.php
<?
// define database connect variable
$hostname = "localhost";
$username = "root";
$password = "password";
$tblname = "yourtablename";
$dbName = "yourdbname";
MYSQL_CONNECT($hostname, $username, $password)
         OR DIE("Unable to connect to database");
@mysql_select_db("$dbName")
         or die("Unable to select database");
print "Succesful connect...";
?>

readfile.php
<?
include ("connect.inc.php");
...
other php code
...
?>

Regards,
Sommai Fongnamthip

At 22:37 5/6/2001 +0100, Jorge Oliveira wrote:
>Hi again,
>
>You are right, your username and password will have to be on every PHP
>script that needs to use database.
>
>However, you don't have to be afraid because nobody can access the source of
>your PHP scripts - unless they are a good hacker!
>
>I think you should pay a visit to http://www.php.net to understand how PHP
>works. Start with the basics and you will see that is reallY VERY simple.
>
>Be cool,
>
>
>Jorge Oliveira
>admin@stripped
>
>----------------------------------------
>© webfroggie.com - Recursos Online!
>web: http://www.webfroggie.com
>wap: http://www.webfroggie.com
>
>
>
>
>
>-----Mensagem original-----
>De: Ed Peddycoart [mailto:epeddycoart@stripped]
>Enviada: Quarta-feira, 6 de Junho de 2001 0:29
>Para: Jorge Oliveira; Mysql@Lists. Mysql. Com
>Assunto: RE: Need help on mysql/php
>
>
>Thanks...this helped...Just had success in connecting to the MySQL server
>and dumping the db contents to the screen....One worrisome bit though...My
>username and password for connecting to the db on my host is my username and
>password for the web account.  If I want to create dynamic webpages by
>pulling data from my db, won't I have to put this information (usersname and
>pw) in the php file and leave it on the server?  Sounds pretty darn scary to
>me...maybe I am confused.
>Ed
>
>-----Original Message-----
>From: Jorge Oliveira [mailto:admin@stripped]
>Sent: Tuesday, June 05, 2001 12:47 PM
>To: Mysql@Lists. Mysql. Com
>Subject: RE: Need help on mysql/php
>
>
>Hi,
>
>Please refer to http://www.php.net/manual/en/ref.mysql.php
>
>
>Jorge Oliveira
>admin@stripped <mailto:admin@stripped>
>
>--------------------------------------------------------
>© webfroggie.com - Recursos Online!
>web: http://www.webfroggie.com
>wap: http://www.webfroggie.com
>
>
>
>
>-----Mensagem original-----
>De: Ed Peddycoart [mailto:epeddycoart@stripped]
>Enviada: Terça-feira, 5 de Junho de 2001 21:31
>Para: mysql@stripped
>Assunto: Need help on mysql/php
>
>
>I recently move my website to FastWebServers.com.  MySQL and PHP is
>provided.  I have a control panel which allows me to initialize MySQL for my
>use.  The initialization creates a db, named celticblues_com (my domain is
>celticblues.com).  So far, I have added a table to my database, and added
>the neccessary fields.  Now I am at a total loss at what to do.  I want to
>use PHP scripts to pull info from the db and search the db etc.  I have
>contacted my support from FWS, but they point me to MySQL.com for "Mysql
>commands technical support".  Seems to me I would need to know how to set
>username/password to access the db from script etc.   The bottom line
>question is can someone point me to information on what I need to do to be
>able to access(open/close) the db, retrieve/store information, etc. in this
>type of environment (i.e. MySQL provide by my host service, not installed by
>me....)?
>Ed
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread75563@stripped>
>To unsubscribe, e-mail
><mysql-unsubscribe-admin=webfroggie.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread75574@stripped>
>To unsubscribe, e-mail
><mysql-unsubscribe-epeddycoart=cg2.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread75606@stripped>
>To unsubscribe, e-mail 
><mysql-unsubscribe-sommai=thaithanakit.co.th@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Thread
Need help on mysql/phpEd Peddycoart5 Jun
  • RE: Need help on mysql/phpJorge Oliveira5 Jun
    • RE: Need help on mysql/phpEd Peddycoart5 Jun
      • RE: Need help on mysql/phpJorge Oliveira5 Jun
        • RE: Need help on mysql/phpPaul DuBois6 Jun
          • RE: Need help on mysql/phpEd Peddycoart6 Jun
            • RE: Need help on mysql/phpPaul DuBois6 Jun
          • RE: Need help on mysql/phpKenneth Kopelson6 Jun
            • RE: Need help on mysql/phpPaul DuBois6 Jun
        • RE: Need help on mysql/phpSommai Fongnamthip6 Jun
      • RE: Need help on mysql/phpDon Read6 Jun
        • RE: Need help on mysql/phpPaul DuBois6 Jun
        • RE: Need help on mysql/phpNeil Zanella6 Jun
  • Re: Need help on mysql/phpB. van Ouwerkerk5 Jun
  • Re: Need help on mysql/phpOlexandr Vynnychenko5 Jun
RE: Need help on mysql/phpJorge Oliveira6 Jun
  • RE: Need help on mysql/phpEd Peddycoart6 Jun
RE: Need help on mysql/phpIan Ford7 Jun
  • RE: Need help on mysql/phpNeil Zanella7 Jun
  • RE: Need help on mysql/phpAdrian D'Costa7 Jun
    • RE: Need help on mysql/phpPaul DuBois7 Jun