ugrás a tartalomhoz

Vki csinálja meg nekem

Betti · 2002. Nov. 22. (P), 15.19
Én nem értek hozzá, de szükségem lenne rá a suliban. Ha vki elkészítené nekem és elküldené az e-mail címemre megköszönném.:)

Assignment #1

OK, I want you to make a web page. It should display all the records of a table. It's easy,

you can get most of the code from the tutorials. Printing the first record is easy. Then,

you can use a while loop, to automatically go through all the records in a table. (Check out

the end of the first tutorial on MySQL integration for an example.) Got that? Good. Now I'm

going to add a small twist; I want you to be able to use the URL to specify the table you

are displaying. An example: http://www.mycomputer/readdb.php?table=cookie. Let's say that

you have a php script named "readdb.php". In the script you have a variable named table. If

you use the URL above, it stores the value, "cookie" in the "table" variable. Really, its

that easy to assign a value to a variable. Handy huh? So just change the script a little to

use the table variable and then specify the table in the URL.

Once you're done with that page, I want you to use it in conjunction with assignment #2.

Assignment #2.
I want you to write another page that has a form that adds data to the database. You can

also copy most of the code for this from the tutorials. It should look a bit like this.

(hint: you can copy the HTML form from that example page). Now you should be able to put

records into the table with the second page and check to see if the data is there with the

first page. So as a final touch, add some links to each page to make it easy to go back and

forth between the pages. Good job, this will make you more popular.

Assignment #3.
OK, we're going to build on the last two projects and make a page that can do this (display

a whole table, or let you search for and display one record). To make the search page, just

use a SELECT statement (Use PHPmyAdmin to figure out exactly how to select one record). Also

use PHPmyAdmin to find the syntax for deleting records too. I know I'm not telling you very

much about this. I want you to try to figure it out on your own. But I'll also give you a

hint: remember how you can send variables inside a URL? well this is a great time to do

this. Look at the links for deleting, viewing an individual record, and viewing the whole

table. Notice the variables in the URL. So send these variables, you can use an if statement

to sent for the variable and act appropriately (i.e. on my page, if ($func == del) then

execute the SQL query that deletes the appropriate record).If you got the first two

assignments, than you should be able to get this.

Also, the drop-down menu that has all the names of the tables is created with a MYSQL

function. If you use it on your page, I'll give you extra credit. You can learn about it by

looking at PHP's list of MYSQL functions Good luck. Be strong. Ask me questions if you don't

understand.