dennismonsewicz Posted September 29, 2008 Share Posted September 29, 2008 I have this bit of code: $result = mysql_query("SELECT * FROM tbl_name WHERE project LIKE '%" . $project_name . "%'") or die(mysql_error()); $rows = mysql_num_rows($result); if ($rows > 0) { echo '<p>Here is a list of other projects that have similar Project Names:</p>'; while ($name = mysql_fetch_object($result)) { echo '<p><a href="tools.php?action=view&id=' . $name->id . '">' . $name->project . '</a></p>'; } } The above code is supposed to search through the DB when a new project is added and then spit out all project names that have the same or are like the same project that was added... well it is only spitting out the one you just inserted Anyone got any ideas? Link to comment https://forums.phpfreaks.com/topic/126314-solved-help/ Share on other sites More sharing options...
revraz Posted September 29, 2008 Share Posted September 29, 2008 Did you echo the query to see what it actually looks like? Link to comment https://forums.phpfreaks.com/topic/126314-solved-help/#findComment-653191 Share on other sites More sharing options...
dennismonsewicz Posted September 29, 2008 Author Share Posted September 29, 2008 this is what i got Resource id #7 Link to comment https://forums.phpfreaks.com/topic/126314-solved-help/#findComment-653196 Share on other sites More sharing options...
revraz Posted September 29, 2008 Share Posted September 29, 2008 That is the Result, not the query. $qry = "SELECT * FROM tbl_name WHERE project LIKE '%" . $project_name . "%'"; echo $qry; $result = mysql_query($qry) or die(mysql_error()); $rows = mysql_num_rows($result); Link to comment https://forums.phpfreaks.com/topic/126314-solved-help/#findComment-653204 Share on other sites More sharing options...
dennismonsewicz Posted September 29, 2008 Author Share Posted September 29, 2008 sorry i wasn't thinking... Here is what I got: SELECT * FROM tbl_name WHERE project LIKE '%text%' the name text, '%text%', is the test name i gave the project when I added it. Link to comment https://forums.phpfreaks.com/topic/126314-solved-help/#findComment-653214 Share on other sites More sharing options...
revraz Posted September 29, 2008 Share Posted September 29, 2008 echo $rows Link to comment https://forums.phpfreaks.com/topic/126314-solved-help/#findComment-653223 Share on other sites More sharing options...
dennismonsewicz Posted September 29, 2008 Author Share Posted September 29, 2008 well I am not sure why but its working now... Link to comment https://forums.phpfreaks.com/topic/126314-solved-help/#findComment-653228 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.