Jump to content

Recommended Posts

Easiest way is to add this line to your included connection.php

mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT);

immediately before the line that connects to the database (either with mysqli_connect() or new mysqli()  )

Just now, Barand said:

Easiest way is to add this line to your included connection.php


mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT);

immediately before the line that connects to the database (either with mysqli_connect() or new mysqli()  )

I understand your point on the hiring aspect.

Here is my connection Sir,

 



<?php


// database connection config
$dbHost = 'localhost';
$dbUser = '';
$dbPass = '';
$dbName = '';

$dbConn = mysqli_connect ($dbHost, $dbUser, $dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysqli_select_db($dbConn,$dbName) or die('Cannot select database. ' . mysqli_error());

function dbQuery($sql)
{
	$result = mysqli_query($dbConn,$sql) or die(mysql_error());
	
	return $result;
}

?>

 

Have you not mastered copy and paste yet?

// database connection config
$dbHost = 'localhost';
$dbUser = '';
$dbPass = '';
$dbName = '';

mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT);                                                      //   <-- ADD IT HERE   !!!
                                                                                                                       
$dbConn = mysqli_connect ($dbHost, $dbUser, $dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysqli_select_db($dbConn,$dbName) or die('Cannot select database. ' . mysqli_error());

function dbQuery($sql)
{
    $result = mysqli_query($dbConn,$sql) or die(mysql_error());
    
    return $result;
}

 

Just now, Barand said:

Have you not mastered copy and paste yet?


// database connection config
$dbHost = 'localhost';
$dbUser = '';
$dbPass = '';
$dbName = '';

mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT);                                                      //   <-- ADD IT HERE   !!!
                                                                                                                       
$dbConn = mysqli_connect ($dbHost, $dbUser, $dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysqli_select_db($dbConn,$dbName) or die('Cannot select database. ' . mysqli_error());

function dbQuery($sql)
{
    $result = mysqli_query($dbConn,$sql) or die(mysql_error());
    
    return $result;
}

Here is the error after I correct the connection.


atal error: Uncaught mysqli_sql_exception: Field 'email' doesn't have a default value in /home/psdelive/public_html/admin/add package.php:24 Stack trace: #0 /home/psdelive/public_html/admin/add package.php(24): mysqli_query(Object(mysqli), 'INSERT INTO pac...') #1 {main} thrown in /home/psdelive/public_html/admin/add package.php on line 24

 

 

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.