
canadian_angel
Members-
Posts
28 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
canadian_angel's Achievements

Member (2/5)
0
Reputation
-
I need to expand on the first query by counting the number of flights from the citys in my airline database and so far have come up with the second query; The tables in the database are flight, and city. flight columns:number, origincityid,destinationcityid,departure,duration and stops city columns:id and name SELECT city.name, flight.origincityid FROM city LEFT JOIN flight ON city.id=origincityid SELECT city.name, COUNT(origincityid.id) AS numflight ->FROM city LEFT JOIN flight ON origincityid=origincityid.id ->city.name;
-
Hi, I am new to php and have to do a project that consists of a joke page, a jokelist page and the front page or index page. My problem is this: I have used the text below in my .htaccess page and the only thing I get when I run the index.php file is the list of joke categories which is right but when i click on a category it produces an not found error. I am so confused, please can someone help! RewriteEngine On RewriteRule^/jokespage$ index.php
-
I added a user to my database ijdb for a project i am doing and have tried repeatedly to delete them with no luck. The user is jess; mysql>GRANT SELECT ON ijdb.* ->TO jess@"%.host.net" ->IDENTIFIED BY "jessrules"; mysql>GRANT UPDATE (name, email) ON ijdb.author ->TO jess@"%.host.net"; I have tryed DELETE, and DROP USER.............etc. no luck. Can someone please help!
-
I am trying to join two tables and havent been very successful, can anyone please help! The two tables are joke and author; I need to get the authors name and email address in the joke table! The database is ijdb; mysql> USE ijdb; Database changed mysql> SELECT LEFT(joketext, 20), authorid FROM joke; +----------------------+----------+ | LEFT(joketext, 20) | authorid | +----------------------+----------+ | Why did the chicken | 0 | | What is a cows favor | 0 | +----------------------+----------+ 2 rows in set (0.02 sec) mysql> SELECT * FROM author; +----+-----------------+-------------------+ | id | name | email | +----+-----------------+-------------------+ | 1 | fredl | [email protected] | | 2 | john adams | [email protected] | | 3 | tim horton | [email protected] | | 4 | colonel sanders | [email protected] | +----+-----------------+-------------------+ 4 rows in set (0.00 sec) mysql> SELECT LEFT(joketext, 20), name, email -> FROM joke, author WHERE authorid = author.id; Empty set (0.00 sec)
-
Hi, This code for some reason is producing a syntax error from this line: foreach ($types = 0; $types < 4; $types++) and i can't figure out why. Can anyone help? Please! <?php // Script 10.6 - create-four-cell-table // This script creates a four cell table. // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); function tea ($types){ $types = array ("Chinese Green", "Japanese Red", "Korean Black", "British White"); foreach ($types = 0; $types < 4; $types++) { echo "<tr><td> ". $types ." </tr></td>"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Teas of the World!</title> </head> <body> <table> <?php echo tea()?> </table> </body> </html>
-
I am so confused I have to get this function to display in a table and I really dont know how, I have tryed this so many times and just dont get it. HELP! <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Teas of the World!</title> </head> <body> <?php // Script 10.6 - Teas of the World.php // This function displays a four cell table. function tea($types) { $types = array ("Chinese Green", "Japanese Red", "Korean Black", "British White"); echo "<table border=1 cellpadding=1 cellspacing=1><tr>"; for ($cell = 0; $cell < 4; $cell++) { // Displays the cell count. echo "<td>".$types[$cell]."</td>"; } } "</tr></table>"; ?> </body> </html>
-
Code producing error message! Please help!
canadian_angel replied to canadian_angel's topic in PHP Coding Help
Thanks so much I can't believe my error, a typo ugh! -
Hi, I have a problem, everytime I run this this code I get these error messages, and I can't figure out why, I have gone over every line but I must be missing something. Warning: eregi() [function.eregi]: REG_ECTYPE in C:\AppServ\www\chapter13\convert_url.php on line 26 Warning: eregi() [function.eregi]: REG_ECTYPE in C:\AppServ\www\chapter13\convert_url.php on line 31 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Make URL Click-able</title> </head> <body> <?php // Script 13.2 - convert_url.php // This script turns a valid URL into an HTML link. // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); if ( isset ($_POST['submit'])) { // Has the form been submitted? // Trim off extraneous spaces, just in case. $url = trim ($_POST['url']); // Establish the patterns. $pattern1 = '^((http|https|ftp)://){1}([[:alum:]-])+(\.)([[:alum:]-]){2,4}([[:alum:]/+=%&_.~?-]*)$'; $pattern2 = '^([[:alum:]-])+(\.)([[:alum:]-]){2,4}([[:alum:]/+=%&_.~?-]*)$'; // Test the submitted value against the patterns. if (eregi ($pattern1, $url)) { // Check for an existing http/https/ftp. $url = eregi_replace ($pattern1,'<a href="\\0">\\0</a>', $url); print "<p>Here is the URL: $url<br />The code is now: " . htmlentities ($url) . '</p>'; } elseif (eregi ($pattern2, $url)) { // No http/https/ftp, add http://. $url = eregi_replace ($pattern2,'<a href="http://\\0">\\0</a>', $url); print "<p>Here is the URL: $url<br />The code is now: " . htmlentities ($url) . '</p>'; } else { // Invalid URL. print '<p>Please enter a valid URL.</p>'; } } // End of main conditional. // Display the HTML form. ?> <form action="convert_url.php" method="post"> <p>URL: <input type="text" name="url" size="30" /></p> <input type="submit" name="submit" value="Convert" /> </form> </body> </html>
-
i am not sure if I have already posted this and if I have I am sorry, I need to put this in the form of a function, I am trying but its not working. <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Teas of the World!</title> </head> <body> <?php // Script 10.6 - Teas of the World.php // This function a four cell table. function makefourcelltable ($table){ echo "<table border='2'> <tr> <th>Chinese Fruit Tea</th> <th>Mexican White Tea</th> <th>Japanese Green Tea</th> <th>British Camomille Tea</th> </tr>"; } echo "<tr>"; echo "<td>" . $table['Chinese Fruit Tea'] . "</td>"; echo "<td>" . $table['Mexican White Tea'] . "</td>"; echo "<td>" . $table['Japanese Green Tea'] . "</td>"; echo "<td>" . $table['British Camomille Tea'] . "</td>"; echo "</tr>"; echo "</table>"; ?> </body> </html>
-
I need to write a foreach statement that will print quotes from a text file, I tried to below but keep getting only one quote at a time and it needs to print 5. Just wondering if anyone can help me figure this out, I did attempt it myself, but no luck. The text file is called quotes.txt <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>View a Quotation</title> </head> <body> <?php // Script 11.3 - view_quote.php // This script displays and handles an HTML form. // This script takes text input and stores it in a text file. // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); // Read the file's contents into an array. $data = file ('../chapter11/quotes.txt'); // Count the number of items in the array. $n = count ($data); // Pick a random item. $rand = rand (0, ($n - 1)); // Pick the quotation. print '<p>' . trim ($data[$rand]) . '</p>'; // Print each quotation from quotes.txt. foreach ($quotes as $key => $quotes) { print "<p>$quotes</p>\n;"; } ?> </body> </html>
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Teas of the World!</title> </head> <body> <?php // Script 10.6 - Teas of the World.php // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); function maketea($type = "Tea") { return "Making a cup of $type.\n"; } echo maketea("Chinese Fruit Tea"); echo maketea("Mexican White Tea"); echo maketea("Japanese Green Tea"); ?> </body> </html>
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Four Cell Table</title> </head> <body> <?php // Script 10.6 - create-four-cell-table.php // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); // This function accepts four variables. function accept make_four_variables ($four_cell_table + $hello + a_number + $another_Number) { $four_cell_table; $hello = "Hello World!"; $a_number = 4; $another_Number = 8; return $four_cell_table; // Create four cell table ?> </body> </html>