PHP project question

Hello people!

I have a PHP project I need to do, and it’s quite urgent. I don’t have much experience in the field. If anyone would like to give me some pointers where to start, and maybe some things that I will find difficult down the road, I will be forever grateful to you, and you can even request a drawing of any (any!) kind of animal which I will draw in paintbrush.

The task is this:

Create a list for your favorite links online. Visitors to the page should be able to search for links by keywords. The results of the search should be “clickable”. You should be able to add and delete links (on a seperate page).

Description:
Create a system with PHP, HTML and by using a MySQL database to find links in your list. The database should include a table with a descriptive name of the link, the link itself and keywords. (Such as “New York Times”, “www.nytimes.com” and “news”). A user of your page should be able to search via a keyword or to list all links in the database. The results of a search should be shown as links together with the keywords and the links should be clickable. Also create another page where a user is able to add, delete, and edit links. It should also be possible to add (new) keywords. To show the working of the page, it should contain at least 10 links.

As said, any pointers or help, or even code that I could edit to suit my needs would be very very helpful!

Peace!

You need to sketch up a database, don’t worry about doing something wrong, just try and post it on here and someone will hopefully help out. The assignment says something about what you need

Create a system with PHP, HTML and by using a MySQL database to find links in your list. The database should include a table with a descriptive name of the link, the link itself and keywords. (Such as "New York Times", "www.nytimes.com" and "news")

I would continue with the last part of the assignment.

Also create another page where a user is able to add, delete, and edit links. It should also be possible to add (new) keywords. To show the working of the page, it should contain at least 10 links.

Then I would create the actual link list in a separate file

A user of your page should be able to search via a keyword or to list all links in the database. The results of a search should be shown as links together with the keywords and the links should be clickable.

this is really a great starting project actually.

you want to use pdo, not mysqli (imo) and NEVER php/mysql. note: you are using a mysql database with pdo, just not the php/mysql extension which is old and deprecated.
http://www.php.net/manual/en/book.pdo.php

create a table with four fields
1)ID (unique, automatic, incremented),
2)link
3)name
4)keywords

you should create an include page that connects to your database

[php]$db = new PDO(‘mysql:host=HOSTNAME;dbname=DBNAME;charset=utf8_general_ci’, ‘USERNAME’, ‘PASSWORD’);[/php]

as well as any other code that you find yourself using on EVERY page. you DON’T want to put code that echos or prints to the screen though. if you have that type that repeats consider making a header/footer/name.php and including that where necessary. that’s extremely good practice. try to NEVER reuse code, always include it. if you save that as include.php. then put:

[php]include(‘include.php’);[/php]
at the top of every page.

so you’ll want something like: include.php, index.php, aedit.php,

includes we went over, index as always is the main page, the bulk. it will include the search form, the search results, and the link list. aedit is the page where you will add/edit links/keywords.

you’ll want to create an if/else that determines whether you have submitted a search or not(if (empty($_POST/$_GET). if no search, it will show the search form and then the list below it. if search, you will search the database, return results, and print them with the search form instead of the entire list.

the add edit page you will want to list all links, and when clicking pass the unique id back to the page itself. after doing this, it will check the database and get all the existing information, and echo that info into the value of the form fields. that’s your edit. you will need the form created for that to work, which will make add work.

the most difficult part will be learning pdo, but it’s really not too difficult just don’t try to rush despite your urgency. try to understand and it shouldn’t take long.

Sponsor our Newsletter | Privacy Policy | Terms of Service