Re: Apache crashes every time I call mysqli_fetch_assoc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 9, 2008 at 1:32 PM, Bonger O <bongero@xxxxxxxxx> wrote:

> Hi,
>
> I have set up an environment on my Vista laptop comprising of Apache 2.2,
> MySQL Server 5.1 and Php 5.2.5.
>
> I'm using a simple php program that I found in a PHP/SQL book. The PHP
> program queries a MySQL table and traverses the results array of the query
> and should display on screen. However, there seems to be a problem with my
> environment and as every time I run the program I get the error "*Apache
> HTTP server stopped working and was closed*".
>
> Below is the code I am using, but I have managed to narrow the problem down
> to *$row = mysqli_fetch_assoc($result);*
> For some reason this is causing the crash. Would there be any reason that
> this function cant be found perhaps? I really have no clue!!!
>
>
> > <?php
> > /* Program: petDisplay.php
> >  * Desc:    Displays all pets in selected category.
> >  */
> > ?>
> > <html>
> > <head><title>Pet Catalog</title></head>
> > <body>
> > <?php
> >
> >   $user="root";
> >   $host="localhost";
> >   $password="PASSWORD";
> >   $database = "am";
> >   $cxn = mysqli_connect($host,$user,$password,$database)
> >          or die ("couldn't connect to server");
> >   $pettype = "horse";  //horse was typed in a form by user
> >   $query = "SELECT * FROM Pet WHERE petType='$pettype'";
> >   $result = mysqli_query($cxn,$query)
> >             or die ("Couldn't execute query.");
> >
> >   /*Display results in a table */
> >   $pettype = ucfirst($pettype)."s";
> >
> >   echo "<h1>$pettype</h1>";
> >   echo "<table cellspacing='15'>";
> >   echo "<tr><td colspan='3'><hr /></td></tr>";
> >   while($row = mysqli_fetch_assoc($result))
> >   {
> >      extract($row);
> >
> >      $f_price = number_format($price,2);
> >      echo "<tr>\n
> >             <td>$petName</td>\n
> >             <td>$petDescription</td>\n
> >             <td style='text-align: right'>\$$f_price</td>\n
> >            </tr>\n";
> >      echo "<tr><td colspan='3'><hr /></td></tr>\n";
> >   }
> >   echo "</table>\n";
> > ?>
> > </body></html>
>
>
>
> Also, please see messages I have copied from the Apache error log:
>
>
> > [Wed Jul 09 19:30:09 2008] [notice] Parent: child process exited with
> > status 3221225477 -- Restarting.
> > [Wed Jul 09 19:30:12 2008] [notice] Apache/2.2.6 (Win32) PHP/5.2.5
> > configured -- resuming normal operations
> > [Wed Jul 09 19:30:12 2008] [notice] Server built: Sep  5 2007 08:58:56
> > [Wed Jul 09 19:30:12 2008] [notice] Parent: Created child process 4936
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Child process is running
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Acquired the start mutex.
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting 250 worker
> > threads.
> > [Wed Jul 09 19:30:13 2008] [notice] Child 4936: Starting thread to listen
> > on port 80.
>
>
>
> Any help would be much apprecieted.
>
> Thanks,
> Bonger
>

Have you checked that mysqli is compiled into PHP?

-- 

Bastien

Cat, the other other white meat

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux