Home How to write a query to fetch 'Hello World' as 'Hello-World'
Reply: 0

How to write a query to fetch 'Hello World' as 'Hello-World'

user1013
1#
user1013 Published in June 18, 2018, 7:39 am

I'm a bit stuck here. I'm actually rewriting URL, All url who have single word seems to work fine but double word name is not working.

Here is my rewrite code

RewriteEngine on
RewriteRule ^cheap-flights-to-([A-Za-z0-9-]+)/?$ flight_details.php?dest=$1 [NC,L]

My MySQL Database have a table column dest_name with the values like for example "New York, Hong Kong, Kuala Lumpur etc."

Here is my Query

    $flights_query = mysql_query("SELECT * FROM `fares` WHERE `dest_name`='$to_dest' AND `dept_code`='$from_airport' AND `ticket_class`='Y/Y' AND `fare_type`='$flight_type' ORDER BY fare+tax limit 15");

    while($flights_fetch = mysql_fetch_array($flights_query)) {
        $fares = $flights_fetch['fare'] + $flights_fetch['tax'];
        $addpercent = ($fares * $percent) / 100;
        $final_fares = number_format($fares + $addpercent,2);
    }

When I output I add hyphen using PHP function... But it's not fetching data...

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.357756 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO