Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

jacob weber
jacob weber
20,743 Points

Help with PHP pulling from a database.

I have a display page, pulling from a MySQL database with PHP, I can get everything to work right, I just want a different variable in the URL. I want it to be the text from the variable 'name' and can't seem to figure out what to update. Any help is great!

public function __construct($rid, $table) {
    /* Connect to Database */
    require('dbinfo.php');
    //$table=$this->table;  // Choose Recipe Table Optional
    $link = mysql_connect($databaseip,$username,$password);
    mysql_select_db($database,$link);
    $query = "SELECT * FROM $table WHERE rid=$rid";
    $result=mysql_query($query);
    $this->result = $result;
    mysql_close($link);