Jump to content

Recommended Posts

Occasionally I will write code in php that fails to render ANYTHING on the screen. I have

 

error_reporting E_ALL

display_errors = 1

 

Set in my php.ini file and I have removed the mysql error suppression symbol '@' from my code. And yet when I load the page in my browser....nada!  :shrug:

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/184778-turn-off-buffering-in-phpini/
Share on other sites

It would be -

error_reporting = E_ALL

 

Have you checked using a phpinfo() statement if the settings are actually being changed to those values (in case the php.ini that you are changing is not the one that php is using)?

Thanks, I added the missing equal sign.  ;) But for some reason this code is still not rendering.

 

example.8-12.php

<?php
require 'db.inc';
require_once "HTML/Template/ITX.php";

function formerror(&$template, $message, &$errors)
{
  $errors = true;
  $template->setCurrentBlock("error");
  $template->setVariable("ERROR", $message);
  $template->parseCurrentBlock("error");
}

if (!($connection =  mysql_connect("localhost", "thatguy", "yahright?")))
   die("Could not connect to database");

$phonebook_id = mysqlclean($_POST, "phonebook_id", 5, $connection);
$firstname = mysqlclean($_POST, "firstname", 50, $connection);
$surname = mysqlclean($_POST, "surname", 50, $connection);
$phone = mysqlclean($_POST, "phone", 20, $connection);

$template = new HTML_Template_ITX("./templates");
$template->loadTemplatefile("example.8-10.tpl", true, true);

$errors = false;

if (empty($firstname))
  formerror($template, "The first name field cannot be blank.", $errors);

if (empty($surname))
  formerror($template, "The surname field cannot be blank.", $errors);

if (empty($phone))
  formerror($template, "The phone field cannot be blank", $errors);

// Now the script has finished the validation, show any errors
if ($errors)
{
  $template->show();
  exit;
}

// If we made it here, then the data is valid
if (!mysql_select_db("telephone", $connection))
  showerror();

// Update the phonebook entry
$query = "UPDATE phonebook SET surname = '{$surname}',
         firstname = '{$firstname}',
         phone = '{$phone}'
         WHERE phonebook_id = {$phonebook_id}";

if (!( mysql_query ($query, $connection)))
   showerror();

// Show the phonebook receipt
header("Location: example.8-5.php?status=T&phonebook_id={$phonebook_id}");
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.