PDA

Afficher la version complète : creation tableau



@pitbull
29/05/2006, 00h55
bonjour a tous ,voila j'aurais besoin d'un ti coup de pouce , je souhaite creer un ti hack qui affiche les news du jour sur une page externe le soucis c'est que j'en suis arriver a afficher une seul ligne sur 2 presente dans ma table ,


--
-- Structure de la table `news`
--

CREATE TABLE `news` (
`contenu` mediumtext NOT NULL,
`posteur` mediumtext NOT NULL,
`categorie` mediumtext NOT NULL,
`sender` mediumtext NOT NULL,
`source` binary(1) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Contenu de la table `news`
--

INSERT INTO `news` VALUES ('contenu news une', 'admin', 'internet', 'membre', 'google news');
INSERT INTO `news` VALUES ('contenu news 2', 'admin2', 'informatique', 'membre2', 'info du net');
mon template


$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<!-- end no cache headers -->
<title><phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title>
$headinclude
</head>
<body>
$header
$navbar

<br>

<!-- main -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<thead>
<td class="thead" width="65%" align="$stylevar[left]">
<center>Contenue</center>
</td>

<td class="thead" width="150">
<center>Posteur</center>
</td>

<td class="thead" width="150">
<center>Categorie</center>
</td>

<td class="thead" width="250">
<center>Sendeur</center>
</td>

<td class="thead" width="250">
<center>Source</center>
</td>

</thead>
<tbody>
$aup
</tbody>
</table>
<!-- /main -->

<br />
<br />


$footer
</body>
</html>
mon fichier php


<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'news');


// ######################### REQUIRE BACK-END ############################
require_once('./global.php');


$newss = $db->query_first("SELECT contenu AS test, posteur AS post, categorie AS cat, sender AS send, source AS sourc FROM " . TABLE_PREFIX . "news");

{

$aup .= "<tr align=\"center\">";
$aup .= "<td class=\"alt1\">$newss[test]</td>";
$aup .= "<td class=\"alt2\">$newss[post]</td>";
$aup .= "<td class=\"alt1\">$newss[cat]</td>";
$aup .= "<td class=\"alt2\">$newss[send]</td>";
$aup .= "<td class=\"alt1\">$newss[sourc]</td>";
$aup .= "</tr>";

}

$navbits[''] =$vbphrase['manage'];
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('manage_bit') . '");');

?>
donc avec cela jaffiche juste la premiere ligne :(

si quelqu'un voit ou je seche? merci

Allan
29/05/2006, 07h45
Le code et moi, ca fais ......36, je passe mon tour :p

Rom56
29/05/2006, 19h51
salut @pitbull,

désolé de te décevoir à mon tour mais moi non plus je ne vois pas :( fred pourra peut etre t'aider lui en revanche :)

Fred
29/05/2006, 23h03
@pitbull je regarde ca dés que les exam sont passé donc soit quelqu'un d'autre regarde ou alors tu attend un petit peu ;)

@pitbull
29/05/2006, 23h37
j'arrive au news vous pouvez mettre sur réglé c'est tout good pour l'instant

beuzathor
30/05/2006, 12h51
pour info avec ce code la

$newss = $db->query_first("SELECT contenu AS test, posteur AS post, categorie AS cat, sender AS send, source AS sourc FROM " . TABLE_PREFIX . "news"); mysql lit uniquement la premiere entrée, il faut donc lui faire faire une boucle pour qu'il lise toutes entrées en rajoutant
while($newss2 = $db->fetch_array($newss))