<?
$db=mysql_connect("localhost","","") or die ("cant connect");
mysql_select_db("team101",$db) or die ("cant change");
$news=mysql_query("select * from team101_news ORDER BY date DESC LIMIT 8") or die ("cant get em");
while($rows=mysql_fetch_array($news)){
$date=$rows["date"];
$author=$rows["author"];
$title1=$rows["title"];
$content=$rows["content"];
$number="100%";
printf("<table cellpadding=2 cellspacing=0 border=0 width=%s>",$number);
echo "<td bgcolor=#DC9322 class='first'><b>$title1</b></td>";
echo "<td align=right bgcolor=#DC9322 class='first'>$date</td><tr>";
echo "$content";
echo "<td colspan=2><i>by <A href=\"mailto:$email\">$author</a></i><br>;
</td></table><p>";
}
?>
returning data to a table
Moderator: General Moderators
returning data to a table
Hey I got a script but its not the table I want. I dont know how to make a table and whenever I do it says unwanted bracket. This is the script.
Also u can see it at http://www.team101.net
something like http://www.team101.net/table.htm
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
I suggest you read a bit more about HTML, e.g. at W3Schools. They have a great help about HTML, including about tables.
You're missing the row-tag <tr>!!
You're missing the row-tag <tr>!!
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
This is a part of some script in one of my history books ( the compleet script is somewhere on this forum tho
)
however it does describe how to create such a table as you have in youre table.htm ( are you using a frontpage ? ) i hate those... they make everthing easy but also unclear !!
MY CODE:
Decided to show you how my table works ... ofcourse you do need to edit some things.. but it basicly works the same as you have it all the way up.
however it does describe how to create such a table as you have in youre table.htm ( are you using a frontpage ? ) i hate those... they make everthing easy but also unclear !!
MY CODE:
Code: Select all
/*
just change the class="r" in align=right class="v" in bgcolor=''"
*/
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Numero Paquete</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Paqnr'];
echo " </td>\n ";
echo " </tr>\n ";Code: Select all
<?
require ("include/styles.php");
// formulario, solo pone el codigo paquete
ECHO <<<HTML
<html>
<head>
<body class="v">
<form name="retrieve" action={$_SERVER['PHP_SELF']} method="GET" class="center">
<table width="250" border="0" class="center" cellpading="3">
<tr>
<td>
<div class="center"><b>Informacion de to Consulta</b></div>
</td>
</tr>
Enter Paq. number:<input type="text" name="Paqnr">
<br>
<Div class="r"><input name="submit" type="submit" ID="Paqnr" WIDTH="5"
CLASSID="CLSID:B6FC3A14-F837-11D0-9CC8-006008058734"></div>
HTML;
// connectarse con el sql
$dbase ="home";
$tablename ="pongo";
$connect= mysql_connect('localhost')
or die("Cant connect: " .mysql_error());
// connectarse con el base datos
mysql_select_db($dbase, $connect);
// consultar el tabla pongo ( cambiar cuando listo )
if (isset($_GET['Paqnr'])) { // Only execute this code if the Paqnr variable isset
$query = "SELECT * FROM pongo WHERE Paqnr='" .$_GET['Paqnr']. "'";
$result = mysql_query($query);
if($row = mysql_fetch_array($result))
{
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Numero Paquete</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Paqnr'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Empresa</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Empresa'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Codigo</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Codigo'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Envio</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Envio'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Desde</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Desde'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Comentario</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Comentario'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Informacion</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Information'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Peso Total</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Peso_Total'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Valor</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Valor'];
echo " </td>\n ";
echo " </tr>\n ";
echo "<tr class="V"> ";
echo "<td width="100" class="v"> ";
echo "<div class="r">Peso</div> ";
echo "</td>\n ";
echo "<td width="150"> ";
echo $row['Peso'];
echo " </td>\n ";
echo " </tr>\n ";
}
}
echo "</td>\n";
echo "</tr>\n";
echo " </table>\n";
echo " </form>\n";
?>ok u seen my news script what I want is for all the information to go the included table file which is http://www.team101.net/table.htm I want that included for it to display the news. So at anytime if i want to change this I can. Are you getting me now?
Yes i do know what you mean. however what you basicly ask us to do is to code youre script / youre table.
As you can see in the example above it has basicly all the basics you need. And yes you do need to edit a couple of lines to make it youre own.
But it will be minor changes.
Somebody on this forum said on some page the following
Read it, Than Read it Again, And Again! Than ask youre questions
( wont have it quoted sinds i do not know the exact words )
As you can see in the example above it has basicly all the basics you need. And yes you do need to edit a couple of lines to make it youre own.
But it will be minor changes.
Somebody on this forum said on some page the following
Read it, Than Read it Again, And Again! Than ask youre questions
( wont have it quoted sinds i do not know the exact words )
WEll i really suggest like Darfel did, that you read up on these.
Tables http://www.w3schools.com/html/html_tables.asp
And start here on how to code in PHP.
Learn PHP http://www.php.net/manual/en/
Tables http://www.w3schools.com/html/html_tables.asp
And start here on how to code in PHP.
Learn PHP http://www.php.net/manual/en/
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: