Open Side Menu Go to the Top
Register
The POG Programmers Containment Thread The POG Programmers Containment Thread

09-23-2012 , 10:09 AM
Quote:
Originally Posted by Chips Ahoy
You can do all that with your SELECT.

SELECT personname, (SUM(col3) / SUM(col2)) AS calcname FROM table
GROUP BY personname;

So read on SQL.
ok great i think

what does 'so read on SQL' mean?
The POG Programmers Containment Thread Quote
09-23-2012 , 12:16 PM
If you're interested in doing more of this stuff I would highly recommend picking up a book on PHP/MySQL web development. Once you learn all the basics books stop being that useful but starting out having a big old tome that actually explicitly covers all the basic stuff is super helpful. Hell I learned C from "C for dummies"!

he means go read about SQL
The POG Programmers Containment Thread Quote
09-23-2012 , 12:28 PM
Quote:
Originally Posted by well named
If you're interested in doing more of this stuff I would highly recommend picking up a book on PHP/MySQL web development. Once you learn all the basics books stop being that useful but starting out having a big old tome that actually explicitly covers all the basic stuff is super helpful. Hell I learned C from "C for dummies"!

he means go read about SQL
im kinda in a weird spot right now. i have a handful of things i want to learn/do but dont have time for any of them really, let alone all of them. so i just try to figure out the coding stuff only as much as i need (which isnt much at all).
The POG Programmers Containment Thread Quote
09-23-2012 , 12:50 PM
i want you all to know, i just figured out and wrote my first if else line.
i mean, i used them in the past, but it was cut and paste stuff
this one was cut and paste too, but i figured out what i needed to do and figured the if else was the solution and then was able to put all the right stuff in the right places. shipping info from a radio button to another page and had to create a result depending on the result of the radio selection.
i dont even know if im describing it right, but im excited about it
The POG Programmers Containment Thread Quote
09-23-2012 , 02:51 PM
Quote:
Originally Posted by Chips Ahoy
You can do all that with your SELECT.

SELECT personname, (SUM(col3) / SUM(col2)) AS calcname FROM table
GROUP BY personname;

So read on SQL.
chips, im reading up on this now.
given this code:
[php]
// Get a specific result
$query = "SELECT * FROM table WHERE name <> ' ' ";


$result = mysql_query($query) or die(mysql_error());

// Print out the contents of each row
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "['".$row['name']."',".$row['number'].",".$row['number2']."],";
}[/php]


and assume i have multiple names and i want to have a name and a percentage for each name as we talked about.
so i do the query using select and the sum as you said. does that do it for all names or just one name?
like will the array become
name %
name %
name %

or just
name %

(the code above says number and number 2, i think thats wrong but im not at that point yet)
The POG Programmers Containment Thread Quote
09-23-2012 , 02:53 PM
looks like the code below is going to answer my question?[php]
<?php
// Make a MySQL Connection

$query = "SELECT type, SUM(price) FROM products GROUP BY type";

$result = mysql_query($query) or die(mysql_error());

// Print out result
while($row = mysql_fetch_array($result)){
echo "Total ". $row['type']. " = $". $row['SUM(price)'];
echo "<br />";
}
?>
[/php]
The POG Programmers Containment Thread Quote
09-23-2012 , 02:59 PM
SELECT type, SUM(price) as sum_price FROM products GROUP BY type

then in PHP it can be $row['sum_price']

which is easier to manage
The POG Programmers Containment Thread Quote
09-23-2012 , 03:02 PM
Quote:
Originally Posted by well named
SELECT type, SUM(price) as sum_price FROM products GROUP BY type

then in PHP it can be $row['sum_price']

which is easier to manage
easier to manage than what?
The POG Programmers Containment Thread Quote
09-23-2012 , 05:05 PM
i did it. its done
very crude still, but the basis is done
will announce in a new thread
im excited
The POG Programmers Containment Thread Quote
09-23-2012 , 06:30 PM
Quote:
Originally Posted by well named
If you're interested in doing more of this stuff I would highly recommend picking up a book on PHP/MySQL web development. Once you learn all the basics books stop being that useful but starting out having a big old tome that actually explicitly covers all the basic stuff is super helpful. Hell I learned C from "C for dummies"!

he means go read about SQL
I wonder if C for Dummies part 2 ever came out. I really wanted to read it.
The POG Programmers Containment Thread Quote
09-23-2012 , 06:31 PM
I worked with a guy who wrote a "for Dummies" books. He was ungodly smart.
The POG Programmers Containment Thread Quote
09-29-2012 , 09:19 PM
is python worth learning?
The POG Programmers Containment Thread Quote
09-29-2012 , 10:11 PM
yes

Do you know any other languages? Python is a nice one to start out with.
The POG Programmers Containment Thread Quote
09-29-2012 , 10:19 PM
Quote:
Originally Posted by Krayz
yes

Do you know any other languages? Python is a nice one to start out with.
i know a little php. very little. mostly i just look up code snippets and paste them in
The POG Programmers Containment Thread Quote
09-29-2012 , 10:24 PM
Python is awesome. Less "manly" than some other languages, but the code is so intuitive and so readable.
The POG Programmers Containment Thread Quote
09-29-2012 , 10:25 PM
Quote:
Originally Posted by Boo Radley
i know a little php. very little. mostly i just look up code snippets and paste them in
Extremely worth it then
The POG Programmers Containment Thread Quote
09-29-2012 , 10:26 PM
I can't write code without { }
The POG Programmers Containment Thread Quote
09-29-2012 , 10:32 PM
Quote:
Originally Posted by well named
I can't write code without { }
((lambda (arg) (display arg)) "lol @ u")
The POG Programmers Containment Thread Quote
09-29-2012 , 10:33 PM
yeah I can't write lisp

I've even tried

I think when I become enlightened I'll probably know lisp
The POG Programmers Containment Thread Quote
09-29-2012 , 10:33 PM
I can write C code in at least 5 languages though
The POG Programmers Containment Thread Quote
09-29-2012 , 10:46 PM
Quote:
Originally Posted by Wyman
Python is awesome. Less "manly" than some other languages, but the code is so intuitive and so readable.
You can't track hard posts in a soft programming language.
The POG Programmers Containment Thread Quote
09-29-2012 , 10:48 PM
INFINITE HEARTS
The POG Programmers Containment Thread Quote
09-30-2012 , 04:20 AM
oh god, my gas company (vectren) has a button I can press to get my password in plain text when logged in. Time to use a password I won't use for anything else, ever!
The POG Programmers Containment Thread Quote
10-03-2012 , 05:21 PM
Quote:
Originally Posted by Krayz
Extremely worth it then
What can I do with it? Anything good or am I only going to gain familiarity with coding so I can pick up better languages easier?
The POG Programmers Containment Thread Quote
10-03-2012 , 08:19 PM
What do you want to do with it?
The POG Programmers Containment Thread Quote

      
m