Hello,
I have a database that is like this:
codeid INT
uniqueid VARCHAR
codeid relates to some code in another table
uniqueid relates to a unique string within a url.
What i was intending on doing was
remove "http://www.example.com/product/" and also remove "/" at the end, so i ended up with a unique id. Then do a select * where uniqueid = $id from MyTable. (and also do an inner left join to get the code from the code table, relating to codeid)
But... i've just realised a LOT of my urls are not all in the same fashion. Some are like
http://www.example.com/category/name-uniqueidhere.html
some are like
http://www.example.com/uniqueid-name.html
is there any fancy function or some code that will let me:
$showithere = strpos($uniqueid, $currenturl);
if ($showithere == true)
{
select all from codetable where codeid = $codeid....
etc...
}
hope this makes sense. anyone got any better ideas?
cheers
I have a database that is like this:
codeid INT
uniqueid VARCHAR
codeid relates to some code in another table
uniqueid relates to a unique string within a url.
What i was intending on doing was
remove "http://www.example.com/product/" and also remove "/" at the end, so i ended up with a unique id. Then do a select * where uniqueid = $id from MyTable. (and also do an inner left join to get the code from the code table, relating to codeid)
But... i've just realised a LOT of my urls are not all in the same fashion. Some are like
http://www.example.com/category/name-uniqueidhere.html
some are like
http://www.example.com/uniqueid-name.html
is there any fancy function or some code that will let me:
- get all uniqueids from the table,
- then scan through them and see if any match any part of the url
$showithere = strpos($uniqueid, $currenturl);
if ($showithere == true)
{
select all from codetable where codeid = $codeid....
etc...
}
hope this makes sense. anyone got any better ideas?
cheers