Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'associative arrays'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. I'm having a bit of a problem which I think I might know the solution, but I'm really struggling to know the correct syntax. If somebody could point me in the right direction I'd be very grateful. I've created an application where users can create projects, and within the projects there are 'outputs' and 'inputs'. All of which is stored in separate MySql tables. It works fine. I have now been asked to create an addition layer, a 'programme' layer, which sits above projects (ie there can be multiple projects within one programme). I think I have got my table normalisation correct, I created 2 tables, 'programmes' which stores programme id and name etc, and 'programmes_projects' which stores only the programme id and the project id. That seems to work ok. What I'm having trouble with, is displaying the results correctly. I need to retrieve information from 4 (actually 5) related MySql tables. Phew. I think I need to create an associative array and a foreach loop, but because of the number of tables and the relationships, I'm getting very confused. I'm not sure if I should be focussing on the sql statements, the php, or what. I tried using while loops, because that's what I know, but wasn't surprised that it didn't work. progId = $_GET['prog']; //get the individual projects from the linking db table $get_projects = "SELECT * FROM programmes_projects WHERE prog_id=$progId"; $run_projects = mysqli_query($conn, $get_projects); $i = 0; while($row_projects=mysqli_fetch_array($run_projects)){ $prog_proj_id = $row_projects['prog_proj_id']; $prog_id = $row_projects['prog_id']; $projectId = $row_projects['proj_id']; $i++; //attempting to collect project details from the outputs table $get_proj_details = "SELECT * FROM projects WHERE project_id=$projectId"; $fetch_projects = mysqli_query($conn, $get_proj_details); $i = 0; while($row_details=mysqli_fetch_array($fetch_projects)){ $proj_name = $row_details['project_name']; $proj_whatever = $row_details['date']; $i++; // project outputs $fetch_outputs = "SELECT * FROM projects_outputs WHERE project_id=$projectId"; $get_outputs = mysqli_query($conn, $fetch_outputs); $i = 0; while($row_outputs=mysqli_fetch_array($get_outputs)){ $out_id = $row_outputs['output_id']; $output_desc = $row_outputs['output_desc']; $i++; }}}?> Please could someone help?? Even if it's just a nudge in the right direction. Thank you very much.
  2. I probably have some kind of visual/spacial related learning disability. I know that a form sends data to the server where php processes it and outputs it to the browser. Words alone don't always work for me. I have to draw things as if I were trying to explain it to someone else. Some times that helps me to see that my logic simply doesn't compute. Thought I was good to go with arrays... $var = array('dog', 'cat', '2', 'blue'); $var now contains all the values in the array. But, in the book, the syntax (using post) is: $title = $_POST['title']; $name= $_POST['name']; $email= $_POST['email']; To this newb it appears that the array concept has been abandoned for a multi-variable "device". I realize it's my inability to grasp it. (Tried to post the drawing but got "that extension not allowed" with png, gif, jpg. Finally gave up and put in a link instead) My drawing shows what I think happens. (I like to think I--at least-- have that much right.) But it still seems clunky. Would like to get a grip on this and share with other seniors (dob: 12-7-45). http://chattanoogacentral1964.com/drawing.php
×
×
  • Create New...