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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:39:46+00:00 2026-06-14T20:39:46+00:00

Here is the piece of code I am having trouble with as far as

  • 0

Here is the piece of code I am having trouble with as far as I know it should be working but it is as if the if statement is not there.

$payloadObj->data is supplied in the call and contains a unique number used for identification

        $limit="";
        $order=" ORDER BY rmtID";
        $where=" WHERE udid = '".$data."'";
        $data=$payloadObj->data;
        $now = date("o-m-d H:i:s");
        $query00="SELECT DISTINCT udid FROM rmtCustomer".$where; 
        $result00 = mysql_query($query00)
            or die("Query failed -".$query00);
        //$items=mysql_num_rows($result00);
        if ($result00) {
            if (mysql_num_rows($result00) == 0) {
            //if(!$items){
                $query11="INSERT INTO rmtCustomer (rmtCustomerID, udid, date) VALUES ('', '".$data."', '".$now."')";
                $result11 = mysql_query($query11)
                    or die("Query failed -".$query11);  
                $query22="INSERT INTO rmtSales (rmtSalesID, udid, productCount, date) VALUES ('', '".$data."', '9', '".$now."')";
                $result22 = mysql_query($query22)
                    or die("Query failed -".$query22);  
            }
        }

        $query="SELECT rmtTitle as product FROM rmtData".$order.$limit;
        $result = mysql_query($query)
            or die("Query failed -".$query);        
        $rows=array();
        while($row = mysql_fetch_array($result, MYSQL_BOTH)) {
            $rows[] = $row;
        }

I use variables $limit, $order, and $where to finish the queries since I have several of them it made it easier. They have been checked out and they are not an issue at all.

What the desired affect is to run the first query to check for a new customer if NO RECORD is found this is a new customer and then I want to run the queries in the if statement to add them to the customer table and to the sales table and then to continue with the remainder of the queries. If there is a record in the first result then the customer exists and I want to skip the insertion queries and move directly to the rest of the queries.

This example shows a few attempts so far the two lines commented out were my first attempts but got the same result.

Any assistance would be appreciated.

  • 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-14T20:39:47+00:00Added an answer on June 14, 2026 at 8:39 pm

    A few things:

    1. $data is initialized (line 4) after it being used (line 3). Shouldn’t this be the other way around?

    2. If udid is a primary key or unique index, you can simply run the insert and catch a “duplicate” error. This will improve your performance, since you don’t need the first “select” query. Note: this will increase the next udid in case it is an auto-incremented field, even if the insert fails.

    3. you say the “statement is not there”, and I’m not really sure what that means..

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

Sidebar

Related Questions

I'm having trouble with a piece of code $(function(){ $('input.no').click(function(){ $(this).animate({left : 80px}, 150);
I am having trouble with the most simple piece of code. For some reason,
I am having trouble with the following piece of code. Before I paste it,
I am looking over this piece of code, and am having trouble with the
I'm having some trouble understanding import This piece of code works properly. I from
Here is the code I am having trouble with everyone. This is what I
I'm learning Jquery and having some little problem with a piece of code... Here
I am having a lot of trouble with this piece of code (I am
Here is a piece of code that I've written. The problem that I'm having
I'm having a little trouble with making the following piece of code work. I

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.