Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.