Jump to content
Larry Ullman's Book Forums

wesmith4

Members
  • Content Count

    36
  • Joined

  • Last visited

Everything posted by wesmith4

  1. I have not been able to download style.css to place within the includes folder. Needed for use in chapter 9 for modifying the template. I would appreciate your help. Wes Smith.
  2. This is the parse error message I get when I execute the code from the book. This is from using form.html and <?php # Script 2.4 - handle_form.php #3. I have checked the code several times with the code in the book. I don't know what is wrong. The code in the book must work. What should I do next? Parse error: syntax error, unexpected 'error' (T_STRING) in /srv/disk3/1536036/www/learningpreferences.org/handle_form.php on line 51
  3. www.learningpreferences.org/handle_form.php Can anyone tell me what is wrong with my script? Wes Smith
  4. This link will display by request. I hope this way of sharing is helpful. https://drive.google.com/file/d/0B_8gkRs7wT66VDNqRmtfQWlfdU0/view?usp=sharing Wes Smith
  5. Thanks Larry. MySQL has multiple tables. One table has a column named "GradeEarned". Whoever is doing this is deleting nearly all the data in the column named "GradeEarned". Here is the connection script that is stored in the "includes" folder of the webroot. it is named mysqli_connect.php. I have replaced the password in this script with '???????????????". ===================== <?php # Script: mysqli_connect.php // This file contains the database access information. // This file also establishes a connection to MySQL // and selects the database. // Set the database access inf
  6. I have a MySQL database on www.StylesOfLearning.net that is working well. But a single column in one table of the database is being edited by a non-user. Can anyone suggest how I can make the database secure. It is being hosted on godaddy. Wes
  7. Yes, and it worked just fine. Here is the script to test if running a query to directly insert into the table: ========================== <?php require ('includes/mysqli_connect.php'); // Check to see if the connection failed. if (mysqli_connect_errno()) { echo "Failed to connect to MySQ:" . mysqli_connect_error(); die(); } mysqli_query($dbc, "INSERT INTO 20140420Attend(person_id) VALUES(199)"); ?> ============= The result was exactly one record was inserted for person_id = 199. Thank you for looking into this with me.
  8. You can see how the script operates for the next several hours by clicking here. This link will not work for very long. Wes Smith
  9. Let me share a little more informatiom: Let me provide a little more information: I find the following six records in the table 20140420Attend after running the script and selecting only three records. Why are the additional three records with person_id being inserted into the table? Everytime I run the script, there is inserted into the table three additional records with person_id=0. Can anyone help me understand why the three additional records with id of zero are added? Any help would be apprecialted. Wes Smith
  10. I have a php script that uses <select> to display all people in a MySQL table, and then want to insert the id of all persons selected into another MySQL table. One use of this would be a way to "select" those people present. The script works, storing record ids into a seperate table. But it also records an id of "0" in addition to the record id. So every selected record is recorded with its unique id, but another record is recorded in the table with = zero! So if 4 records are selected, there will be 4 records inserted with the correct id, and 4 addition records created with id o
  11. Thanks Larry! You said it well. I am seeking a plan that both displays and handles a form, but use a database as the source. I will keep reading, but I am not sure about reading from ?????. Again, Thank you. wes
  12. I am using the structure of Script 3.5 (Calculator.php) to tackle the issue of recording attendance for persons listed in a MySQL database. I am using this structure because I am attempting to create a web page that will handle a form and then display it again. Larry mentions this function on page 86. I plan to use input type="checkbox" name="checkbox[]" value="full_name". The value part is where I am having trouble. I want to select a person's name from a table in the database so that the name will appear on the form on the same line with the checkbox. The page is in two parts, the f
  13. I am attempting to develop a PHP script to record presence at an event for those persons in a mysql table Persons. I am attempting to use checkboxes to indicate who was present. Here is the script as currently written: <?php # Script require ('includes/mysqli_connect.php'); if(isset($_POST['checkbox'])) {$checkbox = $_POST['checkbox']; if(isset($_POST['activate'])?$activate = $_POST["activate"]:$deactivate = $_POST["deactivate"]); $id = "('" . implode( "','", $checkbox ) . "');" ; echo $id; $q="UPDATE Persons SET present = '".(isset($activate)?'Y':'N')."' WHERE id IN $id" ; $r = mys
  14. Can anyone tell me how to use select tags for drop down lists in PHP? I understand the selection is sent to the server, but I don't know how to access what was selected? Thanks.
  15. Margaux: I tried the INSERT INT0 query both ways: $q = "INSERT INTO Attendance (dateofattendance,fkhh_id,attendees,event,note) VALUES ('$da','$id', '$a','$e','$n')"; $q = "INSERT INTO Attendance (dateofattendance,fkhh_id,attendees,event,note) VALUES ('$da',$id, '$a','$e','$n')"; and also as: $q = "INSERT INTO Attendance (dateofattendance,fkhh_id,attendees,event,note) VALUES ('$da',id, '$a','$e','$n')"; All three assign the number zero to the record row from the Household table. This is the problem. To check on that, I added a few lines of code very early in "register_attendance.p
  16. I have confirmed that the correct id is sent to register_attendance.php. But still the INSERT query does not put this number in the attendance table, but does put everthing else. I am including the code here so maybe you can determine what I am doing wrong. ----------------------- <?php # Script 9.5 - register_attendance.php #2 // Check for a valid user ID, through GET: if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { // From view_households.php $id = $_GET['id']; echo '<p>The household id is <b>' . $id . '</b></
  17. Thanks for the recommendation. I tried the following: // Make the query: $q = "INSERT INTO Attendance (dateofattendance,fkhh_id,attendees,event,note) VALUES ('$da','$_GET['hh_id']', '$a','$e','$n')"; $r = @mysqli_query ($dbc, $q); // Run the query. if ($r) { // if it ran OK. //Print a message: echo '<h2>Attendance is recorded.</h2> When I do this all the columns in Attendance are written to a new record in the table, but fkhh_id always received a zero. I don't know what I am doing wrong. Thanks. Wes
  18. I am trying to learn how to use a number sent in a URL from a page on my site. I run a script that allows me go to "register_attendance.php?hh_id=". "hh_id" is the primary key for a record in a database table named household. Then I want to insert a new record in a table named attendance that would contain this number (hh_id) in a column named fkhh_id. But I obviously don't know how to use the INSERT INTO query so that new record will appear in the attendance table with the number (hh_id) in the column named fkhh_id. If anyone can help me understand how to insert the number sent i
  19. The code based on chapter ten is available through this link. I am attempting to INSERT INTO a database table a record that would contain such items as a date and the key from another table in the MySQL database. In fact, one table is a table of households. The key of a record in the household table is passed to a script to record attendance information of this household in the attendance table. So one column in the attendance table is to contain a key from the household table. The edit_user.php script in Larry's book sends such a key to a script that contains a "select query". I
  20. WOW! Thanks Larry! You will never know how helpful a comment like "be sure that display_errors is enabled" is to a newbie like me! It took me a while to find how to do that. My site is hosted by awardspace.net. He it was not too difficult to find how to edit php.nin. After several attempts to run, I was able to identify my mistake. Thank you! I hope that within a few days I will be running my website with its MySQL database to be used by schools and churches. Again, that you for both your assistance and FOR YOUR BOOK! Wes Smith
  21. I am using material from Chapter 10 to design scripts for recording attendance data for persons listed in a Household table in an additiona table called Attendance. I have two scripts. The first is "view_households.php" and is listed here: <?php # Script 10.1 - view_households.php #3 // This script retrieves all the records from the household table. // This new version links to edit and delete pages. $page_title = 'View the Current Households'; include ('includes/header.html'); echo '<h1>Registered Households</h1>'; require_once ('includes/mysqli_connect.php'); // Defin
  22. I have an error in user registration in Chapter 18. After registering, activating after receiving email, and then running login.php script, I get the error that the page "....../indes.php" not found on the server. Can anyone help me identify my error. Thanks in advance. Wes Smith wesmith4@gmail.com
  23. Let me add this...... When I run the script "stylesoflearningnet/view_users.php" things seem to work. When I run the script "stylesoflearning.net/pumc/view_households.php" I get the error. Using this subfolder on my website may be causing the error?? I appreciate any advice. Wes Smith
×
×
  • Create New...