I have created a request table with different fields including and id field.
Now the problem I'm facing is I want to query this database and select the id of a particular data entry (request) I know I can use 'WHERE' clause but most the entries might have similar data so I will get more than 1 id and probably one request
Here is the code for inserting the records :
$sql = "INSERT INTO requests (user_from,user_from_id,user_to) VALUES (:myname,:user2id,:user2)";
$stmt = $pdo->prepare($sql);
//Bind the variables.
$stmt->bindValue(':myname', $myname);
$stmt->bindValue(':user2id', $user2id);
$stmt->bindValue(':user2', $user2);
//Execute the statement .
$result = $stmt->execute();
But I don't know how to query the database for the newly generated id.