Trouble with WHERE clause (using PHP)

Discussion in 'MySQL' started by PatMcCrackit, Mar 16, 2010.

  1. #1
    I have a database with three columns: ID, UniqueID, FileName. I am trying to extract the FileName based on the UniqueID and then print it to the screen. This is what I have:

    
    ShowRandomPic();
    
    function ShowRandomPic(){
    	$con = mysql_connect("localhost", "DB_User", "Password");
    	if (!$con)
      	{
      		die('Could not connect: ' . mysql_error());
     	}
    	$DB = "DataBase";
    	mysql_select_db($DB) or die(mysql_error());
    	$result = mysql_query("SELECT * FROM table WHERE UniqueID = 'nCSoHUaDMz'");
    	$row = mysql_fetch_assoc($result);
    	$filename = $row['FileName'];
    	echo $filename;
    }
    
    Code (markup):
    When the page is loaded the screen is just blank.
    I cannot for the life of me figure out what I am doing wrong. Any ideas?

    Thanks a lot,
    Pat
     
    PatMcCrackit, Mar 16, 2010 IP
  2. PatMcCrackit

    PatMcCrackit Peon

    Messages:
    109
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    wow guys... sorry, I made a ridiculous mistake. My opening tag was "<PHP?" instead of "<?PHP"


    Problem SOLVED.
     
    PatMcCrackit, Mar 16, 2010 IP