Questions tagged as 'mysql'

1
answer

Show profit or loss in negative percentage

Considering the following data: $despesas = 2000; $receitas = 100; $lucroprejuizo = ($receitas - $despesas) / $receitas)*100; I have a result of: -1900% But if any of the variable revenue or expenditure is zero the calculation is wrong b...
asked by 07.03.2016 / 00:40
1
answer

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE [42000]'

I need to generate a schedule of a certain period, but it is giving this error.    Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE [42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; ('1...
asked by 04.03.2016 / 13:08
1
answer

Fine tuning in Ranking for a game system [closed]

I have a very crazy problem that has already burned my logic ability. Some time ago I asked a question almost the same as this one but they helped me a lot (thank you very much) but my need has changed and now I have another table and my quer...
asked by 23.02.2016 / 17:41
1
answer

How to display data from a foreign key table in my main table?

In PHP how do I appear instead of the foreign key id, appear the field that owns the data? My has the group table column id_grupo %% and column grupo_nome . I have the product table there is the products of the groups that signed up in...
asked by 17.06.2016 / 01:59
1
answer

MySQL Relationships: Query Problem

I have the following scenario I need to search all consulta_tipos with consulta_itens aligned and check the ones in cliente_consulta_tipo and cliente_consulta_itens , in addition I need to search the fornec...
asked by 04.02.2016 / 20:44
1
answer

Doubts Google Charts with Loop

Good morning,  I'm using a google chart to create a panel, but it's only bringing me one result so my loop is not working, could anyone help me see what's wrong? <?php include("conecta.php"); $consumo_atual = mysql_query("SELECT * FROM Ar...
asked by 31.03.2016 / 15:57
1
answer

What logic to make this select work?

How do I make this select display according to what is selected there from the 'Latest, Evaluation, Utility' options ?: Themostrecentwouldbethelastcommentsadded!Theevaluationwouldbethecommentthathadmorepositiveevaluationinstarsandwouldbelowerin...
asked by 17.01.2016 / 00:54
1
answer

UTF8 only works on mysql only or on page [duplicate]

In coon.php that serves as a connection to my database, if I add this code: mysql_query("SET NAMES 'utf8'"); mysql_query('SET character_set_connection=utf8'); mysql_query('SET character_set_client=utf8'); mysql_query('SET character_set_resul...
asked by 18.03.2016 / 21:09
1
answer

Select Union same table

Could anyone help me with this problem? The following query throws the following error:    # 1054 - Unknown column 'u.idocorrence' in 'where clause' SELECT DISTINCT * FROM( (SELECT o.*, u.nome AS requerente FROM ocorrencia o, util...
asked by 28.02.2016 / 00:34
1
answer

MySQL GROUP BY - Error in PHP

I have a query in MySQL that, in the command line and in MySQL Workbench, is bringing the correct values, but when executed in PHP, the GROUP BY function is grouping more than it should! Here is the query: SELECT DATE_FORMAT(ctg.d...
asked by 25.02.2016 / 19:17