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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:29:59+00:00 2026-05-24T04:29:59+00:00

Now, I’m having output of some mysql table by PHP. I’m using echo command

  • 0

Now, I’m having output of some mysql table by PHP. I’m using “echo command” for displaying results.

I want an element within that echo to be displayed when I mouseover another element within that echo.

When I use javascript onmouseover function, it disappears the whole echo command’s output.

Please any1 tell me what is wrong & what I should do for this.

My code is below:

    <head>
    <title>Untitled Document</title>
    <script language="javascript">
    function remove()
    {
    document.getElementById('delete').style.display = "block";
    }

    </script>
    </head>

    <body>

    <?php
    $con = mysql_connect("localhost","me_user","123456");
    if (!$con) {
      die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("my_db", $con);
    $result = mysql_query("SELECT * FROM table ORDER BY serial desc");

    while($row = mysql_fetch_array($result))
    {

    {

    echo "<div id='show' onmouseover='javascript:remove();'>
             <table border='0'  cellpadding='4'>
               <tr>
                 <td>".$row['fname']."&nbsp;".$row['lname']."&nbsp;".$row['content']
                 ."<br>"
                 .$row['date']."
                 </td>
               <td align='right'>
                 <div id='delete' style='display:none'>
                   <form method='post' action='delete.php id='delete''>
                    <input type='hidden' name='delete' value='".$row['serial']."'>
                    <a href='javascript:submit();'>x</a>
                   </form>
                 </div>
              </td>
            </tr>
         </table>";
    echo "</div>";
   }
    echo "<br><hr size='1' color='#DFDFDF'><br>";
   }

     mysql_close($con);
     ?>

      </body>
      </html>

As it’s clear from above code, the div with id delete is hidden in starting. I want then when I mouseover on the div with id show, the div with id delete should be shown.

Please somebody tell how it’s done, coz when I use javascript as in the above code the div with id show itself is disappeared & nothing else happens.

Please help me.

Thanks in advance

  • 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-24T04:30:00+00:00Added an answer on May 24, 2026 at 4:30 am

    You need to give unique ID to each <div> then use this ID to show/hide only one specific element.

    Most simple way is by adding the current index in the loop to the ID, then pass this index to the JS function.

    I’m not familiar with PHP, but code should be something like:

    <div id='delete_[add current index of PHP loop here]' style='display:none'>
    

    Which will generate for example:

    <div id='delete_1' style='display:none'>
    ...
    <div id='delete_2' style='display:none'>
    

    Then change the function call to:

    <div id='show' onmouseover='javascript:remove([add current index of PHP loop here]);'>
    

    Which will generate for example:

    <div id='show' onmouseover='javascript:remove(1);'>
    ...
    <div id='show' onmouseover='javascript:remove(2);'>
    

    Then finally, change the function to:

    function remove(index)
    {
        document.getElementById('delete_' + index).style.display = "block";
    }
    

    Hope this makes sense, let me know if the logic is not clear enough.

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

Sidebar

Related Questions

Now that I know C++ I want to get into desktop application that have
now i need to insert some data from the sqlserver into a word,i know
this is what i have right now Drawing an RSS feed into the php,
I want to count how many characters a certain string has in PHP, but
Now, I'm pretty sure that it's not possible, but I want to 1) Confirm
Now my team working in a project using Windows Application(C#) . We use MSI
Now I have finally managed to create a fullscreen window via http://cocoadevcentral.com/articles/000028.php Brilliant tutorial.
now i am learning intent filters..I got some some example like view contacts,make call.But
Now I am confused. I am quite new on Scala, having worked with it
Now that most of the major browsers support full page zoom (at present, the

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.