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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:40:08+00:00 2026-05-23T08:40:08+00:00

if ($row1>0) in my case it is. When i enter something in database it

  • 0

if ($row1>0) in my case it is.

When i enter something in database it all goes fine when i try to add the same thing again javascript reports “sucsessfuly Updated” when really nothing was added,”already in database” should be reported in its place but somehow i doesnt it seems that $row2 and $row3 are the problem…Am i missing something that could reset them back to 0 value.

if ($row1>0)
        {
         $id3=mysql_query("SELECT id FROM searchengine WHERE url='$url'");
         $runrow2=mysql_query("SELECT * FROM keywords WHERE id='$id3' AND keyword='$search'");
         $row2=mysql_num_rows($runrow2);
         $runrow3=mysql_query("SELECT * FROM tags WHERE id='$id3' AND tag='$tag'");
         $row3=mysql_num_rows($runrow3);

        if ($row2==0)
           {
           mysql_query("INSERT INTO keywords (id,keyword) VALUES ($id3,'$search')");
           }
        if ($row3==0)
           {
           mysql_query("INSERT INTO tags (id,tag) VALUES ($id3,'$tag')");
           }
           if ($row2>0 and $row3>0)
                {
                   ?>
                   <script type="text/javascript">
                   alert("Already in database.");
                   history.back();
                   </script>
                   <?php    
                }
           if ($row2==0 or $row3==0)
                {
                   ?>
                   <script type="text/javascript">
                   alert("Successfully updated.");
                   history.back();
                   </script>
                   <?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-23T08:40:09+00:00Added an answer on May 23, 2026 at 8:40 am

    $id3 is being used in your code like a variable returned from mysql_query(). This is not the case. Instead, it is a mysql result resource from which you must fetch the real result row. Its’ value is simply TRUE or FALSE.

    $result = mysql_query("SELECT id FROM searchengine WHERE url='$url'");
    
    // Retrieve the first row from your query result
    $row = mysql_fetch_assoc($result);
    
    // Obtain the `id` column from the associative array $row
    // Now, $id3 contains the value you need.
    $id3 = $row['id'];
    
    // Your following two mysql_num_rows() statements should now work correctly.
    $runrow2=mysql_query("SELECT * FROM keywords WHERE id='$id3' AND keyword='$search'");
    $row2=mysql_num_rows($runrow2);
    $runrow3=mysql_query("SELECT * FROM tags WHERE id='$id3' AND tag='$tag'");
    $row3=mysql_num_rows($runrow3);
    

    See the documentation on mysql_query() and mysql_fetch_assoc()

    For additional info, please read up on SQL injection vulnerabilities, from which your code suffers. It is possible to hack & tamper with your database because you have not protected your query variables. At the very least you must call mysql_real_escape_string() on each of your PHP variables used as SQL query input. http://en.wikipedia.org/wiki/SQL_injection

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

Sidebar

Related Questions

Usually, Firebug gives a half decent error message when something goes wrong or doesn't
I have 5 movieclips called row1, row2, ..., row5. Inside each row are the
string rowString = <tr id=\row1\ bgcolor=\#FFFFFF\ onMouseOver=\this.bgColor='#EEEEEE';\ onMouseOut=\this.bgColor='#FFFFFF';\ style=\cursor:pointer;\> + <td bgcolor=\#FFFFFF\><img src=\images/+-companylogofilename-+\ width=\108\
I need advice on the following HTML: <!-- Beginning of ROW !--> <div id="row1">
I have a table structure that looks like: <table> <tr id=row1> <td> <div>row 1
drug_input=['MORPHINE','CODEINE'] def some_function(drug_input) generic_drugs_mapping={'MORPHINE':0, 'something':1, 'OXYCODONE':2, 'OXYMORPHONE':3, 'METHADONE':4, 'BUPRENORPHINE':5, 'HYDROMORPHONE':6, 'CODEINE':7, 'HYDROCODONE':8} row is
I'm trying to create the following. The problem is that the stuff in row1
c2=[] row1=[1,22,53] row2=[14,25,46] row3=[7,8,9] c2.append(row2) c2.append(row1) c2.append(row3) c2 is now: [[14, 25, 46], [1,
I have the following HTML: <div class=row1> <input type=radio name=group1 value=0 checked=checked/>Zero <input type=radio
Im kinda new to Jquery, so this might be easy, then again i cant

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.