Jump to content

Search the Community

Showing results for tags 'table dinamic'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello Friends ? Could anyone help me This is my name mysql database: lc_movimento | Id | data | description | value I'm using this code below is giving the error. could someone tell me what I doing wrong Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in <?php include"config.php"; //$pdo = new PDO("mysql:host=localhost;dbname=mrangelc_teste", "mrangelc_01", "kov6095" ); //$pdo = new PDO('pgsql:<conn-string>'); $query = mysql_query("select (('month',CURRENT_DATE) + CAST(FLOOR(s.idx / 5) || ' day' as interval))::DATE AS data, 'descricao' as descricao, CASE WHEN random() < 0.5 THEN ROUND(150 + (random()*100)::numeric,2) ELSE ROUND(150 + (random()*100)::numeric,2) * -1 END as valor from lc_movimento(1,24) as s(idx)"); $ultimaData = null; $acumulado = 0; $totalEntradaDia = 0; $totalSaidaDia = 0; echo '<table>'; while ($resultado = mysql_fetch_array($query)) { $date = DateTime::createFromFormat('Y-m-d', $row['data']); $key = $date->format('Ymd'); if($ultimaData !== null && $ultimaData != $key) { printf('<tr><td colspan="2">Entrada: %s, Saida: %s, Saldo dia: %s, Saldo acumulado: %s</td></tr>', number_format($totalEntradaDia,2,',','.'), number_format($totalSaidaDia,2,',','.'), number_format($totalEntradaDia + $totalSaidaDia,2,',','.'), number_format($acumulado,2,',','.') ); $totalSaidaDia = 0; $totalEntradaDia = 0; } $ultimaData = $key; printf('<tr><td>%s</td><td>%s</td><td>R$ %s</td></tr>', $date->format('d'), $row['descricao'], number_format($row['valor'],2,',','.') ); if($row['valor'] > 0) { $totalEntradaDia += $row['valor']; } else { $totalSaidaDia += $row['valor']; } $acumulado += $row['valor']; } echo '</table>'; printf('<tr><td colspan="2">Entrada: %s, Saida: %s, Saldo dia: %s, Saldo acumulado: %s</td></tr>', number_format($totalEntradaDia,2,',','.'), number_format($totalSaidaDia,2,',','.'), number_format($totalEntradaDia + $totalSaidaDia,2,',','.'), number_format($acumulado,2,',','.') ); Thanks to all
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.