You are here: Fetch Array Problem « All PHP « IT news, forums, messages
Fetch Array Problem

Posted by Rincewind on 09/17/05 02: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

I've checked the manual and as far as I can see mysql_fetch_array() isn't
version specific so it should work, checked Register globals and there off
on both machines so I don't think that's it.

Any help greatly appreciated

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация