Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

PHP Like Help

$
0
0

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


Viewing all articles
Browse latest Browse all 13200

Trending Articles