AJLX Posted January 7, 2014 Share Posted January 7, 2014 Hello Guys, I have a system that generate project numbers. The system is: YEAR - PROJECT NUMBER . Sub ID 2014.1065.02 I want to be able to search my database for the sub ID's belonging to a project. I have tried using wildcards, but they don't seem to do what I want. Could you please tell me where I'm going wrong? $project_id = $_SESSION['PROJECT']; $project_id_trim = substr($project_id, 0,-3); $trim = mysql_real_escape_string($project_id_trim); echo $trim; $result = mysql_query("SELECT * FROM `Project_subhire` WHERE `Subhire_id` LIKE '%$trim%'"); while ($row = mysql_fetch_array($result)) { $project_results = $row['Project_id']; } Thanks Quote Link to comment Share on other sites More sharing options...
Solution ginerjm Posted January 7, 2014 Solution Share Posted January 7, 2014 How do you know it's not working? You don't output anything. 1- Remove the leading % sign in your like argument. 2 - I'm assuming that 'subhire_id' looks like "2014.1065.nn" ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.