Jump to content
Larry Ullman's Book Forums

intertho

Members
  • Posts

    6
  • Joined

  • Last visited

intertho's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I'm newbie and there are some questions that I'm not really clear 1. why button, textbox, checkbox, radio button use the same tag name? 2. Can we submit data to server without using a form? 3.
  2. I place the mysqli_connect.php in the folder: C:\xampp\htdocs\mysqli_connect.php whereas, register.php file in the folder: C:\xampp\htdocs\Chapter3\register.php I also place a copy of the mysqli_connect.php file in the same folder as the register.php file to check whether mysql is connected (the result is a blank page, so I think I had connected to MySQL before running the following script) // Check if errors do not exist if (empty($errors)) { // If everything's OK //Include the database connection: require('../mysqli_connect.php'); //add the user to the database $q = "INSERT INTO users(first_name,last_name, email, pass, registration_date) VALUES( '$fn','$ln','$e',SHA1('$p'),NOW())"; $r = @mysqli_query($dbc, $q); //Run the query //Report on the sucess of the registration: if ($r) { // If it ran OK echo '<h1>Thank you!</h1> <p>You are now registered. In chapter 12 you will actually be able to log in! </p></p> <br /></p>'; } else { echo '<h1>System Error</h1> <p class="error">You could not be registered due to a system error. WE apologize for any inconvenience. </p>'; echo '<p>' . mysqli_error($dbc) . '<br/><br/>Query: ' . $q . '</p>'; } //End of if ($r) IF. // Close the database connection and compelte the HTML template mysqli_close($dbc); include('includes/footer.html'); exit(); }
  3. It works fine when I place the following code directly in the register.php file, instead of writing them in the mysqli_connect.php & then using the statement require(../mysqli_connect.php) in the register.php file! DEFINE('DB_USER','root'); DEFINE('DB_PASSWORD',''); DEFINE('DB_HOST','localhost'); DEFINE('DB_NAME','sitename'); $dbc = @mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) OR die('Could not connect to MySQL: '. mysqli_connect_error()); //set the encoding... mysqli_set_charset($dbc,'utf8'); Sth actually occured, which prevented the statement to execute smoothly: $r = @mysqli_query($dbc, $q); //Run the query I don't know why???
  4. Hello everyone! I did exactly what are instructed in the book to create the registration form, but it always show the following errors: You could not be registered due to a system error. WE apologize for any inconvenience. Warning: mysqli_error() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\Chapter3\register.php on line55 Query: INSERT INTO users(first_name,last_name, email, pass, registration_date) VALUES( 'Victor','Hugo','VictorHugo@gmail.com',SHA1('123'),NOW()) Warning: mysqli_close() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\Chapter3\register.php on line58 Could you please help me to fix it? youThank o
  5. Hello Larry! I did not find the style.css file that u mentioned in the book. Could u please show me the link to download it? Thank you.
×
×
  • Create New...