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

  • Home
  • SEARCH
  • 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 9162677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:16:04+00:00 2026-06-17T14:16:04+00:00

Working on something and having problems with some code. The scenario is that an

  • 0

Working on something and having problems with some code. The scenario is that an item should have multiple categories. my solution is to loop create checkboxes so that the user may simply click on the categories the item should have this is the code i have.

<?php
$result = mysql_query("SELECT * FROM tbl_category order by name ");
while($row = mysql_fetch_array($result))
    echo '<label>'.$row['name']. '</labe>' 
    '<input type="checkbox" name="categories" value='.$row['category_id'].' >';

?>

Somehow it’s not working would appreciate any help on this.

Also if someone could give me idea on how to store the values like ITEM APPLE has values of A,G,Y how would i store it in the database and how should show it. because i will be using SELECT ELEMENT filters to search them.

EDIT: error prompt

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘,’ or ‘;’ in C:\xampp\htdocs\nota\add2.php on line 25

  • 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-06-17T14:16:05+00:00Added an answer on June 17, 2026 at 2:16 pm
     echo '<label>'.$row['name']. '</labe>'.'<input type="checkbox" name="categories" value='.$row['category_id'].' >';
    

    you are missing an string concatenation operator . in echo statement .i suppose that your query is correct and there is some data in your database.

    And about storing ITEM APPLE has values of A,G,Y
    you can use a look up table which has the id of ITEM APPLE and values as A then same id but value as G and then y..etc a

    this schema is best suited if an item can have multiple value .

    link to database schema

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

Sidebar

Related Questions

I have some code that is working correctly in Java but when I try
I'm having some problems displaying a ProgressDialog. I have a method that scrapes information
I would appreciate some help with something I working on and have not done
I am working on an mvc3 application and having some problems with getting validation
I've been having some problems with a program that I've been writing and would
I'm having some problems with linking my models - which have their own views
I am willing to develop a mobile application. I wish to have something working
The code I'm working with looks something like this: <% MessageInfo msg= hp.getInfo(transactionName, checkpointLoc);%>
I seem to be having some problems creating a jquery plugin. I am testing
I am having some problem with Serialization Here goes my code for writing mClassifier

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.