Jump to content
Larry Ullman's Book Forums

lyleb

Members
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About lyleb

  • Rank
    Newbie
  1. I'm using phpmyadmin. If I run the following query, it inserts a record just fine: INSERT INTO`council_terms` VALUES (NULL,'2001-02-13','2003-02-12',800,400,400); If I click on "Create PHP Code," it gives me this: $sql = 'INSERT INTO`council_terms` VALUES (NULL,\'2001-02-13\',\'2003-02-12\',800,400,400);'; How do I replace the values in $sql above with the values from the form? That's where I seem to be having difficulty.
  2. My real problem is that I've created a database called rezman_com_events that has the following table called council_terms: Field Type Null Key Default Extra council_term_id smallint(5) unsigned NO PRI NULL auto_increment council_term_start date NO UNI NULL council_term_end date NO UNI NULL council_term_voters smallint(5) unsigned YES NULL council_term_chiefvotes smallint(5) unsigned YES NULL council_term_councilvotes smallint(5) unsigned YES NULL To add records to it, I've created a page called add_council_term.php which is as follows: <!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" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Add A Council Term</title> </head> <body> <?php // Turn on error reporting error_reporting(E_ALL); // ***** add_council_term.php ***** // This page displays and handles a form // for inserting records into the council_terms table in the rezman_com_events database. // Include the MySQL information: require_once '/home/rezman43/connection.php'; if (isset($_POST['submitted'])) { // If the form has been submitted, handle it. // Check the required form fields: if (isset($_POST['council_term_start']) AND (!empty($_POST['council_term_end'])) AND (!empty($_POST['council_term_voters'])) AND (!empty($_POST['council_term_chiefvotes'])) AND (!empty($_POST['council_term_councilvotes'])) ) { // Create the query: $q = "INSERT INTO council_terms VALUES (NULL, {$_POST['council_term_start']}, '" . addslashes($_POST['council_term_end']) . "', '" . addslashes($_POST['council_term_voters']) . "', '" . addslashes($_POST['council_term_chiefvotes']) . "', '" . addslashes($_POST['council_term_councilvotes']) . "')"; // Execute the query: $r = mysql_query ($dbc, $q); // Print a message indicating success or not: if (mysql_affected_rows($dbc) == 1) { echo '<b><font color="green">The Council term has been added!</font></b>'; } else { echo '<b><font color="red">The Council term was not entered into the table!</font></b>'; } } else { // Print a message if they failed to enter a required field: echo '<b><font color="red">You missed a required field!</font></b>'; } } else { // If the form has not been submitted, display it. // Close out of the PHP for ease of coding. ?> Add a new record in the Council Terms table:<br /><br /> <form action="add_council_term.php" method="post"> <p>Term Start Date: <input type="text" name="council_term_start" /> Enter in this format: yyyy-mm-dd.</p> <p>Term End Date: <input type="text" name="council_term_end" /> Enter in this format: yyyy-mm-dd.</p> <p>Eligible Voters: <input type="text" name="council_term_voters" /></p> <p>Ballots Cast For Chief: <input type="text" name="council_term_chiefvotes" /></p> <p>Ballots Cast For Council: <input type="text" name="council_term_councilvotes" /></p> <input type="hidden" name="submitted" value="true" /> <input type="submit" name="submit" value="Submit!" /> </form> <?php } // Finish the main "submit" conditional. // Close the database connection: mysql_close($dbc); ?> </body> </html> I've placed the connection file in the directory above the web root. The URL for the form is at http://www.rezman.com/council/add_council_term.php. The form loads, however, when I click on the submitt button, it returns the message "The Council term was not entered into the table!" I've based this form on script_07_03.php (add_expense.php) from your MySQL VQS Second Edition.
  3. I contacted Fastwebserver about phpinfo() and about the mysqli extension and here is what they said: "As you said phpinfo() has been disabled. This is a production server and the system admins decided to lock it down to protect the users. If you need to know specific PHP config details please let m kenow and I will send you the information. Mysqli extensions are not enabled. You can use the standard mysql functions instead."
  4. Another bit of info, the mysql select version() function returns 5.0.67-community. My service provider is fastwebserver.com.
  5. Yes, I have been using both apps for creating and uploading html files and they work fine. I modified the html page as follows: <!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" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>PHP Configuration</title> </head> <body> <?php error_reporting(E_ALL); echo 'PHP Version: ' . phpversion(); phpinfo(); ?> </body> </html> Now I get the PHP Version number, but I don't get any PHP configuration information. When I try and load the page (http://www.rezman.com/council/test.php), I get the following source code (and no error message): <!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" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>PHP Configuration</title> </head> <body> PHP Version: 5.2.8<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html><head> <style type="text/css"> body {background-color: #ffffff; color: #000000;} body, td, th, h1, h2 {font-family: sans-serif;} pre {margin: 0px; font-family: monospace;} a:link {color: #000099; text-decoration: none; background-color: #ffffff;} a:hover {text-decoration: underline;} table {border-collapse: collapse;} .center {text-align: center;} .center table { margin-left: auto; margin-right: auto; text-align: left;} .center th { text-align: center !important; } td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} h1 {font-size: 150%;} h2 {font-size: 125%;} .p {text-align: left;} .e {background-color: #ccccff; font-weight: bold; color: #000000;} .h {background-color: #9999cc; font-weight: bold; color: #00
  6. Aptana Studio 3, but I've also tried creating the script in the service providers file management system. I'm using FTP Voyager to upload the file I create locally.
  7. Tried it. I reduced the file to the above line and nothing esle. Still doesn't work. The URL is: http://rezman.com/council/test.php
  8. There is no space before the "()". As far as declaring two document types, I don't think so.
  9. The source code actually looks like this? <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>templates</title> <meta name="author" content="lyleb" /> <!-- Date: 2011-10-27 --> </head> <body> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html><head> <style type="text/css"> body {background-color: #ffffff; color: #000000;} body, td, th, h1, h2 {font-family: sans-serif;} pre {margin: 0px; font-family: monospace;} a:link {color: #000099; text-decoration: none; background-color: #ffffff;} a:hover {text-decoration: underline;} table {border-collapse: collapse;} .center {text-align: center;} .center table { margin-left: auto; margin-right: auto; text-align: left;} .center th { text-align: center !important; } td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} h1 {font-size: 150%;} h2 {font-size: 125%;} .p {text-align: left;} .e {background-color: #ccccff; font-weight: bold; color: #000000;} .h {background-color: #9999cc; font-weight: bold; col
  10. By the way, the source code is more compact than is shown in the previous post (30 lines), but it does get cut off half way through the word "color" at the end.
  11. Yes, I'm using a .php extension. The file is called test.php. The source code that is returned is as follows: <! DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> < html xmlns="http://www.w3.org/1999/xhtml" lang="en"> < head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>templates</title> <meta name="author" content="lyleb" /> <!-- Date: 2011-10-27 --> </ head> < body> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> < html><head> < style type="text/css"> body {background-color: #ffffff; color: #000000;} body , td, th, h1, h2 {font-family: sans-serif;} pre {margin: 0px; font-family: monospace;} a:link {color: #000099; text-decoration: none; background-color: #ffffff;} a:hover {text-decoration: underline;} table {border-collapse: collapse;} .center {text-align: center;} .center table { margin-left: auto; margin-right: auto; text-align: left;} .center th { text-align: center !important; } td , th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} h1 {font-size: 150%;} h2 {font-size: 125%;} .p {text-align: left;} .e {background-color: #ccccff; font-weight: bold; color: #000000;} .h {background-color: #9999cc; font-weight: bold; col
  12. Silly me. I now see why the tab reads "templates." That's what I called it. However, I still don't get why this page returns nothing.
  13. I've been trying to get php working with a mysql database. I've created a database and have no trouble adding records, etc., using mysql, but I can't seem to update records with php. I created the following page, uploaded to my server and opened it and it returns nothing. The tab reads "templates" and I get the spinning wheel. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>templates</title> <meta name="author" content="lyleb" /> <!-- Date: 2011-10-27 --> </head> <body> <?php phpinfo (); ?> </body> </html>
×
×
  • Create New...