Hi I need to represent data from my mysql table into a graphical format. I summed all the columns I needed then I need to represent the addition of each individual column onto a graph, but I want to print the correct data onto my screen first then represent the data onto a graph using jpgraph.

here's my code

$user = "root";
$pass = "";
$db = "liwc";
$link = mysql_connect( "localhost", $user, $pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );

mysql_select_db( $db )
or die ( "Couldn't open $db: ".mysql_error() );

$result = mysql_query("SELECT SUM(funct) AS funct,SUM(pronoun) AS pronoun, SUM(ppron) AS ppron, SUM(i) AS i, SUM(we) AS we, SUM(you) AS you, SUM(shehe) AS shehe, SUM(they) AS they, SUM(ipron) AS ipron, SUM(ARTICLE) as article, SUM(verb) AS verb, SUM(auxverb) AS auxverb, SUM(past) AS past, SUM(present) AS present, SUM(future) AS future, SUM(adverb) AS adverb, SUM(preps) AS preps, SUM(conj) AS conj, SUM(negate) AS negate, SUM(quant) AS quant, SUM(number) AS number, SUM(swear) AS swear, SUM(social) AS social, SUM(family) AS family, SUM(friend) AS friend, SUM(humans) AS humans, SUM(affect) AS affect, SUM(posemo) AS posemo, SUM(negemo) AS negemo, SUM(anx) AS anx, SUM(anger) AS anger, SUM(sad) AS sad, SUM(cogmech) AS cogmech, SUM(insight) AS insight, SUM(cause) AS cause, SUM(discrep) AS discrep, SUM(tentat) AS tentat, SUM(certain) AS certain, SUM(inhib) AS inhib, SUM(incl) AS incl, SUM(excl) AS excl, SUM(percept) AS percept, SUM(see) AS see, SUM(hear) AS hear, SUM(feel) AS feel, SUM(bio) AS bio, SUM(body) AS body, SUM(health) AS health, SUM(sexual) AS sexual, SUM(ingest) AS ingest, SUM(relativ) AS relativ, SUM(motion) AS motion, SUM(space) AS space, SUM(time) AS time, SUM(work) AS work, SUM(achieve) AS achieve, SUM(leisure) AS leisure, SUM(home) AS home, SUM(money) AS money, SUM(relig) AS relig, SUM(death) AS death, SUM(assent) AS assent, SUM(nonfl) AS nonfl, SUM(filler) AS filler FROM postliwc");

$row = mysql_fetch_assoc($result);

echo '<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row.'<br/>' . $row;

I want to print the data from my query using a single variable unlike what i did by echoing each column separately. It would be easier to represent the data onto jpgraph by using a single variable unlike my method.

Your help will be highly appreciated

$row is an array, which is your single variable. Am not sure what jpgraph expects, can you show part of that ? (Please use code tags for readability.)

Okay pritaeas, I see what you mean I guess that was a stupid question I asked. Blonde moment!!!, I just saw the code for Jpgraph and it displays data according to your array and here's its snip code

$data = array(55,80,46,71,95);

Now all I have to do is replace this data with my $row arrays. Thank you very much pritaeas I really appreciate it.