Jump to content

Simple php table call


lightnorth

Recommended Posts

Hello everyone,

 

Sorry to waste your time, but I am in fact a N00B and I am just looking for a quick fix on this which should be simple (I hope)

 

 

Background:

 

Organizations create a page with info

Students Create a page with info...when they create the page they see a list of Orgs to be in (Already working) and then they put in their personal info.

In the view, they see the Org Name plus their personal information

 

 

What I need:

 

Depending on the org that they chose, I want their page to display their organizations description on their page (AKA calling the description field from the org table along with the other data from the student table)

 

Here is the sql:

 

CREATE TABLE fundraising_org (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL UNIQUE, cause TEXT NOT NULL, description TEXT NOT NULL, expires_at DATETIME NOT NULL, contact_name VARCHAR(255) NOT NULL, contact_email VARCHAR(255) NOT NULL, contact_phone VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, picture VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, created_at DATETIME, updated_at DATETIME, PRIMARY KEY(id)) ENGINE = INNODB;

 

CREATE TABLE fundraising_student (id BIGINT AUTO_INCREMENT, org_id BIGINT NOT NULL, type VARCHAR(255), name VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, picture VARCHAR(255), email VARCHAR(255), token VARCHAR(255) NOT NULL UNIQUE, personal_statement TEXT NOT NULL, org_cause TEXT NOT NULL, org_description TEXT NOT NULL, created_at DATETIME, updated_at DATETIME, INDEX org_id_idx (org_id), PRIMARY KEY(id)) ENGINE = INNODB;

 

ALTER TABLE fundraising_student ADD FOREIGN KEY (org_id) REFERENCES fundraising_org(id);

 

---------------------=================--------------------

 

Here is the PHP View:

 

    <?php foreach ($fundraising_student_list as $fundraising_student): ?>

   

 

    <tr>

      <td><a href="<?php echo url_for('student/show?id='.$fundraising_student['id']) ?>"><?php echo $fundraising_student->getid() ?></a></td>

      <td><?php echo $fundraising_student->getorg_id() ?></td>

      <td><?php echo $fundraising_student->gettype() ?></td>

      <td><?php echo $fundraising_student->getname() ?></td>

      <td><?php echo $fundraising_student->getpassword() ?></td>

      <td><?php echo $fundraising_student->getpicture() ?></td>

      <td><?php echo $fundraising_student->getemail() ?></td>

      <td><?php echo $fundraising_student->gettoken() ?></td>

      <td><?php echo $fundraising_student->getpersonal_statement() ?></td>

      <td><?php echo $fundraising_org_list->getcause() ?></td>

      <td><?php echo $fundraising_student->getorg_description() ?></td>

      <td><?php echo $fundraising_student->getcreated_at() ?></td>

      <td><?php echo $fundraising_student->getupdated_at() ?></td>

    </tr>

    <?php endforeach; ?>

 

 

 

I may be missing a file...if so, let me know.

 

Thanks for trying to help me out!

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/146336-simple-php-table-call/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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