Jump to content

SQL CONCAT() - Need Help!


Slack3r

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.