Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2003
    Location
    texas
    Posts
    96
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Getting a variable from the URL

    How would you pull something from the URL...I am passing a variable to a url on one page from a link, that code is displayed below.
    Code:
    <a href="?display=indexPage"><img src="home2.gif" alt="Home" />
    when it goes to my other page...this error appears
    Sorry could not connect to the database SELECT command denied to user 'home'@'localhost' for table 'php'
    The get from my previous new page is below.
    Code:
    $_GET['display'];
    The code from my select statement is also listed below
    Code:
    if(!isset($display))
    {
    $display="indexPage.php";
    }
    
    $query="select * from $display";

    sorry for all of the code I figured that is the easiest way to do it.
    thanks
    bri

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Do you ever convert $_GET['display'] into $display? $display must be assigned with the value of $_GET['display'].

    Also, it sounds like from the error you got, you don't have correct permissions to access the db...

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •