MySql stored procedure rows issue
Solution 1:
When you use SELECT ... INTO variable
, the query must return at most one row. If you only care whether there are any matching rows, you can use the EXISTS()
function.
SET p_returnvalue = EXISTS(
SELECT 1
FROM bookingstickets
WHERE TicketId = p_TicketID);
BTW, the MySQL equivalent to the PHP function mysqli_affected_rows()
is ROW_COUNT()
.