Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5971489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:31:24+00:00 2026-05-22T20:31:24+00:00

I don’t know a lot about MYSQL and am having trouble designing my database

  • 0

I don’t know a lot about MYSQL and am having trouble designing my database structure. I don’t understand all the information given to me online too much jargon expecting me to understand other terms and ideas and do not want to take a course for this one job so I hope this is simple enough.

I want to create a list of files on a page. There should be 4 fields:

  • Name – files title
  • Units – which of the select units this file applies to (example: 27 or X1 or 10), I want to be able to add multiple units to some files.
  • Typeof – What type of file it is (example: swf, pdf, url).
  • Project – What project the file was produced for (example: sexual health, information literacy)
  • Outcomes – This should be able to store the numbers 1-5 so one file may have (1,3 and 5)

The problem is how I want to use this data, I want to be able to first search through units and find a match say for unit 27, then I want to find each project in that unit and list the files within that project.

The problem is files may and should appear multiple times on the page because some files have multiple units but I cant think how to best do this, searching the index of a string seems messy.

To help visualise what I want here is an image of how the page will be structured: how the page will be structured http://biteof.com/example.bmp

Your help is much appreciated thanks.

What I have so far:

  name    text                       utf8_unicode_ci 
  typeof set('swf','fla','web','pdf') utf8_unicode_ci  No None                
  units text utf8_unicode_ci  No None                
  url text utf8_unicode_ci  No None                
  project set('sexual health','information literacy','experimental') utf8_unicode_ci  No None                
  outcomes text utf8_unicode_ci  No None                

@Nick:

<?php 
$query = "SELECT * FROM `repository` WHERE `units` = '27' LIMIT 0, 999 ";
$result=mysql_query($query) or die(mysql_error()) ;
$num = mysql_num_rows($result);

$i=0;
while ($i < $num) {

$name=mysql_result($result,$i,"name");
$filetype=mysql_result($result,$i,"typeof");
$project=mysql_result($result,$i,"project");
$units=mysql_result($result,$i,"units");
$url=mysql_result($result,$i,"url");

echo "File name: ".$name."<br>";
echo "Units: ".$units."<br>";
echo "In project: ".$project."<br>";
echo "Url: ".$url."<br>";

$i++;
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:31:25+00:00Added an answer on May 22, 2026 at 8:31 pm

    Solved 🙂

    I decided to make a new table for each unit because the file may be the same across units but the outcomes are different. the rest of my database I kept the same and used php to sort the probably horribly structured db… here is my code if your interested:

    <?php 
    $table = array("301","302","310","311","25","26","27","28","29","1","2","3","4","8","10","X1","X2");
    for ($a=0;$a<sizeof($table);$a++) {
    $query = "SELECT * FROM `$table[$a]`";
    $result=mysql_query($query) or die(mysql_error()) ;
    $num = mysql_num_rows($result);
    if ($num > 0) {
    include($_SERVER['DOCUMENT_ROOT']."/units_and_evidence/units/".$table[$a].".php");
    $projects = array();
    for ($b=0;$b<$num;$b++) {
    $project=mysql_result($result,$b,"project");
    array_push($projects, $project);
    }
    $unique_projects = array_unique($projects);
    for($c=0;$c<sizeof($unique_projects);$c++) {
    $project_string = ucfirst($unique_projects[$c]);
    print ('<div class="project"><h3>'.$project_string.'</h3>');
    for($d=0;$d<$num;$d++) {
    $name=mysql_result($result,$d,"name");
    $project=mysql_result($result,$d,"project");
    $typeof=mysql_result($result,$d,"typeof");
    $url=mysql_result($result,$d,"url");
    $outcomes=mysql_result($result,$d,"outcomes");
    if ($project == $unique_projects[$c]) {
    $outcomes_array= array();
    for ($e=0;$e<strlen($outcomes);$e++) {
    array_push($outcomes_array, $outcomes[$e]);
    }
    rsort($outcomes_array);
    if ($typeof == swf) {
    $proj = str_replace(' ', '', $project); 
    $file = str_replace(' ', '', $url); 
    print ('<li><a href="flashdelivery.php?proj='.urlencode($proj).'&file='.urlencode($file).'" class="'.$typeof.'selector">');
    }
    else {
    print ('<li><a href="'.$url.'" class="'.$typeof.'selector">');
    }
    for ($f=0;$f<sizeof($outcomes_array);$f++) {
      print ('<span class="n'.$outcomes_array[$f].'"></span>');
    }
    print ('&raquo; '.ucfirst($name).'</a></li>');
    }
    }
    print ('</div>');
    }
    print ("</ul>");
    }
    }
    include($_SERVER['DOCUMENT_ROOT']."/footer.php"); 
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't understand where the extra bits are coming from in this article about
I don't know if this is the right place to ask about that, but
I don't know when to add to a dataset a tableadapter or a query
I don’t think I’ve grokked currying yet. I understand what it does, and how
I don't know if anyone has seen this issue before but I'm just stumped.
I don't know how to ask this question properly. I think the title is
I don't know whether it's Android specific problem or eclipse related problem. My application
I don't know if this is possible, but it would simplify my calculations to
I don't know if the Title of this post makes sense, but here's a
I don't know why, I install Xcode 4.0.2 and I run debug on device

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.