how to find out last_insert_id in useing Only my_sql …?

$query1 = "INSERT INTO `user_order` (user_id,product_id,cart_id,product_name,product_quantity,number_of_item,total,shipping_charge,discount,total_net_amount) VALUES 
            ('$user_id','$Productid','$Cartid','$Product_name','$Quantity','$Total_Number_of_Items','$Total','$Shipping_charge','$Discount','$Total_amount')";


$run_product = mysql_query($query1);
$last_id     = mysql_insert_id();

Use LAST_INSERT_ID() function

SELECT LAST_INSERT_ID() from user_order;

LAST_INSERT_ID() should do the trick in a mysql console . though i would strongly suggest you to not use the old mysql connector you are currently using and Switch to PDO.

i find out solution…

Add to RandomString

Post.php

     function generateRandomString($length = 30) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
if(){$dataObj->generateRandomString());}else{
echo ResponseClass::successResponseInArray("data", null, "0" ,"data missing","False");}}

then apiclass.php pass values

$sql = "SELECT * FROM user_order WHERE user_id = '$user_id' AND product_id = '$Productid' AND r_number = '$generateRandomString'";
            $result = mysql_query($sql);
            $row = mysql_fetch_assoc($result);
            $only_last_id = $row['order_id'];

** find out last insert ID 🙂