Jump to content

pizzaluver13

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by pizzaluver13

  1. SCRATCH THE ABOVE PHP CODE... I didn't copy the whole code Here it is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Lab 7</title> <link rel="stylesheet" type="text/css" href="settings.css" /> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> </head> <body> <p align="center">Today is <?php print(date("l, F\ jS\ Y")); if ($_GET["year"]=="") { $year=date("Y"); $previousYear = $year-1; $nextYear = $year+1; } else { $year=$_GET["year"]; $previousYear = $year-1; $nextYear = $year+1; } if ($_GET["month"]=="") { $month=date("n"); } else { $month=$_GET["month"]; } ?> </p> <form method="get" action= "lab7.php"> <?php $date = time(); $day = date('d', $date); $month = date('n', $date); $year = date('Y', $date); $first_day = mktime(0,0,0,$month, 1, $year); $month_name = date('F', $first_day); $day_of_week = date('D', $first_day); switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } $days_in_month = cal_days_in_month(0, $month, $year); //Table starts here echo "<table border=1 cellpadding=10 align=center height=500 width=494>"; echo "<tr><th colspan=7> $month_name $year </th></tr>"; echo "<tr><td width=42>Su</td> <td width=42>Mo</td> <td width=42>Tu</td> <td width=42>We</td> <td width=42>Th</td> <td width=42>Fr</td> <td width=42>Sa</td></tr>"; //Days in week $day_count = 1; echo "<tr>"; // blank days while ( $blank > 0 ) { echo "<td></td>"; $blank = $blank-1; $day_count++; } //Set the first day of the month $day_num = 1; //This while loops works while there are still days in that month while ( $day_num <= $days_in_month ) { echo "<td> $day_num </td>"; $day_num++; $day_count++; //Starts new row for every week if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } //Finaly we finish out the table with some blank details if needed while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } echo "</tr>"; echo"<tr>"; echo"<td>"; echo "<a href='./lab7.php?year=",$previousYear,"'> $previousYear</a> "; echo"</td>"; echo"<td colspan='5'>"; echo "<a href='./lab7.php?year=",$year,"&month=1'>Jan.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=2'>Feb.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=3'>Mar.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=4'>Apr.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=5'>May.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=6'>Jun.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=7'>Jul.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=8'>Aug.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=9'>Sep.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=10'>Oct.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=11'>Nov.</a> |"; echo "<a href='./lab7.php?year=",$year,"&month=12'>Dec.</a> "; echo"</td><td>"; echo "<a href='./lab7.php?year=",$nextYear,"&month=",$month,"'>$nextYear</a> "; echo"</td></tr></table>"; ?> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a> </p> </form> </body> </html>
  2. I have to make a calendar which can go back & forth between years and months. when you click on the month it is supposed to show the calendar of that month and the year you clicked. you can view the site where i can put the php. http://helios.ite.gmu.edu/~easad/lab7.php Thanks a bunch! if ($_GET["year"]=="") { $year=date("Y"); $previousYear = $year-1; $nextYear = $year+1; } else { $year=$_GET["year"]; $previousYear = $year-1; $nextYear = $year+1; } if ($_GET["month"]=="") { $month=date("n"); } else { $month=$_GET["month"]; }
  3. You mean like this?? mysql> CREATE TABLE SHOE -> (SHOE_UPC INT(18) PRIMARY KEY, -> SHOE_COLOR CHAR(, -> SHOE_TYPE CHAR(12), -> SHOE_MATERIAL VARCHAR(16), -> LOC_ROW INT(2), -> LOC_COLUMN CHAR(1), -> DESIGN_ID INT(3), -> INDEX (LOC_ROW), -> FOREIGN KEY (LOC_ROW) REFERENCES LOCATION (LOC_ROW), -> INDEX (LOC_COLUMN), -> FOREIGN KEY (LOC_COLUMN) REFERENCES LOCATION (LOC_COLUMN), -> FOREIGN KEY (DESIGN_ID) REFERENCES DESIGNER (DESIGN_ID)); ERROR 1005 (HY000): Can't create table './easad/SHOE.frm' (errno: 150)
  4. Sorry, I forgot to put the comma in but still it gets me errors... Okay it has something to do with LOCATION probably.... mysql> CREATE TABLE SHOE -> (SHOE_UPC INT(18) PRIMARY KEY, -> SHOE_COLOR CHAR(, -> SHOE_TYPE CHAR(12), -> SHOE_MATERIAL VARCHAR(16), -> LOC_ROW INT(2), -> LOC_COLUMN CHAR(1), -> DESIGN_ID INT(3), -> FOREIGN KEY (LOC_ROW) REFERENCES LOCATION (LOC_ROW), -> FOREIGN KEY (LOC_COLUMN) REFERENCES LOCATION (LOC_COLUMN)); ERROR 1005 (HY000): Can't create table './easad/SHOE.frm' (errno: 150)
  5. I am using InnoDB When I just use one foreign key it works (the designer one) but when i put the LOCATION table foreign keys it doesn't work The location table was working fine too. mysql> DESCRIBE LOCATION; +------------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------+------+-----+---------+-------+ | LOC_ROW | int(2) | YES | | NULL | | | LOC_COLUMN | char(1) | YES | | NULL | | +------------+---------+------+-----+---------+-------+ 2 rows in set (0.01 sec) mysql> CREATE TABLE SHOE -> (SHOE_UPC INT(18) PRIMARY KEY, -> SHOE_COLOR CHAR(, -> SHOE_TYPE CHAR(12), -> SHOE_MATERIAL VARCHAR(16), -> LOC_ROW INT(2), -> LOC_COLUMN CHAR(1), -> DESIGN_ID INT(3), -> FOREIGN KEY (DESIGN_ID) REFERENCES DESIGNER (DESIGN_ID) -> FOREIGN KEY (LOC_ROW) REFERENCES LOCATION (LOC_ROW) -> FOREIGN KEY (LOC_COLUMN) REFERENCES LOCATION (LOC_COLUMN)); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOREIGN KEY (LOC_ROW) REFERENCES LOCATION (LOC_ROW) FOREIGN KEY (LOC_COLUMN) REF' at line 10 When i put 3 foreign keys it doesn't work.
  6. mysql> CREATE TABLE LOCATION -> (LOC_ROW INT(2) NOT NULL, -> LOC_COLUMN CHAR(1) NOT NULL); Query OK, 0 rows affected (0.05 sec) mysql> CREATE TABLE SHOE -> (SHOE_UPC INT(18) PRIMARY KEY, -> SHOE_COLOR CHAR( , -> SHOE_TYPE CHAR(12), -> SHOE_MATERIAL VARCHAR(16), -> DESIGN_ID INT(3), -> LOC_ROW INT(2), -> LOC_COLUMN CHAR(1), -> FOREIGN KEY (DESIGN_ID) REFERENCES DESIGNER (DESIGN_ID), -> FOREIGN KEY (LOC_ROW) REFERENCES LOCATION (LOC_ROW), -> FOREIGN KEY (LOC_COLUMN) REFERENCES LOCATION (LOC_COLUMN)); ERROR 1005 (HY000): Can't create table './easad/SHOE.frm' (errno: 150)
  7. Oh. so do mean like this? <option value="volvo">Volvo</option>
  8. Hey everyone, I don't know what i'm doing wrong or missing some code snippet (duh! thats why i'm here. lol). The html form with meeting time doesn't transfer the information over to my calendar php file. calendar.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Lab 5</title> <link rel="stylesheet" type="text/css" href="settings.css" /> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> </head> <body> <center> <form method="get" action="calendar.php"> Student Name: <input type="text" name="name"/> <input type="submit" value="Submit" /> <input type="reset" value="Clear" /> </center> <p align="center">Today is <?php print(date("l, F\ jS\ Y")); ?> </p> <?php $date = time(); $day = date('d', $date); $month = date('m', $date); $year = date('Y', $date); $first_day = mktime(0,0,0,$month, 1, $year); $title = date('F', $first_day); $day_of_week = date('D', $first_day); switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } $days_in_month = cal_days_in_month(0, $month, $year); //Table starts here echo "<table border=1 cellpadding=10 align=center height=500 width=494>"; echo "<tr><th colspan=7> $title $year </th></tr>"; echo "<tr><td width=42>Su</td> <td width=42>Mo</td> <td width=42>Tu</td> <td width=42>We</td> <td width=42>Th</td> <td width=42>Fr</td> <td width=42>Sa</td></tr>"; //Days in week $day_count = 1; echo "<tr>"; // blank days while ( $blank > 0 ) { echo "<td></td>"; $blank = $blank-1; $day_count++; } //Set the first day of the month $day_num = 1; //This while loops works while there are still days in that month while ( $day_num <= $days_in_month ) { echo "<td> $day_num </td>"; $day_num++; $day_count++; //Starts new row for every week if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } //Finaly we finish out the table with some blank details if needed while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } echo "</tr></table>"; ?> <a href="http://helios.ite.gmu.edu/~easad/IT207/Lab5/DecCal.php" target="info">Next Month</a> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a> </p> </body> </html> MeetingTime.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="settings.css" /> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <title>Meeting Time Sign Up</title> </head> <body> <h1> Meeting Time Setup Form</h1> <form method="get" action="calendar.php"> <table border="1" cellpadding="15" width="75%"> <tr><td width=42>Day: </td> <td width=42><input type="checkbox" name="available" value="Mon" />Monday</td> <td width=42 ><input type="checkbox" name="available" value="Tue" />Tuesday</td> <td width=42 ><input type="checkbox" name="available" value="Wed" />Wednesday</td> <td width=42 ><input type="checkbox" name="available" value="Thr" />Thrusday</td> <td width=42 ><input type="checkbox" name="available" value="Fri" />Friday</td></tr> <tr><td width=42 >Time: </td> <td width=42 > <p><select multiple="multiple" size="3" style="width: 180%;"> <option>7:00am</option> <option>7:00am</option> <option>7:30am</option> <option>8:00am</option> <option>8:30am</option> <option>9:00am</option> <option>9:30am</option> <option>10:00am</option> <option>10:30am</option> <option>11:00am</option> <option>11:30am</option> <option>12:00pm</option> <option>12:30pm</option> <option>1:00pm</option> <option>1:30pm</option> <option>2:00pm</option> <option>2:30pm</option> <option>3:00pm</option> <option>3:30pm</option> <option>4:00pm</option> <option>4:30pm</option> <option>5:00pm</option> <option>5:30pm</option> <option>6:00pm</option> <option>6:30pm</option> <option>7:00pm</option> <option>7:30pm</option> <option>8:00pm</option> <option>8:30pm</option> <option>9:00pm</option> <option>9:30pm</option> <option>10:00pm</option> </select></p> </td> <td width=42 > <p><select multiple="multiple" size="3" style="width: 180%;"> <option>7:00am</option> <option>7:30am</option> <option>8:00am</option> <option>8:30am</option> <option>9:00am</option> <option>9:30am</option> <option>10:00am</option> <option>10:30am</option> <option>11:00am</option> <option>11:30am</option> <option>12:00pm</option> <option>12:30pm</option> <option>1:00pm</option> <option>1:30pm</option> <option>2:00pm</option> <option>2:30pm</option> <option>3:00pm</option> <option>3:30pm</option> <option>4:00pm</option> <option>4:30pm</option> <option>5:00pm</option> <option>5:30pm</option> <option>6:00pm</option> <option>6:30pm</option> <option>7:00pm</option> <option>7:30pm</option> <option>8:00pm</option> <option>8:30pm</option> <option>9:00pm</option> <option>9:30pm</option> <option>10:00pm</option> </select></p></td> <td width=42 > <p><select multiple="multiple" size="3" style="width: 180%;"> <option>7:00am</option> <option>7:30am</option> <option>8:00am</option> <option>8:30am</option> <option>9:00am</option> <option>9:30am</option> <option>10:00am</option> <option>10:30am</option> <option>11:00am</option> <option>11:30am</option> <option>12:00pm</option> <option>12:30pm</option> <option>1:00pm</option> <option>1:30pm</option> <option>2:00pm</option> <option>2:30pm</option> <option>3:00pm</option> <option>3:30pm</option> <option>4:00pm</option> <option>4:30pm</option> <option>5:00pm</option> <option>5:30pm</option> <option>6:00pm</option> <option>6:30pm</option> <option>7:00pm</option> <option>7:30pm</option> <option>8:00pm</option> <option>8:30pm</option> <option>9:00pm</option> <option>9:30pm</option> <option>10:00pm</option> </select></p></td> <td width=42> <p><select multiple="multiple" size="3" style="width: 180%;"> <option>7:00am</option> <option>7:30am</option> <option>8:00am</option> <option>8:30am</option> <option>9:00am</option> <option>9:30am</option> <option>10:00am</option> <option>10:30am</option> <option>11:00am</option> <option>11:30am</option> <option>12:00pm</option> <option>12:30pm</option> <option>1:00pm</option> <option>1:30pm</option> <option>2:00pm</option> <option>2:30pm</option> <option>3:00pm</option> <option>3:30pm</option> <option>4:00pm</option> <option>4:30pm</option> <option>5:00pm</option> <option>5:30pm</option> <option>6:00pm</option> <option>6:30pm</option> <option>7:00pm</option> <option>7:30pm</option> <option>8:00pm</option> <option>8:30pm</option> <option>9:00pm</option> <option>9:30pm</option> <option>10:00pm</option> </select></p></td> <td width=42 > <p><select multiple="multiple" size="3" style="width: 180%;"> <option>7:00am</option> <option>7:30am</option> <option>8:00am</option> <option>8:30am</option> <option>9:00am</option> <option>9:30am</option> <option>10:00am</option> <option>10:30am</option> <option>11:00am</option> <option>11:30am</option> <option>12:00pm</option> <option>12:30pm</option> <option>1:00pm</option> <option>1:30pm</option> <option>2:00pm</option> <option>2:30pm</option> <option>3:00pm</option> <option>3:30pm</option> <option>4:00pm</option> <option>4:30pm</option> <option>5:00pm</option> <option>5:30pm</option> <option>6:00pm</option> <option>6:30pm</option> <option>7:00pm</option> <option>7:30pm</option> <option>8:00pm</option> <option>8:30pm</option> <option>9:00pm</option> <option>9:30pm</option> <option>10:00pm</option> </select></p></td>; </tr> </table> </br> <input type="reset" value="Clear" /> <input type="submit" value="Submit" /> <input type="hidden" value="newuser" /> </form> </body> </html>
  9. I got the first part using SELECT TYPE, AVG(PRICE) FROM BOOK GROUP BY TYPE; now I have to do the 2nd part which asks to repeat the above exercise but consider ONLY paperback books for those types for whcih the average price is more than $10.
  10. Its practice problems for test review. the second part of the question builds on the first. So after finding the average price for the types we have to go narrow it down further by if it is a papeback and the average price for the type is greater than $10.
  11. I have Henry Books as a table. The columns include: TITLE, PRICE, TYPE(SFI, FIC, MYS), PAPERBACK ('Y' or 'N') so the question is ... Part 1 - For each type of book, list the type and the average price. I don't know how to get average price of a type. Part 2 -consider only paperback books for those types of which the average price is more than $10 any help will be appreciated...........
×
×
  • 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.