|
Posted by Oli Filth on 09/17/05 06:30
Rincewind said the following on 17/09/2005 00:49:
> the following code works fine on my development machine using Win2k, apache
> 2.0.53 mysql 4.1.12a and PHP5
>
> <?php
> include 'library/config.php';
> include 'library/opendb.php';
>
>
> // if no id is specified, list the available pages
> if(!isset($_GET['id']))
> {
> $self = $_SERVER['PHP_SELF'];
>
> $result = mysql_query( 'SELECT * FROM episode WHERE season = 1');
>
> // create the article list
> $content = '<div id="episodeside">
> <div id="leftnav">
> <ul>';
> while($row = mysql_fetch_array($result, MYSQL_BOTH))
> {
> list($season,$episode_number, $episode_name) = $row;
> $content .= "<li><a href=\"$self?id=$episode_number\">Episode:
> $episode_number $episode_name</a></li>\r\n";
> }
>
> $content .= '</ul></div></div>';
>
> // $episode_name = "$title";
> } else {
> // get the info from database
> $query = "SELECT episode_name FROM episode WHERE episode_number =
> ".$_GET['id'];
> $result = mysql_query($query) or die('Error : ' . mysql_error());
> $row = mysql_fetch_array($result, MYSQL_BOTH);
>
> $title= $row['episode_name'];
> $content = $row['episode_name'];
> $content = stripslashes($content);
> }
> mysql_close($conn);
>
> include'library/dtd.php';
> echo $title;
> include 'library/header.php';
> echo $content;
> include'library/footer.php' ;
> ?>
>
> but when uploaded to the web server running apache 1.3.33 mysql 4.0.24 and
> php 4.3.11 I get the following error message: Warning: mysql_fetch_array():
> supplied argument is not a valid MySQL result resource in
> /home/shakespe/public_html/smallville/season-1-episodes.php on line 17
>
That error message is telling you that $result is not a proper MySQL
recordset resource, i.e. the mysql_query() call failed. Try echo
mysql_error(); straight after the mysql_query() to find out what went wrong.
--
Oli
Navigation:
[Reply to this message]
|