MySQL selection...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

MySQL selection...

Post by Todd_Z »

If i am selecting fields from a table, but for example, some are

index.php?pg=2334, some are index.php?pg=2334&PHPSESSID=WHATEVER

Code: Select all

$sql = "SELECT `Page`, COUNT(`Page`) FROM `Visitors` GROUP BY `Page`";
Returns each with their respective counts.
However, I want to be able to split off the PHPSESS so that equal pages with a phpsessid count as the same. Can i remove the phpsess in the sql string?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

MySql has a bunch of String functions.

http://dev.mysql.com/doc/mysql/en/string-functions.html

Check out the following:
SUBSTRING_INDEX
SUBSTRING
POSITION
Post Reply