Jump to content

Recommended Posts

hello all,

 

I am a bit stuck on this. I am trying to pull data from a mysql table to display on a web page and I want to separate the data by the "type" of item it is.

 

So my table consists of the following elements.

 

skillName

skillType

Fcost

Tcost

Rcost

Scost

prereq

 

now what I want to do is pull the data and put it all into an array called skills, then another arrays in it called type.

 

Simple enough on what I want to do but I can't figure it out so any hints on what to look at to try and set this up.  I'm not looking for someone to do the work just point me to the right area to find the info and figure it out.

 

Thanks for any help

 

 

 

try

<?php    
$sql = "SELECT skillName, skillType, Fcost, Tcost, Rcost, Scost, prereq
        FROM tablename";
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res))
{
    $skills[$row['skillName']][] = $row;
    $types[$row['skillType']][] = $row; 
} 
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.