Got this working.  Not sure as all I did was simplify the selection to pull
out all records which worked.  Then added back the original parts to for
selecting "horses". It works though I have not spotted the syntax error yet.




"Craig Smith" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> When trying to use php script to access records from mysql table getting
> following error
>
> "No input file specified."
>
> I am using example php scripts and datatables as defined in the PHP &
MySQL
> for Dummies Book.
>
> The installation is on a standalone PC and comprises the following
>
> Windows98
> Apache 1.3.23
> PHP 4.3.0
> MySQL 3.23
>
> I know PHP is working through apache as I have used a sample test page
which
> shows the configuration of PHP as installed.  I also believe MySQL is
> working as I have been able to apply the same selection SQL via MySQLadmin
> as contained in the PHP script I am using to extract records.  Below is
the
> php script I am using:
>
> *********************************************************************
>
> <html>
> <head><title>Pet Catalog</title></head>
> <body>
> <?php
>   $user="root";
>   $host="localhost";
>   $password="password";
>   $database = "PetCatalog";
>   $connection = mysql_connect($host,$user,$password)
>        or die ("couldn't connect to server");
>   $db = mysql_select_db($database,$connection)
>        or die ("Couldn't select database");
>   $pettype = "horse";  //horse was previously typed in a form by user
>   $query = "SELECT * FROM Pet WHERE petType='$pettype'";
>   $result = mysql_query($query)
>        or die ("Couldn't execute query.");
>   $nrows = mysql_num_rows($result);
>
>   /* Display results in a table */
>   echo "<h1>Horses</h1>";
>   echo "<table cellspacing='15'>";
>   echo "<tr><td colspan='4'><hr></td></tr>";
>   for ($i=0;$i<$nrows;$i++)
>   {
>      $n = $i + 1;    //add 1 so that numbers don't start with 0
>      $row = mysql_fetch_array($result);
>      extract($row);
>      $f_price = number_format($price,2);
>       echo "<tr>\n
>            <td>$n.</td>\n
>            <td>$petID</td>\n
>            <td>$petDescription</td>\n
>            <td align='right'>\$$f_price</td>\n
>            </tr>\n";
>      echo "<tr><td colspan='4'><hr></td></tr>\n";
>   }
>   echo "</table>\n";
> ?>
> </body>
> </html>
>
> ********************************************************************
>
> I think that perhaps the connections are not being made as a simple test I
> have deliberately changed the host, database and password to force an
error
> and this does not happen.
>
> Any help would be appreciated.
>
> Regards
>
> Craig
>
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to