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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:42:55+00:00 2026-06-19T04:42:55+00:00

I have little confusion in foreach loop. There is a foreach in my below

  • 0

I have little confusion in foreach loop.

There is a foreach in my below code:

foreach ($myrows as $rows){
    $option = $rows->option_value;
    $option_value = recursive_unserialize_replace($site_url,$_POST['url_name'],$option);
    $sql.= '('."'".$rows->option_name."'".','."'".$option_value."'".','."'".$rows->autoload."'".')'.",";
}

Look at the line number 3. There is a comma I used to print. Now I do not want to print the comma in the last line.

  • 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-19T04:42:56+00:00Added an answer on June 19, 2026 at 4:42 am

    Try this:

    $array = array();
    
    foreach ($myrows as $rows){
       $option = $rows->option_value;
       $option_value = recursive_unserialize_replace($site_url,$_POST['url_name'],$option);
       $array[] = '('."'".$rows->option_name."'".','."'".$option_value."'".','."'".$rows->autoload."'".')';
    }
    
    $sql = join(', ', $array);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little confusion in the following two statements. The below program is
I have little bit confusion regarding apache tomcat installation. So, I would like to
I have little confusion using EGit with Eclipse. As i am familiar with TFS,
Static class members in C++ have caused a little confusion for me due to
ARGH!!! There seems to be a little confusion surrounding the SharedDbConnectionScope and TransactionScope objects
I have a little confusion with the following things: Null DBNull.Value When I use
I have a little confusion regarding difference between ORM and PDO? Is PDO a
I have a little confusion: Is the function insertNodeInto used to inserts only a
I am working in Linux and i have a little bit confusion that whether
I have little confusion. I am trying to update JTable, but the updates are

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.