Einzelnen Beitrag anzeigen

DenSchub

Registriert seit: 4. Jun 2006
Ort: Balingen
209 Beiträge
 
#1

[PHP] Mysteriöser Fehler

  Alt 28. Okt 2008, 11:29
Hallo.

Ich habe diese PHP-Funktion.

Auszug mysql.fnc.php (Zeile 15-21)
function load_article($id)
{
$result = mysql_query("SELECT ID, short_title, title, content FROM articles WHERE ID = " . $id);
$result = mysql_fetch_assoc($result);
return $result;
}


Das eine mal rufe ich sie in dateia.php auf, einfach mit:
Code:
$article = load_article("2");
Da geht alles einwandfrei.

In einer anderen Datei mache ich exakt dasselbe, dann kommt aber der Fehler:
Code:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\server\htdocs\dsCMS\functions\mysql.fnc.php on line 18
Was soll das?

PS: Zeile 18 is die Funktion oben, dort beim mysql_fetch_assoc

Grüße, Dennis

[Edit]
Hier mal die ganze Aufruf-Datei (mit fehler). Vielleicht seht ihr mehr als ich..
Code:
/* Include required files */
require_once '../includes/confic.inc.php';
require_once '../functions/mysql.fnc.php';
require_once '../class/template.class.php';
include_once './fckeditor/fckeditor.php';

mysql_connect(CONFIG_MYSQL_HOST, CONFIG_MYSQL_USERNAME, CONFIG_MYSQL_PASSWORD);

$getid = htmlspecialchars($_GET['id']);

$current_article = load_article($getid);
PS: $getid ist 2
[/edit]
Dennis Schubert
Ground Zero is nichts gegen mein Schreibtisch.
  Mit Zitat antworten Zitat