I'm trying to execute a query and show me the data.
<?php
$sql = "SELECT nombre FROM canciones WHERE idartistas = '$idartistas' ";
?>
I have that done in php and to show the data I do the following;
<p align="left">
<?php print $sql?>
</p>
When I open the page, it shows me the query and not the query data.
I have changed and put this but now it gives me this fault:
Warning: mysqli_query () expects at least 2 parameters, 1 given in C: \ xampp \ htdocs \ PaginaWebPBLlocal \ todoartista.php on line 88
Warning: mysqli_error () expects exactly 1 parameter, 0 given in C: \ xampp \ htdocs \ PaginaWebPBLlocal \ todoartista.php on line 88 Query failed:
$conexion = new mysqli("localhost", "root", "", "discografica");
if ($conexion->connect_errno) {
echo "Fallo al conectar a MySQL: (" . $conexion->connect_errno . ") " . $conexion->connect_error;
}
$query = "SELECT nombre FROM canciones WHERE idartistas = '$idartistas' ";
$result = mysqli_query($query) or die('Consulta fallida: ' . mysqli_error());
?>