Jump to content

Search the Community

Showing results for tags 'max'.

  • 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 3 results

  1. i have a problem with a script, the script read a file (csv) and stores the last value of each line in an array, then i calculate the maximun,minimun and average of the values in the array, but with big files the script give me an incorrect value for the maximun,minimun and average, with the file 8.csv the calculations are correct but with the file 1.csv the values are wrong, the only difference i see is that the file 1.csv is much larger than the other. Thanks for your help!!! This is the code: <?php $variable2=file("1.csv"); $i=0; foreach($variable2 as $var){ if($i==0){ $i++; }else{ $datos=explode(",",$var); $valor=$datos[count($datos)-1]; if($valor!= -3000){ $todos[$i-1]=$valor; $i++; } } } $promedio=array_sum($todos) / count($todos); $maximo=max($todos); $minimo=min($todos); echo "MAXIMO = ".$maximo." MINIMO = ".$minimo." PROMEDIO = ".$promedio; ?> And this is a part of the file 1.csv (the full file have more than 60.000 lines) OBJECTID,pointid,grid_code,potrero_ID,MOD13Q1.A2 7300.0,7300.0,1.0,1,6431 7498.0,7498.0,1.0,1,6684 7499.0,7499.0,1.0,1,6431 7500.0,7500.0,1.0,1,6431 7501.0,7501.0,1.0,1,6431 7502.0,7502.0,1.0,1,6431 7503.0,7503.0,1.0,1,6431 7504.0,7504.0,1.0,1,6304 7697.0,7697.0,1.0,1,6734 7698.0,7698.0,1.0,1,6734 7699.0,7699.0,1.0,1,6127 7700.0,7700.0,1.0,1,6127 Expected values: Maximun: 9307 Minimun: -650 Average: 6555,211347 Output values: Maximun: 999 Minimun: -104 Average: 6555,3296310272 If you want you can download the code and input files here: https://www.dropbox.com/s/y4vpjm6086rj3s3/script.zip Thanks.
  2. I thought I had this issue figured out last night with the help from this forum, but turns out it still isn't working as expected. I have two tables: Table: sapImport id invoiceNo invoicedAtID invoicedAtName soldOn soldBy customer 1 CICIN123 3 Cicero 1384832632 brian john smith 2 DESTIN12 5 Destiny 1384832632 brian Henry Will 3 VESTIN32 3 Cicero 1384832632 jason Peter Jenn Table: conStatus id store record statusCode 34 3 1 0 35 5 3 0 39 3 1 15 I do have more rows than this, but i'm just trying to give an idea ... I currently have the following query: SELECT * FROM sapImport si INNER JOIN conStatus cs ON si.id = cs.record INNER JOIN ( SELECT record, MAX(id) as id FROM conStatus GROUP BY record ) mx ON cs.record = mx.record AND cs.record = mx.id WHERE cs.store='$storeID' AND cs.statusCode < '998' Basically, the table sapImport contains customer information and the conStatus table contains all interactions with a record in the sapImport table. The 'id' row in sapImport is the primary key and is auto-incremented. The 'record' row in conStatus references the 'id' row from sapImport. I need a query that pulls the LAST record (from conStatus) for a particular customer (from sapImport) where the store=x and the statusCode is less than 998. I should only get ONE result set with this. Any help will be GREATLY appreciated! Thanks in advance!
  3. Hello, This is my PHP/MySQL code. $result = mysqli_query($con,"SELECT MAX(ID) FROM lessons"); while($row = mysqli_fetch_array($result)) { echo $row['ID']; } And yet, nothing is entered on the page. What am I doing wrong?
×
×
  • 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.