When I execute the script it returns no info just blanks:

First Name :
Last Name :
Email :


What is wrong with my script???

I have tried using the "while" function but I do not need it for what I am doing.

<?php
  require_once('connectvars.php');

  $search = $_GET['search'];

  //connect  to the database
  $dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

  $mydb=mysql_select_db(DB_NAME);

  //-query  the database table
  $query = "SELECT * FROM `info` WHERE `first_name` = '$search'";
    
  $data = mysql_query($query);
  $row = mysql_fetch_array($data);
  
  {
    echo "First Name :{$row['first_name']} <br>" .
         "Last Name : {$row['last_name']} <br>" .
         "Email : {$row['email']} <br><br>";
}
    
    mysql_close($dbc);
?>

What is connectvars.php ? … also you use an array inside a string …this is not a good or clean idea
• echo "First Name :{".$row."} <br>" .
• "Last Name : {".$row."} <br>" .
• "Email : {".$row."} <br><br>";

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.