Trying to do some simple PHP coding to start on my project. I am trying to get database info by the url entered, but when i type the valid test url, it returns nothing. It outputs as:
ID: DISCUSSION NAME:
And right next to those, they should have the value from the database. But they don't. So can anyone help me?
$getdata = mysql_query("SELECT * FROM discussions WHERE urlname ='" . $_SERVER["REQUEST_URI"] . "'") or die(mysql_error());
while ($info = mysql_fetch_array( $getdata ));
{
Print "<tr>";
Print "<th>ID: </th> <td>".$info['id'] . "</td> ";
Print "<th>DISCUSSION NAME:</th> <td>".$info['discussion'] . "</td> ";
}
MY DATABASE INFO: https://i.sstatic.net/b89I8.png

$_SERVER["REQUEST_URI"]have a trailing slash? Also, this is a huge security hole :) Try using mysql_real_escape_string() around your server callurlnamefield is just/test1instead of/test1/. Try editing it to that and see if it works. Either that or...WHERE urlname ='" . $_SERVER["REQUEST_URI"] . "/...'