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 6874569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:12:41+00:00 2026-05-27T04:12:41+00:00

tryin go to create a blog using the tutorials of phpacademy, I ran under

  • 0

tryin go to create a blog using the tutorials of phpacademy, I ran under a problem when it came to add a category name in my mysql using php (in this video https://www.youtube.com/watch?v=JBcXMVjk83Q)

The author is using this code to put the name of the category into the categories table:

function add_category($name) {
$name = mysql_real_escape_string($name);

mysql_query("INSERT INTO `categories` VALUES `name` = `{$name}`");

}

But it didn’t work for me (I am testing it on debian squeeze with PHP Version 5.3.3-7 and Ver 14.14 Distrib 5.1.49).

I am connecting to mysql and to the database correctly but we trying the query directly in mysql via the command line, I have the following error:

ERROR 1054 (42S22): Unknown column 'uncategorized' in 'field list'

I then noticed that using this query was working:

INSERT INTO categories(name)VALUES('uncategorized');

but I wanted to know if there was a way to use the same method as the author used and if it was better, more secure, quicker (or what so ever) than the option that I found to be working.

Thanks!

  • 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-27T04:12:41+00:00Added an answer on May 27, 2026 at 4:12 am

    You use wrong quotes here:

    mysql_query("INSERT INTO `categories` VALUES `name` = `{$name}`");
    

    Use single quotes:

    mysql_query("INSERT INTO `categories` VALUES `name` = '{$name}'");
    

    Single quotes frame data, while backticks ` are used to mark database elements – tables, columns, etc.

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

Sidebar

Related Questions

I am trying to create a blog using blogspot. It seems it is not
I am trying to connect to MySQL using PHP from an Android Device. I
Hi. I've been trying to create a PHP page using Savant Templating Engine that
I'm testing CodeIgniter, and trying to create a simple blog. The video tutorial on
Help, I'm trying to create a new post in my wordpress blog with custom
Can anyone tell how correct the following code below. Iam tryin to create a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
I have built a blog using Ruby on Rails. New to both. I am
I'm trying to create a small search for my site. I've tried using full-text

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.