PHP + MYSQL Problem

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

    #1

    PHP + MYSQL Problem

    I'm useing PHP 4.3.9 with MYSQL5
    I use odbc to connect the database that is ok
    but when I execte follow program ...that will disaply "Fatal error: Call to
    undefined function: mysql_exec() in C:\Program Files\Apache
    Group\Apache2\h tdocs\link.php on line 10"

    Please .....Help me ~~~thx a lot ~~~

    my program source code:

    <html><body>
    <?php
    $link = mysql_connect(' localhost', '', '');
    if (!$link)
    {
    die('Could not connect: ' . mysql_error());
    }
    echo 'Connected successfully';
    $sql="SELECT * FROM item_info";
    $rs=mysql_exec( $link,$sql);
    if (!$rs)
    {
    exit("Error in SQL");
    }
    mysql_close($li nk);
    ?>
    </body></html>



  • The Collective

    #2
    Re: PHP + MYSQL Problem

    Hey Danny,

    mysql_exec() is not a function or no longer according to php.net. Try mysql_query() instead.



    Danny wrote:[color=blue]
    > I'm useing PHP 4.3.9 with MYSQL5
    > I use odbc to connect the database that is ok
    > but when I execte follow program ...that will disaply "Fatal error: Call to
    > undefined function: mysql_exec() in C:\Program Files\Apache
    > Group\Apache2\h tdocs\link.php on line 10"
    >
    > Please .....Help me ~~~thx a lot ~~~
    >
    > my program source code:
    >
    > <html><body>
    > <?php
    > $link = mysql_connect(' localhost', '', '');
    > if (!$link)
    > {
    > die('Could not connect: ' . mysql_error());
    > }
    > echo 'Connected successfully';
    > $sql="SELECT * FROM item_info";
    > $rs=mysql_exec( $link,$sql);
    > if (!$rs)
    > {
    > exit("Error in SQL");
    > }
    > mysql_close($li nk);
    > ?>
    > </body></html>
    >
    >
    >[/color]

    Comment

    • Aggro

      #3
      Re: PHP + MYSQL Problem

      Danny wrote:
      [color=blue]
      > I'm useing PHP 4.3.9 with MYSQL5
      > I use odbc to connect the database that is ok
      > but when I execte follow program ...that will disaply "Fatal error: Call to
      > undefined function: mysql_exec() in C:\Program Files\Apache
      > Group\Apache2\h tdocs\link.php on line 10"[/color]

      I can't find a function like that from the php manual:
      PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


      Perhaps you should try to use the php manual as a reference when writing
      php, to make sure you got correct function names?

      Comment

      Working...