Question: Need help combining two PHP files to product the following: PART3 i. Combine parts 1 and 2 to produce the following: ii. As you can

Need help combining two PHP files to product the following:

PART3

i. Combine parts 1 and 2 to produce the following:

Need help combining two PHP files to product the following: PART3 i.

ii. As you can see from the URL, the PHP file is named "printcollections.php".

iii. Artists file needs to be read into a table first, then go over the Arts list one by one and use "artistID" to search for "artistName".

iv. Please note that whenever an artist is changed the background color of that artist is also changed. Choose your own favorite color. Google "PHP predefined color" for a list of predefined colors.

Part 1

e01artists.txt

2 Ames

3 Aserty

4 Baron

7 Blain

8 Blum

9 Budd

12 Chico

14 Cox

16 Curtis

17 Dawson

19 Dill

22 Fratt

23 Garber

24 Garin

25 Giama

28 Guys

29 Hamend

32 Ibe

35 Irvin

38 Kritz

40 Long

43 Lutes

48 Metz

49 Miller

50 Mogan

52 Novarre

54 Ortega

55 Parker

56 Penn

59 Quiroz

60 Rath

Part 2

e01arts.txt

1042 Coffee on the Trail 2 7544

1013 Superstitions 3 78000

1021 Bead Wall 3 14000

1034 Beaver Pole Jumble 3 28000

1063 Asleep in the Garden 3 110000

1070 Beginnings 4 27500

1049 Buttercup with Red Lip 7 400

1018 Mountain Scene 8 2500

1055 Starlit Evening 9 9500

1003 Spring Flowers 12 2400

1039 Treachery 14 20000

1102 Crying Hats 14 10000

1052 American Rodeo 16 3500

1059 Dwelling 17 16000

1011 Eve 19 975

1109 Friends 22 16000

1084 Crossing the Platt River 23 2200

1072 Funnel 24 4500

1115 Starry Night 25 8500

1009 Amen 28 3000

1030 Ash Bench 28 13000

1043 Creosote Bushes 28 18000

1078 Chuckwagon 28 32000

1041 Night Version 29 3800

1082 Spring Flowers 29 20000

1006 House Remembered 32 700

1107 Striking It Rich 35 1750

1045 Leaf Patterns 38 2100

1100 Hungry Cowboys 38 750

1106 Horse Corral 40 12500

1044 Mexican Fiesta 43 14000

1024 Spirit and Nature 48 592

1067 Owl in Flight 49 7000

1001 Red Rock Mountain 50 18000

1028 Tired Cowboy 50 4700

1054 Snake Charmer 50 4500

1068 Moonlight 50 9750

1069 Renaissance 50 5500

1113 Shadow House 50 5500

1114 Storytelling at the Campfire 50 18000

1002 Offerings 52 10000

1091 Stone Palette 54 11500

1074 Storm on the Rise 55 8000

1098 Sweet Project 56 592

1080 The Dust Behind 59 18000

1058 The Gathering 60 250

=======================

These are the code

Part 1

printartists.php file

/* calling our function.php file */ ?> /* calling our php function ReadText() */ ?>

function.php file

/* creating a function ReadText() */ { $file = fopen("e01artists.txt", "r") or die("Error while opening file"); /* creating a variable $file to hold the php function fopen result */ $counter= 0; /* creating a variable called $counter which we use for number column of the table */ echo "

"; /* creating a html table using php echo */ echo ""; /* creating table rows using php echo */ echo ""; /* Output one line until end-of-file */ while(!feof($file)) { /* creating a while loop to read all the data of the text file one by one until it reach end */ $output = fgets($file); /* storing text file data inside variable $output */ $artist = explode(' ', $output,2); /*converting text file data into array using php explode function and storing the array into variable $artist */ echo ""; /* here we pre increment variable $counter to increment the value of counter on every next row and showing values of text file where $artist[0] is the artist number and $artist[1] is the artist name */ } fclose($file); /* closing file */ echo ""; echo "
Lee Hsu's Artist List
NumberArtist NoArtist Name
".++$counter."".$artist[0]."".$artist[1]."
Total Artist =".$counter."

"; /* closing Table */ } ?>

style.css file

table { border-collapse: collapse; /* collapse the table border into single border */ }

table, td, th { border: 1px solid black; /* set the width and color of the border */ }

/* css of the table first row */ tr:nth-child(1) { background-color: #ffdd02; /*setting yellow color */ text-align: center; /* aligning text to center */ font-weight: bold; /* making text bolder */ }

/* css of the table second row */ tr:nth-child(2) { background-color:#b7d2ff; /*setting light blue color */ text-align: center; /* aligning text to center */ font-weight: bold; /* making text bolder */ }

/* css of the table last row */ tr:last-child { text-align: center; /* aligning text to center */ background-color:#ffa201; /*setting orange color */ }

Part 2

arts.css
table {
border-collapse: collapse; /* collapse the table border into single border */
}
table, td, th {
border: 1px solid black; /* set the width and color of the border */
}
/* css of the table first row */
tr:nth-child(1) {
background-color: #ffdd02; /*setting yellow color */
text-align: center; /* aligning text to center */
font-weight: bold; /* making text bolder */
}
/* css of the table second row */
tr:nth-child(2) {
background-color:#b7d2ff; /*setting light blue color */
text-align: center; /* aligning text to center */
font-weight: bold; /* making text bolder */
}
/* css of the table last row */
tr:last-child {
text-align: center; /* aligning text to center */
background-color:#ffa201; /*setting orange color */
}
printarts.php
ReadText(); /* calling our php function ReadText() */
?>
==============
function2.php
function ReadText() /* creating a function ReadText() */
{
$file = fopen("e01arts.txt", "r") or die("Error while opening file"); /* creating a variable $file to hold the php function fopen result */
$counter= 0; /* creating a variable called $counter which we use for number column of the table */
echo ""; /* creating a html table using php echo */ "; /* creating table rows using php echo */ "; "; /* here we pre increment variable $counter to increment the value of counter on every next row and showing values of text file where $artist[0] is the artist number and $artist[1] is the artist name */ ";
echo "
Lee Hsu's Art List
echo "
NumberArt NoArt NameArtist NoMarket Value
/* Output one line until end-of-file */
while(!feof($f)) { /* creating a while loop to read all the data of the text file one by one until it reach end */
$output = fgets($f); /* storing text file data inside variable $output */
$art = explode(' ', $output,2); /*converting text file data into array using php explode function and storing the array into variable $artist */
echo "
".++$count."".$art[0]."".$art[1]."
}
fclose($f); /* closing file */
echo "
Total Art =".$count."Total Value =
echo "
"; /* closing Table */
}
?>

-> O localhost/csc264/e01/printcollections.php CSC264: Exam1-Part3 Lee Hsu's Collection Number Artist ID Artist Name Art No Market Value 7544 78000 14000 28000 110000 27500 Art Name 1042 1013 Coffee on the Trail Superstitions Aserty Aserty 1021 Bead Wall Aserty Baron 1034 1063 1070 Beaver Pole Jumble Asleep in the Garden Beginnings (Many Lines in betweern) 45 59 Quiroz 1080 The Dust Behind 4660 Rath1058The Gathering 18000 250 Total Artists 31 Total Arts 46 Total Value = 605003

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!