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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:29:18+00:00 2026-06-17T17:29:18+00:00

Though there are some same questions here, still I want to post my own

  • 0

Though there are some same questions here, still I want to post my own question as I think I made a solution, but it’s not working. Here is the following code:

$i=1;
while ( $i<= 10) 
{
    $i++;
    $sql    =   "INSERT INTO job (Category, Title, Type) VALUES ('$_POST[cat]','$_POST[title]','$_POST[type]')";
}

Shouldn’t it insert 10 data one by one? But it just inserts 1 data. Why is this happening?

  • 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-17T17:29:20+00:00Added an answer on June 17, 2026 at 5:29 pm

    See that you’re constructing exactly the same sql string every iteration.
    Your code should be:

     $i=1;
     while ( $i<= 10)
     {
        $i++;
        $sql = "INSERT INTO job (Category, Title, Type)
                     VALUES ('{$_POST[cat]}','{$_POST[title]}','{$_POST[type]}')";
        mysql_query($sql);
     }

    Pay attention to the []

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

Sidebar

Related Questions

I know, there are already a lot of similar questions here but I did
I know there isn't enough validation in here just going through some testing. $result
EDIT: This question is solved, but I can't accept my own answer just yet.
I know this topic might be a very commonly asked question but I still
After reading many articles and some questions on here, I finally succeded in activating
So I have a project where there is some automatic initialization going on through
Is there any standard way of implementing some sort of a write-through buffer for
I need to read through some gigantic log files on a Linux system. There's
I am working through some examples in a WCF book. There is a Host
I have to deploy a C# application on a 64 bit machine though there

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.