fatihshen Posted June 16, 2009 Share Posted June 16, 2009 Hi, I came across a strange problem. whenevery I use this query: $query = "SELECT pkEmbedID,Name,fkEmbedType,EmbedUrl,Description from tblEmbed $result = executeQuery($query); it works. but if I use $query = "SELECT tblEmbed.pkEmbedID AS pkEmbedID,tblEmbed.Name AS Name,tblEmbed.fkEmbedType AS fkEmbedType,tblEmbed.EmbedUrl AS EmbedUrl,tblEmbed.Description AS Description FROM tblEmbed INNER JOIN tblEmbedTag ON tblEmbedTag.fkEmbedID=tblEmbed.pkEmbedID INNER JOIN tblTag ON tblTag.pkTagID=tblEmbedTag.fkTagID $result = executeQuery($query); It doesn't work. I don't get a valid result. I would appriciate for any help. Below you can find the function executeQuery() . ..... function executeQuery($query) { $dbhost = ........ $dbuser = ........... $dbpass = ........... $dbname = ........... $conn = mysql_connect($dbhost, $dbuser,$dbpass) or die('Error connecting to mysql'); mysql_select_db($dbname) or die(mysql_error()); $result = mysql_query( $query ); closeDb(); return $result; } Fatih Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted June 16, 2009 Share Posted June 16, 2009 First off close the quotes on the $query. The query is too busy for my head right now Quote Link to comment Share on other sites More sharing options...
fatihshen Posted June 16, 2009 Author Share Posted June 16, 2009 both queries work in phpMyAdmin sql window. I figured out where the problem is but cannot still solve it. This is the second query: SELECT tblEmbed.pkEmbedID AS pkEmbedID,tblEmbed.Name AS Name,tblEmbed.fkEmbedType AS fkEmbedType,tblEmbed.EmbedUrl AS EmbedUrl,tblEmbed.Description AS Description FROM tblEmbed INNER JOIN tblEmbedTag ON tblEmbedTag.fkEmbedID=tblEmbed.pkEmbedID INNER JOIN tblTag ON tblTag.pkTagID=tblEmbedTag.fkTagID WHERE tblEmbed.fkEmbedType=1 AND tblEmbedTag.fkTagID IN(24) here, AND tblEmbedTag.fkTagID IN(24) doesn't work . I don't know still the reason. It works in phpMyAdmin sql window but I cannot run using php codes. Fatih Quote Link to comment Share on other sites More sharing options...
cunoodle2 Posted June 16, 2009 Share Posted June 16, 2009 I'm sure it's a formatting issue with quotes and/or something along those lines. 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.