Jump to content

alexguz79

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

alexguz79's Achievements

Member

Member (2/5)

0

Reputation

  1. Thaks for the tip... but AVG won't fix the problem 'cause i need to order the RESULT of two different columns divided. That value is not in MySql.
  2. Hey everybody, i'm building a website for the softball league i play in.... so far the website is pretty good... with all the stats and profiles.... i'm having a little problem with the ORDER of the leaders in the categories i have to calculate the result... for example... avg. is the result of the total hits divided by the total number of at bats... both numbers are coming from the database... the problem comes when i have to order the leaders from first to last... this is my php: $sql = "select profile_id, SUM(total_hits) AS hitstotal, SUM(ab) AS abtotal from batters WHERE year = '2010' GROUP BY profile_id"; $cons = mysql_query($sql); while ($result = mysql_fetch_array($cons)) { $sumaab = $resultad['abtotal']; $sumahits = $resultad['hitstotal']; $p_id = $resultad['profile_id']; $prom = round(($sumahits."") / ($sumaab.""),3); that gives me all the batting averages for the players. and here is my question: how can i order that $prom result from first to last?
  3. Hey everybody... i am creating a website for the softball league i play in... and i have the batting average display with this code: echo round(($totalhits."") / ($abs.""),3) that takes the total hits and the total at bats and give me the average... the 3 is to limit the result to 3 figures insted of all the numbers in case of 0.333333333 the thing is i want to eliminate the 0 at the left of the dot... so it displays .333 insted of 0.333 the other thing is i want to display the complete number in case it's a round one... .400 insted of .4 thanks
  4. Greetings!!! I know if i want the SUM of al the values in a row i jus do 'SELECT SUM(row) AS row_total FROM table' but how about if i want to substract the values? ex: 2-2-3-1-4 what should i use? thanks
  5. Hey... Hope you can help me on this one: I have a menu witch information is stored in a database, i can get the info to load the problem is insted of giving me a dropdown menu with 10 options, is giving me 10 dropdown menus with 1 option here's the code <label> <select name="players" id="players"> <option value="<?php $id; ?>"><?php echo $fname; ?> <?php echo $lname; ?></option> </select> </label>
  6. the ROUND worked ... it was so easy.. thanks
  7. Hey everybody... i have this peace of code that gime me an average between total_hits and atBats (i'm working a baseball league website) but the thing echo all the numbers after the decimal dot... i just want tree... ex: is giving me 0.666666666667 and i could use better .666 anyone knows how to get me there? here's the code: <? $sql5="select total_hits from bateadores_locales WHERE profile_id ='$id' && year = '2010'"; $cons5=mysql_query($sql5); while($resultado5=mysql_fetch_array($cons5)) $suma5+=$resultado5['total_hits']; ?><? $sql6="select ab from bateadores_locales WHERE profile_id ='$id' && year = '2010'"; $cons6=mysql_query($sql6); while($resultado6=mysql_fetch_array($cons6)) $suma6+=$resultado6['ab']; echo (($suma5."") / ($suma6."")) ?> thanks
  8. steveangelis not sure if i understand what your are saying... what am idoing wrong?
  9. Hey everybody... i have this problem: i have my comment system working in terms of adding and displaying the data... but there's this thing that everytime the page loads insert a new blank field in the database... here's the code... thank in advance <form action="<?=$PHP_SELF?>" method="post"> Nombre:<br /> <input type="text" name="name" id="name" /> <br /> Commentario:<br /> <input type="text" name="comment" id="comment" /> <br /> <input type="submit" value="Enviar" /></form> <?php mysql_connect("localhost", "root", "root") or die(mysql_error()); mysql_select_db("gallery") or die(mysql_error()); $id = $_GET['id']; $result2 = mysql_query("SELECT * FROM images_comments WHERE image_id = '$id' ORDER BY ID DESC"); $sql="INSERT INTO images_comments (id, image_id, name, comment) VALUES ('','$id','$_POST[name]','$_POST[comment]')"; !mysql_query($sql); ?>
  10. Greeting everyone... The issue is this... i have a php file that display data from mysql.. i want the source code of that page displayed in a textfield box so i can use that with a copy to clipboard button.. anyone can help?
  11. nop... same error.... i don't know whats happening.... i'm following this video tutorial and in the video seems to work perfectly at once.... but i get this everytime
×
×
  • 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.