Hi all, I need some assistance if possible. I have an online radio station and I have a script tht serches my song database. I want to get it to where if someone types in a letter such as “A” it will only display artists that start with “A” and if the type in B, C, D, E it will only display the artists of those letters, The way it is now if you type in any letter it will display all artists from A-Z, I don’t want it to do this, I want it to do what I explained above here is my current code dould someone tell me how to change/modify it to do what I explained above? Thanks in advance
[code]
<?php $servername = "localhost"; $username = "alloldie_samdb"; $password = "********"; $dbname = "alloldie_samdb"; echo "Artist Quick Search"; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT DISTINCT artist FROM songlist ORDER BY artist"); $stmt->execute(); // set the resulting array to associative $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); foreach($stmt->fetchAll() as $k=>$v) { //echo $v[] = $v; echo "".implode($v).""; //echo $data[] = $v; } } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } $conn = null; echo ""; ?>[/code]