The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP to MySQL Question

Discussion in 'Database Discussions' started by gopkris2005, Mar 3, 2010.

  1. gopkris2005

    gopkris2005 Well-Known Member

    Joined:
    Jan 9, 2007
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    INDIA
    cPanel Access Level:
    Root Administrator
    Twitter:
    Is it possible to set to display only access one table within a MySQL database? If so what is the tag?

    This is what I am looking at:

    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_conn = "localhost";
    $database_conn = "DBname";
    $username_conn = "DBuser";
    $password_conn = "DBPass";
    $conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or die(mysql_error());
    ?>


    I would like to reference only one table in the database.. Is there a way to do that?

    Thank You.
     
  2. asent

    asent Active Member

    Joined:
    Apr 5, 2005
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Be careful with mysql_pconnect, especially if it's a busy site or you have other busy sites on the server. I'd recommend mysql_connect or better yet if you're running php5 and mysql => 4.1, i'd use the mysqli extension instead.

    As far as the table, a simple "SELECT * from table"; or "UPDATE table..."; or "INSERT INTO table...", etc... would work. Only work on that one table. You can create a mysql user in phpmyadmin as root that has permissions on the db to only that one table and nothing else in the db if it's access permissions you're after.

    See: http://php.net/manual/en/function.mysql-query.php
     
    #2 asent, Mar 3, 2010
    Last edited: Mar 3, 2010
Loading...

Share This Page