Bueno nose si este tema va aqui,
cree una base de datos jokes y una tabla con el mismo nombre jokes en la cual van el texto y la fecha a principio me salio todo bien vi el resultado , despues cree otra tabla author donde va el nombre y el email y en este solo veo el texto con un mensaje de error, del nombre y el email , alguien me podria explicar?
esto es list2.php
Código PHP:
<?php
// Connect to the database server
$dbcnx = @mysql_connect("localhost", "root", "mipassword");
if (!$dbcnx) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
// Select the jokes database
if (! @mysql_select_db("jokes") ) {
echo( "<p>Unable to locate the joke " .
"database at this time.</p>" );
exit();
}
?>
<p>Aqui esta la lista de nuestra base de datos: </p>
<blockquote>
<?php
$jokelist = mysql_query("SELECT jokeText, AID FROM jokes");
if (!$jokelist) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
while ($joke= mysql_fetch_array($jokelist)) {
//get the text and autor id for the joke
$jokeText = $joke["jokeText"];
$aid = $joke["AID"];
//get the autors details for the joke
$authordetails = mysql_query("SELECT Name, Email FROM Authors WHERE ID=$aid");
$author = mysql_fetch_array($authordetails);
$name = $author["Name"];
$email = $author["Email"];
//Display the joke list with author information
echo( "<p>$jokeText<br />".
"(by <a href='mailto:$email'>$name</a>) </p>");
}
?>
</blockquote>
el error que sale es:
Aqui esta la lista de nuestra base de datos:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\Apache\htdocs\pruebas\list2.php on line 45
Why did the chiken coss the road? to get to the other side!.
(by )
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\Apache\htdocs\pruebas\list2.php on line 45
Esto es una prud=ba de insertar textos en la base de datos
(by )
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\Apache\htdocs\pruebas\list2.php on line 45
(by )
la linea 45 es este:
$author = mysql_fetch_array($authordetails);