Hi
hier ist meine fehlermeldung, die ich immer wieder erhalte!
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\MyServer\MyWeb\htdocs\Uebungen\Kevin_Yank\challenge2.php on line 65
oder das!
Error during the execution of the inquiry: Fehler in der Syntax bei '' in Zeile 1.
kann mir bitte einer von euch helfen?
quelltext:
hier ist meine fehlermeldung, die ich immer wieder erhalte!
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\MyServer\MyWeb\htdocs\Uebungen\Kevin_Yank\challenge2.php on line 65
oder das!
Error during the execution of the inquiry: Fehler in der Syntax bei '' in Zeile 1.
kann mir bitte einer von euch helfen?
quelltext:
PHP-Code:
<?php
if (isset($addjoke)):
?>
<form action="<?=$PHP_SELF?>" method="post">
<p>Geben Sie ihren Witz hier ein:<br>
Author: <input type="Text" name="name" size="30">
EMail: <input type="Text" name="email" size="30"><br><br>
<textarea name="joketext" rows="10" cols="40" wrap>
</textarea><br>
<input type="Submit" name="submitjoke" value="Speichern">
</p>
</form>
<?php
else:
$dbc = @mysql_connect("localhost", "xxx", "xxx");
if (! $dbc) {
echo ("Can not connectet to the server Please try late");
exit();
}
if (! @mysql_select_db("Jokes")) {
echo ("Selection of the data base at present not possible");
exit();
}
if ($submitjoke == "Speichern") {
$sql = "INSERT INTO Jokes SET JokeText='$joketext', Name='$name', EMail='email', JokeDate=CURDATE()";
if (@mysql_query($sql)) {
echo ("Congratulations! Their Joke was registered in the data base!<br>");
} else {
echo ("Error with add the Joke:<br> " . mysql_error());
}
}
if (isset($deletejoke)) {
$sql = "DELETE FROM Jokes WHERE ID = $deletejoke";
if (@mysql_query($sql)) {
echo ("The Joke was removed from that data base!<br>");
} else {
echo ("Error with delete the Joke:<br> " . mysql_error());
}
}
echo ("Here are all Joke in ours data base!<br><br>");
$jokelist = mysql_query("SELECT ID, JokeText, JokeDate, AID FROM Jokes");
if (!$jokelist) {
echo ("Error during the execution of the inquiry: " . mysql_error());
exit();
}
while ($joke = mysql_fetch_array($jokelist)) {
$id = $joke["ID"];
$joketext = $joke["JokeText"];
$jokedate = $joke["JokeDate"];
$aid = $joke["AID"];
}
$authordetails = mysql_query("SELECT Name, EMail FROM Authors WHERE ID=$aid");
if (!$authordetails) {
echo ("Error during the execution of the inquiry: " . mysql_error());
exit();
}
while ($author = mysql_fetch_array($authordetails)) {
$name = $author["Name"];
$email = $author["EMail"];
echo ("<table cellspacing='2' cellpadding='2' border='1' width='100%'><tr><td>$id</td><td>$joketext</td><td>$name</td><td>$email</td><td>$jokedate</td><td><a href='$PHP_SELF?deletejoke=$jokeid'>" . "Delete joke from Database</a></td></tr></table>");
}
echo ("<a href='$PHP_SELF?addjoke=1'>Add own joke!</a>");
endif;
?>
EDIT:
php.tags presented by Abraxax
Kommentar