php - I need to create a custom query using specific characters from database -


what have rather large database of flight numbers based on divisions. flight number entered following eg: ccc-noc001 number breaks down follows ccc airline code noc division code , 001 actual flight number.

now trying create filter select flight number schedule based on division code. clarify way flight numbers entered database in 2 fields first being code entered ccc , flight number noc001 etc.

so need if possible strip numbers end of flight number searched noc or 1 of other division codes there 9 separate divisions. , able filter queries if drop down list select noc flight numbers noc show in table.

ccc-noc001 ccc-noc002 .... can give me appreciated

$dbh = new pdo($dsn, $user, $password); $query = "select * [tablename] [columnname] '%noc%'"; $stmt = $dbh->prepare($query); $stmt->execute(); if ($stmt->rowcount() > 0) {      $resultset = $stmt->fetchall(pdo::fetch_assoc);    foreach ($resultset $row) {        $flight = $row['columnname'];        $flightnum = str_replace('ccc-noc', '', $flight);    } } 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -