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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:04:19+00:00 2026-06-15T09:04:19+00:00

I am working in PHP using strstr() to remove values which are extracted from

  • 0

I am working in PHP using strstr() to remove values which are extracted from a MYSQL db to be outputted to an excel file-

CODE:

        If (!strstr($value, '<script>')){
       $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value);

           $row++;
        }

This code excludes the columns that contain a <script> tag. However it shifts the contents of the cells up like so:

=====================================
|Question          |  Answer        |
=====+========+===============+=====|
|   Male/female    |                |
|----+--------+---------------+-----|
|                  |      F         |
|----+--------+---------------+-----|

Instead I would like it to skip the rows like so:

=====================================
|Question          |  Answer        |
=====+========+===============+=====|
|                  |                |
|----+--------+---------------+-----|
|   Male/female    |      F         |
|----+--------+---------------+-----|
  • 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-15T09:04:20+00:00Added an answer on June 15, 2026 at 9:04 am

    Your code is written so that the row is only incremented if your script tag is not found. However, it sounds like you want to unconditionally increment; if that’s the case, then move $row++ to outside the if statement, like so:

    if (!strstr($value, '<script>')){
        $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value);
    }
    $row++;
    

    If this isn’t what you were looking for, then please provide a sample input that can be matched to the output, as this would make what you need crystal clear.

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

Sidebar

Related Questions

I'm trying to generate a mysql dump file from PHP using the following: exec('mysqldump
I'm using PHP to generate feeds, which is working perfectly fine on my local
I have been working on on an AJAX chat application using php, mysql. It's
I have a script that generates images from text using PHP. It's working fine
I'm working on a project in PHP using Netbeans IDE which is best for
I'm working with generating .pdf's from PHP using this library: http://www.fpdf.org/ I am currently
I am trying to send a form value from javascript to php using ajax
I am trying to pass a value from javascript to php using POST method
I am working on insert array value in database in php using oops.I call
I have a simple stats query in mysql. I had it working using php

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.