MySQL ERROR when adding column


#1

iam using MySQL and phpMyAdmin at www.000webhost.com. My problem is: when I add a new column in the database (7 to 8) I get these errors:

Warning: mysqli_stmt::execute(): Premature end of data (mysqlnd_wireprotocol.c:1130) in /storage/ssd3/216/2786216/public_html/pages/login.php on line 13

Warning: mysqli_stmt::execute(): RSET_HEADER packet 4 bytes shorter than expected in /storage/ssd3/216/2786216/public_html/pages/login.php on line 13

Warning: mysqli_stmt::execute(): Error reading result set’s header in /storage/ssd3/216/2786216/public_html/pages/login.php on line 13

Notice: Trying to get property of non-object in /storage/ssd3/216/2786216/public_html/pages/login.php on line 16
Does somebody know how to fix it?


#2

Why not add it within the phpmyadmin area?


#3

I do add the column in phpMyAdmin.


#4

Hi @RealNiclas!

Please lower your PHP version and try again: 000webhost cPanel > Settings > General > Change PHP version > 5.6


#5

No changes :confused:


#6

Warning: mysqli_stmt::execute(): Premature end of data (mysqlnd_wireprotocol.c:1130) in /storage/ssd3/216/2786216/public_html/pages/login.php on line 13

This usually means there are incompatibilities between PHP query DB versions and MySQL database system. We are using MariaDB which is a little different from the traditional MySQL.

Please keep changing your PHP version and keep trying.


#7

To add a column use this
ALTER TABLE table_name ADD COLUMN column_name VARCHAR(1000


#8

With PHP version 7.0 it works, but now I get this error:

Warning: mysqli_stmt::execute(): Premature end of data (mysqlnd_wireprotocol.c:1114) in /storage/ssd3/216/2786216/public_html/pages/admininterface.php on line 68

Warning: mysqli_stmt::execute(): RSET_HEADER packet 4 bytes shorter than expected in /storage/ssd3/216/2786216/public_html/pages/admininterface.php on line 68

Warning: mysqli_stmt::execute(): Error reading result set’s header in /storage/ssd3/216/2786216/public_html/pages/admininterface.php on line 68

Fatal error: Uncaught Error: Call to a member function fetch_object() on boolean in /storage/ssd3/216/2786216/public_html/pages/admininterface.php:70 Stack trace: #0 {main} thrown in /storage/ssd3/216/2786216/public_html/pages/admininterface.php on line 70

Line 65-70:
require("…/dbconnect.php");
$search_user = $db->prepare(“SELECT * FROM users WHERE id=?”);
$search_user->bind_param(“i”,$_SESSION[“user”]);
$search_user->execute();
$search_result = $search_user->get_result();
$search_object = $search_result->fetch_object();


#9

Comment out $search_user -> get_result() and check again.


#10

Any known fix to this issue? After adding a 5th column (boolean) this has started happening.

Warning: mysqli_stmt::execute(): Premature end of data (mysqlnd_wireprotocol.c:1130) in /storage/ssd1/421/4460421/public_html/account/index.php on line 22

Warning: mysqli_stmt::execute(): RSET_HEADER packet 4 bytes shorter than expected in /storage/ssd1/421/4460421/public_html/account/index.php on line 22

Warning: mysqli_stmt::execute(): Error reading result set's header in /storage/ssd1/421/4460421/public_html/account/index.php on line 22

Notice: Trying to get property of non-object in /storage/ssd1/421/4460421/public_html/account/index.php on line 24

Lines 20-24:

$stmt = $conn->prepare('SELECT * FROM account_information WHERE account = ?');
$stmt->bind_param('s', $account);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {

By the way, what I’ve done (add a new column with the exact same code) works completely fine on a local server (XAMPP).


#11

Maybe try changing your PhP version? :slight_smile:


#12

I’ve tried what’s been suggested so far.


#13

@Supun @Supun @Supun :slight_smile:


#14

@XantiuM

Can you tell me your website address? So that I can take a look at it :slightly_smiling_face:


#15

This error appeared to resolve itself overnight. There’s no more errors.


#16

Great!

If you have anyother question let us know by opening a new topic :wink:


#17