I have this code which should search for pictured in mysql database, am not sure if it is working,
I want to get the images the user search for and post them in the html, can i do this?
Here is my code
<?php require('connect.php'); if(isset($_POST['submit'])){ if(isset($_GET['go'])){ if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){ $name=$_POST['name']; //connect to the database //-query the database table $sql="SELECT * FROM cards WHERE name LIKE '%$searchQuery'"; //-run the query against the mysql query function $result=mysql_query($sql); //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ $name = $row['name']; $id = $row['id']; } } else{ echo "<p>Please enter a search query</p>"; } } } ?>
imageas the name :) I will update my answer :)