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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:04:53+00:00 2026-06-04T01:04:53+00:00

I have been making a script to display users and make changes to their

  • 0

I have been making a script to display users and make changes to their admin privileges.

Here is the code:

    while ($row= mysql_fetch_assoc($query)) {
    $uname= $row['username'];
    $fname= $row['first_name'];
    $lname= $row['last_name'];
    $email= $row['email'];
    $admin= $row['admin'];

    $insert .= '<tr>
    <td>' .$uname. '</td>
    <td>' .$fname. '</td>
    <td>' .$lname. '</td>
    <td>' .((isset($email)) ? $email:'No email set.'). '</td>
    <td>'.(($admin == 'y') ? 'Admin':'User').'</td>
    <td><input type="checkbox" name="' .$uname. '" value="'.(($admin == 'y')?'n':'y').'"/>'.(($admin == 'y')?'Make a user':'Make an admin user').'</tr>';
    }   

The $insert variable is then used later in the html to generate all the table rows with the user data.

The problem is that when I run the script this message appears

    Notice: Undefined variable: insert in C:\wamp\www\...\user_edit.php on line 33

The script still works correctly though with only this message showing in the middle of the page.

When I take the . off from the $insert .= ‘ part the message disappears but the script only displays one user in the table.

Is there any reason why this may be happening? And is there a solution to my problem so I can have the script working and the message not showing up?

  • 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-04T01:04:55+00:00Added an answer on June 4, 2026 at 1:04 am

    Just set the variable to an empty string before you use it. You can’t use .= on a variable that does not exist yet:

    $insert = "";
    while($row= mysql_fetch_assoc($query)) {
        // ...
        $insert .= '<tr>';
        // ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been mulling over config files and their relationship to code for a
I have been making HTML/PHP/MySQL database apps for quite a while now. I have
So I have been making this game with Action Script 3, and CS5.5. What
I have been making some research in the domain of servers for a website
For some time i have been making more or less little games. One level
I have been using the Rails console a fair bit lately and its making
I am making a game that needs a crosshair. I have been playing with
Have have been trying to make a validator for my xml files. I have
I have been writing some code that creates a generic blog. Its features are
I have been tasked with making some edits to a legacy system that is

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.