Slack3r Posted April 9, 2010 Share Posted April 9, 2010 Hey, I'm trying to create a SQL statement that reads paths from a table, for example... Path ------- /home /register /links So I have inside of this table page title, page description, and other information I need to for the web page. I use the following SQL query to pull the information I need... $query = "SELECT * FROM paths WHERE path = '" . PageURL() . "' LIMIT 1"; My issues comes in when I want to pass a random variable from the register page to another page by use of a form. So for example, /register might go to /register_x8u7vb I have this rule in my .htaccess, which works just fine. rewriteRule ^register_([^./]+)$ /index.php?page=register_check&var=$1 But my problem is, once it does that, because there is no /register_x8u7vb path is my paths table, none of the required header information I need is pulled from that table and used. I get no title, description, keywords, and etc. So I tried this: $query = "SELECT * FROM `paths` WHERE CONCAT(path, '%') LIKE '" . PageURL . "' ORDER BY length(path) DESC LIMIT 1"; And when I am on the page /register_x8u7vb it does not recognize /register% LIKE /register_x8u7vb So... any ideas? Link to comment https://forums.phpfreaks.com/topic/198170-sql-concat-need-help/ Share on other sites More sharing options...
andrewgauger Posted April 11, 2010 Share Posted April 11, 2010 try reversing the order: WHERE " . PageURL . " LIKE CONCAT(path, '%') Link to comment https://forums.phpfreaks.com/topic/198170-sql-concat-need-help/#findComment-1039841 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.