tags:

views:

65

answers:

2

I have several procedures on this machine and this is the only query that is giving me a boolean value (at least I think it is a boolean value) in my PHP code. When I substitute this procedure with another one, this value goes away. Is there a problem with this code the way I have it?

CREATE DEFINER=`root`@`%` PROCEDURE `phoneIsRegistered`
(IN iPhone bigint(10), OUT oPhone bigint(10))
BEGIN

        SELECT
          phone
        FROM
            user
        WHERE
            phone = iPhone
        INTO
            oPhone;
END;

Here is what the array looks like with this value I'm talking about.

mysqli_result Object
(
    [current_field] => 0
    [field_count] => 2
    [lengths] => 
    [num_rows] => 110
    [type] => 0
)
mysqli_result Object
(
    [current_field] => 0
    [field_count] => 1
    [lengths] => 
    [num_rows] => 12
    [type] => 0
)
1                    <-------------------------------------HERE
mysqli_result Object
(
    [current_field] => 0
    [field_count] => 1
    [lengths] => 
    [num_rows] => 1
    [type] => 0
)
A: 

First of all there's a syntax error, in that you're using ';' both for the inner query and the create procedure. You need to "DELIMITER='//';" before the procedure and then use "END//". But still use ';' on the inner query.

DELIMITER '//'
CREATE PROCEDURE...
  ..
END//
DELIMITER ';'
Tor Valamo
Hi Tor, the proc is already created and when I view the DDL after it has been created, this is what it shows. When I created it, I did exactly what you suggested. Can you please elaborate a bit on the semicolon? I don't understand.
jim
I just remade the proc using your suggestion. I'm going to test it now.
jim
Nope... Even after deleting the proc and remaking it again, I am still getting this value in my PHP code.
jim
A: 

I answered this question for you on your other post.

http://stackoverflow.com/questions/2013668/having-more-issues-with-mysqli-numerical-data-in-results

Metropolis

Metropolis