0

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);
?>

Edited by __avd: Added [code] tags.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by jkon
0

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>";

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.