Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

PHP to MySQL Question

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

  1. gopkris2005

    gopkris2005 Well-Known Member

    Joined:
    Jan 9, 2007
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    156
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. asent

    asent Active Member

    Joined:
    Apr 5, 2005
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    156
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice