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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:48:33+00:00 2026-05-27T17:48:33+00:00

I am fetching some data from MySQL which I print into a table. I

  • 0

I am fetching some data from MySQL which I print into a table. I have a function to “X out” the content after the first 2 up to the last 2 digits of a number.

Now I am trying to use that function on every number in the row ‘code’ where the MySQL result is used='' before printing it.

Example: Data from mysql row ‘code’ and ‘used’:

code = 123456789 & used = ‘n’ result=123456789
code = 123456789 & used = ” result=12XXXXX89

This is my code for fetching, creating the table and also for the function to “X out” the middle digits:

<?php
$sql="SELECT * FROM table";
$result=mysql_query($sql);

// Count table rows
$count=mysql_num_rows($result);

?>

<?php function blankit($word) {
    return substr($word, 0,2). str_repeat("X",strlen($word)-4) . substr($word, strlen($word)-2,strlen($word));
} 
?>

<?php while($rows=mysql_fetch_array($result, MYSQL_ASSOC)){ ?>
<tr class="first">
<td class="tc"><font face="Arial, Helvetica, sans-serif"><? echo $rows['id']; ?></font></td>
<td class="tc"><font face="Arial, Helvetica, sans-serif"><? echo $rows['code']; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><? echo $rows['date']; ?></font></td>
<td class="tc"><font face="Arial, Helvetica, sans-serif"><? echo $rows['ip']; ?></font></td>
<td class="tc"><input name="checkbox[]" type="checkbox" class="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> 


</tr>
<?php
}
?>
  • 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-27T17:48:34+00:00Added an answer on May 27, 2026 at 5:48 pm

    I’m not sure what this “used” variable is since it’s not shown in your code sample, but I’m guessing it’s in your mysql result. Here you go:

    <?php
    $sql="SELECT * FROM table";
    $result=mysql_query($sql);
    
    // Count table rows
    $count=mysql_num_rows($result);
    
    ?>
    
    <?php function blankit($word) {
        return substr($word, 0,2). str_repeat("X",strlen($word)-4) . substr($word, strlen($word)-2,strlen($word));
    } 
    ?>
    
    <?php while($rows=mysql_fetch_array($result, MYSQL_ASSOC)) {
    $code = ($rows['used'] == '') ? blankit($rows['code']) : $rows['code']; ?>
    <tr class="first">
    <td class="tc"><font face="Arial, Helvetica, sans-serif"><? echo $rows['id']; ?></font></td>
    <td class="tc"><font face="Arial, Helvetica, sans-serif"><? echo $code; ?></font></td>
    
    <td><font face="Arial, Helvetica, sans-serif"><? echo $rows['date']; ?></font></td>
    <td class="tc"><font face="Arial, Helvetica, sans-serif"><? echo $rows['ip']; ?></font></td>
    <td class="tc"><input name="checkbox[]" type="checkbox" class="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td> 
    
    
    </tr>
    <?php
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an application where i am fetching some data from a webservice,which
I'm fetching some data from an MSSQL table using the mssql_fetch_object, but the text
I want to break my string using javascript which is fetching some data from
I just fetched some data from JSon and listed into my Listview. It's fetching
I have written a script which is fetching data from database. Now I want
In this script, I'm fetching a load of data from a MySQL aray, and
I got a thread running every few seconds fetching some data from a db
I'm having a problem with fetching some data. The tables I have (for testing
I am fetching some data from database and want to show these values in
I'm currently creating a C# program which will be fetching some data over https

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.