PHP to MySQL Question

Discussion in 'PHP' started by gopkris2000, Mar 3, 2010.

  1. #1
    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.
     
    gopkris2000, Mar 3, 2010 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi,this is MySQL administration issue: setting user permissions only to this table.

    Regards :)
     
    koko5, Mar 3, 2010 IP
  3. jorgy

    jorgy Peon

    Messages:
    611
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    -- Are you asking if you can pull information from only one table in the entire database on a page?

    If so, yes. I recommend reading http://www.w3schools.com/php/php_mysql_select.asp for more information, w3schools does a pretty good job of explaining the process simply.

    If not, could you elaborate?
     
    jorgy, Mar 3, 2010 IP
  4. gopkris2000

    gopkris2000 Peon

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes jorgy,

    Thanks for your article.

    Its very helpful to me.
     
    gopkris2000, Mar 3, 2010 IP
  5. gopkris2000

    gopkris2000 Peon

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    How can we set permission only for particular table in database?
     
    gopkris2000, Mar 3, 2010 IP
  6. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #6
    You can do it via your hosting control panel or using query (click here) , specifying database.OnlySingleTableName.
     
    koko5, Mar 3, 2010 IP
  7. jorgy

    jorgy Peon

    Messages:
    611
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Do you mean how would you allow only certain users to modify a table, or view a table, something like this?

    If I was trying to do something like that I would use something looking like:
    
    if($user[value] = something) 
    {
    Display the table how users would be able to view or modify it
    }
    
    else
    {
    Display the table how everyone else should see it, or not see, however you see fit!
    }
    
    Code (markup):
    Hope that helps!
     
    jorgy, Mar 3, 2010 IP