Show only requested data in php and mysql

0

I have a database with a table called cantantes , with the structures:

   - nombre,
   - canciones,
   - no-albunes,
   - edad

But I want that on the page katy-perry.php only show me the data of the singer. That tell me the inserted data, only the requested data and that all the other inserted data that do not have to see are not shown.

    
asked by Flavio C. Siria 24.06.2017 в 03:07
source

2 answers

0

I'll make your day easier and less painful, here is an example of the code you could use.

$connection = new PDO("mysql:host=localhost; dbname=database", "admin", "12345");
$connection -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connection -> exec("SET CHARACTER SET utf8");

$stmt = $connection -> prepare("SELECT * FROM USER WHERE NOMBRE = :name");
$stmt -> bindParam(':name', $name);
$stmt -> execute();
$rows = $stmt -> fetchAll(PDO::FETCH_OBJ);
$stmt -> closeCursor();

echo $rows[0] -> NOMBRE;
echo $rows[0] -> CANCIONES;
echo $rows[0] -> NUM_ALBUNES;
echo $rows[0] -> EDAD;

$connection = null;
    
answered by 24.06.2017 в 21:11
-1

then you have to perform a search for friend id, that table should have an identifier for each "singer" and then with sql you use the condition WHERE id_cantante="the id of katy perry"

    
answered by 24.06.2017 в 03:26