28rain Posted March 3, 2009 Share Posted March 3, 2009 There is definetly data in the table with the word jack in it. // Connect to MySQL mysql_connect("******", "*****", "*****") or die(mysql_error()); mysql_select_db("shop") or die(mysql_error()); $metod=$_POST['search']; // Insert a row of information into the table "example" $result = mysql_query ("(SELECT * FROM f_watch WHERE notes LIKE 'jack') UNION (SELECT * FROM m_watch WHERE notes LIKE 'solo') UNION (SELECT * FROM cufflinks WHERE notes LIKE 'jack')") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { When it searches for like '%' all the results are returned Thanks Link to comment https://forums.phpfreaks.com/topic/147773-solved-sql-query-not-returning-any-results/ Share on other sites More sharing options...
rhodesa Posted March 3, 2009 Share Posted March 3, 2009 you need the wildcards around jack: $result = mysql_query ("(SELECT * FROM f_watch WHERE notes LIKE '%jack%') UNION (SELECT * FROM m_watch WHERE notes LIKE '%solo%') UNION (SELECT * FROM cufflinks WHERE notes LIKE '%jack%')") Link to comment https://forums.phpfreaks.com/topic/147773-solved-sql-query-not-returning-any-results/#findComment-775682 Share on other sites More sharing options...
28rain Posted March 3, 2009 Author Share Posted March 3, 2009 OMG such an idiot i took those off whilst i was testing! Musta fixed the error some other way and not put the wildcads back on. Sorry and Thanks Link to comment https://forums.phpfreaks.com/topic/147773-solved-sql-query-not-returning-any-results/#findComment-775686 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.