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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:50:10+00:00 2026-06-12T06:50:10+00:00

I have this query : INSERT INTO db1.outbox (DestinationNumber, TextDecoded) SELECT User.CellPhone, ‘$SMSMessage’ as

  • 0

I have this query :

INSERT INTO db1.outbox (DestinationNumber, TextDecoded)
SELECT User.CellPhone, '$SMSMessage' as TextDecoded
FROM db2.User
WHERE User.PurchaseDate BETWEEN 2012-01-01 AND 2012-01-31

it does multiple rows insertion to ‘outbox’ table. but I don’t know how many rows inserted. how to have number of rows inserted from that SQL syntax? thanks.

update
I got ‘-1’ as result of this command :

$insertedRows = mysql_query("SELECT ROW_COUNT()");
$rowInserted = mysql_fetch_array($insertedRows);
$rowInserted = $rowInserted[0];
echo $rowInserted;

but I see there are 27 rows inserted on my table. what did I do wrong?

  • 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-12T06:50:12+00:00Added an answer on June 12, 2026 at 6:50 am

    put this on your last statement;

    SELECT ROW_COUNT();
    

    UPDATE 1

    how about using mysql_affected_rows, example

    <?php
    
       $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
       if (!$link) 
       {
           die('Could not connect: ' . mysql_error());
       }
       mysql_select_db('mydb');
    
       /* this should return the correct numbers of deleted records */
       mysql_query('you SQL QUERY HERE');
       printf("Records deleted: %d\n", mysql_affected_rows());
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this SQL query : INSERT INTO db1.outbox (DestinationNumber, TextDecoded) SELECT User.CellPhone, '$SMSMessage'
I have this query here: $query='insert into pageview (visitor,id_realestate,time) select q17872745t, 150, now() from
I have this query: SELECT concat('insert into catalog_category_entity_text (value) values(test) where value_id = ',
I have this MySQL query: $SQLquery = INSERT INTO `experimental`.`comments` (`comment_id`, `comment_dt`) VALUES (NULL,
I have this query that inserts rows, using a subquery like so: INSERT INTO
I have the field: APP_DATE (smalldatetime) I'm doing this query: INSERT INTO table (TYPE,
I have an insert query that gets generated like this INSERT INTO InvoiceDetail (LegacyId,InvoiceId,DetailTypeId,Fee,FeeTax,Investigatorid,SalespersonId,CreateDate,CreatedById,IsChargeBack,Expense,RepoAgentId,PayeeName,ExpensePaymentId,AdjustDetailId)
I have this query INSERT INTO outlet_inventory (outletid, itemid, itemqty) VALUES('$outletid', '$itemid', '$qty') WHERE
I'm trying to do this query INSERT INTO dbo.tbl_A_archive SELECT * FROM SERVER0031.DB.dbo.tbl_A but
I have this query INSERT INTO asterisk.llamadas ( uniqueid, fecha, origen, destino, tipo, fechaInicioCola,

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.