CREATE DEFINER=`lsgthedn`@`%` PROCEDURE `prueba`(
IN `palabraPel` VARCHAR(50)
)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
select * from pel_youtube where nom_pel_youtube LIKE CONCAT('%', palabraPel , '%') ORDER BY nom_pel_youtube;
END
Y luego para ejecutarlo desde el PHP:
$cnn = new mysqli("localhost", "xxxx", "xxx", "bd_edc");
$reg = mysqli_query($cnn, "CALL prueba('las s')");
while ($row = mysqli_fetch_assoc($reg)) {
echo $row["nom_pel_youtube"]."<br>";
}

No hay comentarios:
Publicar un comentario