Farelski Posted April 1, 2011 Share Posted April 1, 2011 For some reason when I run my script on the SQL side it works fine and i get the results that I want. However when I run it with mysql_query() it returns a false value instead of a resource. Any help would be greatttly appreciated!! Here's the piece of code. $query = " CREATE TEMPORARY TABLE temp (uid int(11)); INSERT INTO temp (uid) SELECT user_id FROM user_connections WHERE my_id='$user_id' AND pending='0' GROUP BY user_id; SELECT user_id as id, profile_picture as picture, CONCAT(first_name, ' ', last_name) as name FROM user_display_properties as udp JOIN temp ON temp.uid=udp.user_id; "; $r = mysql_query($query) or ( "Error " . mysql_error () ) ; Quote Link to comment https://forums.phpfreaks.com/topic/232371-temporary-tables-work-in-phpmyadmin-but-not-with-mysql_query/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 1, 2011 Share Posted April 1, 2011 mysql_query() can only execute ONE query statement at a time. Quote Link to comment https://forums.phpfreaks.com/topic/232371-temporary-tables-work-in-phpmyadmin-but-not-with-mysql_query/#findComment-1195375 Share on other sites More sharing options...
Farelski Posted April 1, 2011 Author Share Posted April 1, 2011 Well god damn, that would definitely be the reason now wouldn't it? It's like missing a semi-colon and then not seeing it for 2 hrs, that's the equivalent of what just happened to me. Thanks PFMaBiSmAd saved me!!!! Quote Link to comment https://forums.phpfreaks.com/topic/232371-temporary-tables-work-in-phpmyadmin-but-not-with-mysql_query/#findComment-1195378 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.