Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 564831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:48:29+00:00 2026-05-13T12:48:29+00:00

Hi there i’m playing with stmt for the first time (looking at converting my

  • 0

Hi there i’m playing with stmt for the first time (looking at converting my code over after previously using standard mysqli functions through an extension class.

However I can’t seem to get it working. I’m using PHP 5.2.11 and mysql 4.1.22.

I’ve got a table structure like so:

CREATE TABLE IF NOT EXISTS `tags` (
  `tag_id` smallint(3) unsigned NOT NULL auto_increment,
  `title` varchar(32) NOT NULL default '',
  PRIMARY KEY  (`tag_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

and here’s my code, i’ve been using http://devzone.zend.com/article/686 and php.net as references.

$mysqli = new mysqli('***','***','***','***');

if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$stmt = $mysqli->prepare("INSERT INTO tags (title) VALUES (?)");

$stmt->bind_param('s', $title);

$title = 'test 123';

$stmt->execute();

$stmt->close();

$mysqli->close();

It seems simple enough and i’d hope that it would insert "test 123" into title column with the tag_id auto incrementing. But instead title is blank (tag_id does incremenet as one would assume).

Anyone have any ideas where i’m going wrong?

=================================================

As atli pointed out and tested, it works on MYSQL version of 5 and above. So it’s probably a problem with using an old version of sql although the php.net documentation says that mysqli "allows you to access the functionality provided by MySQL 4.1 and above".

If anyone can suggest another reason why it may not be working or how to get it working in my environment that would great. If not I suppose i’ll keep with my own extension of the mysqli class to prepare and clean queries.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:48:29+00:00Added an answer on May 13, 2026 at 12:48 pm

    I’ve tested your code on my test server and it works fine. (Using PHP 5.3 and MySQL 5.1.37)
    So it is not the code itself, or the database design.

    My first guess would be some incompatibility with your MySQL version.
    You could try using the mysqli_stmt::get_warnings function to see if there are any warnings issued.

    If it is at all possible, I would recommend upgrading MySQL. The version you are using is getting pretty ancient. – I was going to install 4.1 and test this on it (just for fun :P) but they don’t even have the downloads available anymore.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's a lot of examples for ActionScript over the web using trace() to print
There are two popular closure styles in javascript. The first I call anonymous constructor
There are numerous libraries providing Linq capabilities to C# code interacting with a MySql
There is a way after you Go to Definition to push a hotkey to
There is something strange going on. I am using Zend Framework on a subfolder
There is a conversion process that is needed when migrating Visual Studio 2005 web
There are two weird operators in C#: the true operator the false operator If
There is previous little on the google on this subject other than people asking
There seem to be many ways to define singletons in Python. Is there a
There are a few ways to get class-like behavior in javascript, the most common

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.