PHP and MySQL 5 Stored Procedures...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • StinkFinger

    PHP and MySQL 5 Stored Procedures...

    All,
    Does anyone have any example code, tutorials, etc. for:
    1. Create a basic SP in MySQL 5 (i.e. a simple SP to return all rows)
    and
    2. Running the SPs from PHP 4.3.7 ?

    Thanks.


  • Chris Hope

    #2
    Re: PHP and MySQL 5 Stored Procedures...

    StinkFinger wrote:
    [color=blue]
    > Does anyone have any example code, tutorials, etc. for:
    > 1. Create a basic SP in MySQL 5 (i.e. a simple SP to return all rows)[/color]

    Can't help you with this one. But check out the manual at


    According to the docs you use "call" with the parameters enclosed in
    brackets as at http://dev.mysql.com/doc/mysql/en/CALL.html
    [color=blue]
    > 2. Running the SPs from PHP 4.3.7 ?[/color]

    Given that calling an SP is just like calling any piece of SQL, and that you
    use "call" to call one as per the manual page above you'd do it like so:

    $res = mysql_query("ca ll stored_procedur e_name('param1' , 'param2')");
    while($row = mysql_fetch_ass oc($res)) {
    ...
    }

    --
    Chris Hope
    The Electric Toolbox - http://www.electrictoolbox.com/

    Comment

    • StinkFinger

      #3
      Re: PHP and MySQL 5 Stored Procedures...

      Thanks - it seems others are having problems also. I was trying to do a
      simple experiment, i.e.
      select * from table and return everything, however, it doesn't seem so easy.

      "Chris Hope" <chris@electric toolbox.com> wrote in message
      news:1086499103 _13979@news.ath enanews.com...[color=blue]
      > StinkFinger wrote:
      >[color=green]
      >> Does anyone have any example code, tutorials, etc. for:
      >> 1. Create a basic SP in MySQL 5 (i.e. a simple SP to return all rows)[/color]
      >
      > Can't help you with this one. But check out the manual at
      > http://dev.mysql.com/doc/mysql/en/St...rocedures.html
      >
      > According to the docs you use "call" with the parameters enclosed in
      > brackets as at http://dev.mysql.com/doc/mysql/en/CALL.html
      >[color=green]
      >> 2. Running the SPs from PHP 4.3.7 ?[/color]
      >
      > Given that calling an SP is just like calling any piece of SQL, and that
      > you
      > use "call" to call one as per the manual page above you'd do it like so:
      >
      > $res = mysql_query("ca ll stored_procedur e_name('param1' , 'param2')");
      > while($row = mysql_fetch_ass oc($res)) {
      > ...
      > }
      >
      > --
      > Chris Hope
      > The Electric Toolbox - http://www.electrictoolbox.com/[/color]


      Comment

      Working...