MadCatter101
Programmer
I have a huge project in front of me and no clue as to how to begin it. I have a database set up properly (MySQL; PHPAdmin is a GODSEND...), and a page that submits data to the database.
I want to write a page of PHP that:
1) Connects to my database "aimfreak_writersright"
2) Brings up the items in table "stories"
3) Sorts these items by date, in descending order
4) DOESNT DISPLAY EVERY FIELD IN THE TABLE. The fields in that table so far are:
uid (a unique ID, int field, 8 chars long, autoincrease)
authorname (author's name, text field)
authoremail (authors email addy, text field)
title (title of work, text field)
date (text field, 10 characters long, formatted yyyy.mm.dd, i already have a page to submit items into the database)
story (longblob field that contains the story itself).
I want to have this page bring up the title, author, and date of the entry. But that's not all I need!
Where it spits back "Title", I want it to have a link to a separate PHP page (story.php) that displays the title, author, date, and contents of the story. Where it spits back "authorname", I want that also to be a link to a separate page (authors.php) that brings up the titles this author has written (with links to the separate stories), and their email address.
My problem?
I have no clue where to start. I have the code to connect to the database. What would I do to generate dynamic links like that? What code do I need to have for the other 2 pages, story.php and author.php? How do I get the data off the database? Right now I'm using the code
$select = "SELECT * FROM stories ORDER BY date DESC";
should that work? I've already made the code to connect to the database & table, that's not a problem. What's confusing is how to get the data spitted back by the database to generate links to the proper sites... would I have to do something like
<a href=" $title ?>><?= title ?></a>
to bring up the story by title, from the data pulled off the database? This project just seems large and daunting and confusing; any help that I could get would really be appreciated. Thanks a lot in advance!! --MadCatter--
I want to write a page of PHP that:
1) Connects to my database "aimfreak_writersright"
2) Brings up the items in table "stories"
3) Sorts these items by date, in descending order
4) DOESNT DISPLAY EVERY FIELD IN THE TABLE. The fields in that table so far are:
uid (a unique ID, int field, 8 chars long, autoincrease)
authorname (author's name, text field)
authoremail (authors email addy, text field)
title (title of work, text field)
date (text field, 10 characters long, formatted yyyy.mm.dd, i already have a page to submit items into the database)
story (longblob field that contains the story itself).
I want to have this page bring up the title, author, and date of the entry. But that's not all I need!
Where it spits back "Title", I want it to have a link to a separate PHP page (story.php) that displays the title, author, date, and contents of the story. Where it spits back "authorname", I want that also to be a link to a separate page (authors.php) that brings up the titles this author has written (with links to the separate stories), and their email address.
My problem?
I have no clue where to start. I have the code to connect to the database. What would I do to generate dynamic links like that? What code do I need to have for the other 2 pages, story.php and author.php? How do I get the data off the database? Right now I'm using the code
$select = "SELECT * FROM stories ORDER BY date DESC";
should that work? I've already made the code to connect to the database & table, that's not a problem. What's confusing is how to get the data spitted back by the database to generate links to the proper sites... would I have to do something like
<a href=" $title ?>><?= title ?></a>
to bring up the story by title, from the data pulled off the database? This project just seems large and daunting and confusing; any help that I could get would really be appreciated. Thanks a lot in advance!! --MadCatter--