Código:
y la linea es esta:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a1300228/public_html/noticias.php on line 67
Código:
aqui les dejo todo el codigo:While ($reg = mysql_fetch_assoc($result)) {
Código:
espero que me puedan ayudar gracias <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Noticias</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php // primero se conecta a la base de datos: require 'conexion_mysql.php'; // creamos la consulta SQL. Esta consulta muestra TODOS los registros de la tabla "users": $sqltabla="create temporary table `tempUsuarios` ( `ID` int(11) unsigned NOT NULL auto_increment, `title` varchar(255) NOT NULL default '', `alias` varchar(255) NOT NULL default '', `title_alias` varchar(255) NOT NULL default '', `introtext` mediumtext NOT NULL, `fulltext` mediumtext NOT NULL, `state` tinyint(3) NOT NULL default '0', `sectionid` int(11) unsigned NOT NULL default '0', `mask` int(11) unsigned NOT NULL default '0', `catid` int(11) unsigned NOT NULL default '0', `created` datetime NOT NULL default '0000-00-00 00:00:00', `created_by` int(11) unsigned NOT NULL default '0', `created_by_alias` varchar(255) NOT NULL default '', `modified` datetime NOT NULL default '0000-00-00 00:00:00', `modified_by` int(11) unsigned NOT NULL default '0', `checked_out` int(11) unsigned NOT NULL default '0', `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00', `publish_up` datetime NOT NULL default '0000-00-00 00:00:00', `publish_down` datetime NOT NULL default '0000-00-00 00:00:00', `images` text NOT NULL, `urls` text NOT NULL, `attribs` text NOT NULL, `version` int(11) unsigned NOT NULL default '1', `parentid` int(11) unsigned NOT NULL default '0', `ordering` int(11) NOT NULL default '0', `metakey` text NOT NULL, `metadesc` text NOT NULL, `access` int(11) unsigned NOT NULL default '0', `hits` int(11) unsigned NOT NULL default '0', `metadata` text NOT NULL, PRIMARY KEY (`ID`), KEY `idx_section` (`sectionid`), KEY `idx_access` (`access`), KEY `idx_checkout` (`checked_out`), KEY `idx_state` (`state`), KEY `idx_catid` (`catid`), KEY `idx_createdby` (`created_by`) )"; $consulta1 = "insert into tempUsuarios select * from noticias limit 4,4"; $consulta = "select * from tempUsuarios order by rand() limit 1"; // la ejecutamos $result = mysql_query($consulta); ?> <table border="1"> <tr> <th>pagína de noticias</th> </tr> <?php While ($reg = mysql_fetch_assoc($result)) { // en cada iteracion el array $reg va a contener un nuevo registro que cumpla las condiciones; se accede a los datos usando el nombre del campo como indice ?> <!--por cada iteracion se crea una fila nueva con los datos de los campos correspondientes--> <tr> <td><?php echo $reg['introtext'] ?></td> </tr> <?php } ?> </table> </body> </html>