MySql variables and php -


I am getting an error with php in order to format mysql_query () in php to format this string What is the right way?

  SELECT SELECT SELECT (*) Agents @AgentCount; User_Agent_English, User_Angent_Oursal, US.___Gent_Aginal, COUNT (User_Agent_Percade) ACC, COUNT (*) / (AgentCount) Percentage by agents user_agent_preser order DEC limit limit 50;  

In PHP, how am i setting $ query

  $ query = "SELECT count (*) agents @ agentcount; SELECT user_agent_parsed, User_agent_original , COUNT (user_agent_parsed) ascount, COUNT (*) / (@AgentCount) as a percentage by user_agent_parced by URI date DESC limit 50 ";  

This exact query will work properly if I put it in MySQL directly through a command line session. Do I need to release two separate php calls from mysql_query () and store the results first?

I get the following error:

There is an error in your SQL syntax;

Instead of using a sub-selection and instead of using the 'SELECT user_agent_parsed, user_agent_original, near your right syntax, use your MySQL server version as COUNT (user_agent_parsed) Check the manual that matches the selection of a MySQL variable to avoid counting (count) on every percent count, although it may be possible that the engine is optimizing for that. So far, I am not able to confirm it. I have also heard that sub selections are not always nearly optimal.

Expand me tells this:

 id select_type table type possible_keys key key_len referee lines additional 1 primary agents index zero user_gent_presseed 28 NULL 82900 temporary use; Select the faucet faucet faucet faucet faucet faucet using Phylact 2 SQL, the table has been optimized 

Only one query can be found in PHP at one time.

  $ query1 = "Selection Number (*) Agent @AgentCount" $ query2 = "select user_agent_parsed, user_agent_original, COUNT (user_agent_parsed) ascount, COUNT (*) / (Agent count) AS percent Number of user_agent_parsed orders by agent group from DESC limit 50 ";  

UPDATE

I have put one in which all my curries are included. I have a specific task in my DAL like this Looks like:

  // These functions re-usable public functions getAllRows ($ table) {$ sql = "SELECT * FROM $ table"; $ This- & gt; Query ($ SQL); Return $ $-> Query_salt; }  

I have the following in my BLL (Business Layer):

  public function getUserAgents () {$ result = parent :: getAllRows (); $ Line = mysql_fetch_array ($ result); $ Line return [0]; // gets the first row // then you accept it and on the second request. Then reply / return lines)  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -