I have this variable that get from a POST command [passing thru the SESSION] --> $ark = 123456-78
I would like to keep eveything before "-" so 123456 to make my research.
I tought that using Subtring will work so i tried this :
This is my request :
$req = "SELECT COUNT(`Home`) FROM `users` WHERE `Home` LIKE('$ark')";
What I tried with no excpected results:
$req = "SELECT COUNT(`Home`) FROM `users` WHERE `Home` LIKE FLOOR('$ark')";
and
$req = "SELECT COUNT(`Home`) FROM `users` WHERE `Home` LIKE SUBSTRING('$ark',6)"
Any idea where I made a mistake ?
Edit: Finally I found the solution using SUBSTRING_INDEX()
$req = "SELECT COUNT(`Home`)FROM `users` WHERE `Home` LIKE SUBSTRING_INDEX('%$ark%','-','1')";
Thank you all for your help Rflow