Jump to content
Larry Ullman's Book Forums

ericp

Members
  • Content Count

    58
  • Joined

  • Last visited

Community Reputation

2 Neutral

About ericp

  • Rank
    Advanced Member
  1. Perhaps, my English is not sufficient enough to explain the file system that I organized, or I chose the wrong word to explain it. Yes, you are right, and I also beleived so. So, according to my file organization, do you have any idea about how to trigger/call the my_error_handler( ) function to handle the errors, which is established in the configuration script? For example, how can we call it in the index.php page (view all posts created and posted by all users of the forum) in case that we have any error in the query ($q ="SELECT ...";) within the page's content section, while the
  2. My mistake, indeed, as I called both the mysqli_connect.php and the mysqli_connect_OOP.php in the config.inc.php file at the same time. One of them should have been called once.
  3. Sorry for late response, but I was really busy in the last few weeks. Ok. To be short, let me briefly show you the codes of my pages as follows: 1/ Index.php page: <?php Include the header include ('includes/header.html'); //codes to show/echo the page content <p> bla bla </p> //Include footer include ('includes/footerl.html'); ?> 2/ The header.html file: <?php //start a session session_start(); // Include the configuration file: require ('includes/config.inc.php'); // Get the words for this language: require (MYSQL); //include lang choice require ('inc
  4. Yes, you are right. And I also tried it. You know what? When i define the location of the MySQL connection script in the config.inc.php, using script 16.1, along with the script mysqli_connect.php in Ch 18 for it, the error occurs like this '... on line 15: Constant LIVE already defined'. I know, it's an error!. Then, I commented out the mysqli_connect.php, it requires me to RE-CODE all the files that I used Procedural so far which would take me lots of time. Do you have any suggestion? because I have to switch to OOP gradually one by one, and the config.inc.php is included in the hear.htm
  5. I have made no change to the codes. As my header.html has two languages, I have to include the config.inc.php because the config.inc.php file defines the location of the MySQL connection script, mysqli_connect.php. Without this step, my header.html cannot function and cannot print the languages repectively, either. The difference between yours and mine is that you include the config.inc.php in the individual .php files along with the code of 'require (MYSQL); ' when you make the query for the tasks; whereas I include them in the header file only. The similarity between yours and mine i
  6. Hi everyone, As my header.html included file needs to connect to the dadabase for retrieving data, I have to include the config.inc.php script (18.3) in it, but not the individual file, e.g., register.php, etc, as per the chapter 18 outlines. You know, the errors directly display on the web browser instead of being sent to the defined email. Do you know why? And how can I get it sent to as per the my_error_handler function triggers? Note: In my .ini file, I changed the error_reporting to E_ALL, and log_errors to on , and I am not sure if these changes caused the problem or not?
  7. Hi all, Can anyone help re-code the configuration file, script 18.3, using the prepared Statement Performance so that it can be compatible with the OOP (Object-Oriented Programming) MySQL connection script ((Script 16.1), please? Thanks
  8. I luckily figured it out. The problem is at html design which causes the bug. Sorry for the confusion. Can you help me delete this entry, please?
  9. Hi Larray and all, I have edited this script to fit my project, which I cut off the first name and last name. I added the username field which looks like this: <form action="" method="post"> <fieldset> <legend>Sign Up </legend> <label>Choose a username</label> <input type="text" name="username" size="20" maxlength="20" value=" <?php if (isset($trimmed['username'])) echo $trimmed['username']; ?>" /> <label>Email</label> <input type = "text" name="email" size="30" ma
  10. I just had a problem with charset utf8 for my script 17.7.php I add this into my connection script (mysqli_connect.php) as per the book guilde mysqli_set_charset($dbc, 'utf8'); And my live server is shared linux with Godaddy.com. The storage engine i am using is MySIAM, and the collocation is 'utf8_general_ci' and the PHP Version is 5.3.24 The form is also coded to accept utf8 one more time like this: <form action="" method="post" accept-charset="utf-8"> And the header .html file is also the same as the book guilde which includes this: header ('Content-Type: text/htm
  11. Sorry, but can you help with the solution for it with the while loop as of the example script 17.1 in the book or my above script? Thank you very much.
  12. Hi HarleySan, This is my form: <?php echo '<form action="" method="get"> <select name="lid" id="sel_lang"> <option value="0">' . $langs['lang'] . '</option>'; // Retrieve all the languages... $q = "SELECT lang_id, lang_others FROM languages ORDER BY lang_eng ASC"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) > 0) { while ($menu_row = mysqli_fetch_array($r, MYSQLI_NUM)) { echo "<option value=\"$menu_row[0]\">$menu_row[1]</option>\n"; } } mysqli_free_result($r); echo '</select>
  13. Hi, Anyone can help to code how to add the sticky value for the drop-down chosen language after a user hits the the 'submit' button so that the default value won't return to 'language' ($words ['language']) value, please? Thanks in advance, Eric
×
×
  • Create New...