close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Pretty URL with 2 variables

Thread began 9/18/2020 9:05 am by MagsW | Last modified 9/19/2020 2:15 pm by MagsW | 32 views | 7 replies

MagsW

That's fantastic thanks, it put me on the right path. I've amended it further because a few people had hyphenated surnames, so I changed the delimiter to an underscore. It now reads as follows:

RewriteRule ^people/([^_]*)_([^_]*)$ /people2?Name=$1&Surname=$2 [L]

which gives the following URL:

https://www.mydomain.co.uk/people/Name_Surname

I would like to take this one step further as some people have double-barrelled names with spaces, for example:

https://www.mydomain.co.uk/people/Leonardo_Da%20Vinci

should be

https://www.mydomain.co.uk/people/Leonardo_Da_Vinci

I used a str_replace in the URL on the results page like this:

a href="/people/<?php echo str_replace(“ “, ”_”, ($rsPractitioners->getColumnVal("Name"))); ?>_<?php echo str_replace( " ", "_", ($rsPractitioners->getColumnVal("Surname"))); ?>>"

However I can’t figure out how to alter the recordset on the details page to accommodate this.

<?php
$rsPractitioners = new WA_MySQLi_RS("rsPractitioners",$PowerCMSConnection_i,1);
$rsPractitioners->setQuery("SELECT * FROM practitioners WHERE practitioners.Name = ? AND practitioners.Surname = ?");
$rsPractitioners->bindParam("s", "".$_GET ['Name'] ."", "-1"); //ParamName
$rsPractitioners->bindParam("s", "".$_GET ['Surname'] ."", "-1"); //ParamSurname
$rsPractitioners->execute();
?>

I tried the following but it doesn’t work:

<?php
$rsPractitioners = new WA_MySQLi_RS("rsPractitioners",$PowerCMSConnection_i,1);
$rsPractitioners->setQuery("SELECT * FROM practitioners WHERE practitioners.Name = ? AND practitioners.Surname = ?");
$rsPractitioners->bindParam("s", "". str_replace(" ", "_", "$_GET ['Name']") ."", "-1"); //ParamName
$rsPractitioners->bindParam("s", "". str_replace(" ", "_", "$_GET ['Surname']") ."", "-1"); //ParamSurname
$rsPractitioners->execute();
?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...