|
-
Sep 5th, 2004, 02:20 AM
#1
Thread Starter
Addicted Member
Evil tables!
Okay, so here's the problem (it's writtin in PHP...so..whatever):
My code (below) to display a entries in a table is fine..I think. When I view the page in Firefox, it's good, BUT when I refresh, with no changes having been made, the bottom 2 (I only have 3 entries at the moment) tables take up 100% width, instead of 80%. The source says 80% as width, however. Now, when I tried this in Internet Explorer, they stayed the same, all fine and dandy. Anyone know what's going on?
PHP Code:
$i=0;
$query=mysql_query("SELECT * FROM packagestable") or die(mysql_error());
$num=mysql_num_rows($query);
//echo "\n<br \><br \>";
while($i<$num)
{
$title=mysql_result($query,$i,"title");
$author=mysql_result($query,$i,"author");
$descr=mysql_result($query,$i,"description");
$price=mysql_result($query,$i,"price");
$lang=mysql_result($query,$i,"language");
echo "\n\n\n<center \><table width=80% border=1 cellpadding=2 cellspacing=1 \>\n";
echo "<tr \><td \><font face=verdana size=1 \>Package Name:</td \>\n";
echo "<td ><font face=verdana size=1 \>" . $title . "</td \></tr \>\n";
echo "<tr \><td \><font face=verdana size=1 \>Programmer(s):</td \>\n";
echo "<td ><font face=verdana size=1 \>" . $author . "</td \></tr \>\n";
echo "<tr \><td \><font face=verdana size=1 \>Language(s):</td \>\n";
echo "<td ><font face=verdana size=1 \>" . $lang . "</td \></tr \>\n";
echo "<tr \><td \><font face=verdana size=1 \>Price:</td \>\n";
echo "<td ><font face=verdana size=1 \>". $price . "</a ></td \></tr \>\n";
echo "<tr \><td \><font face=verdana size=1 \>Description:</td \>\n";
echo "<td ><font face=verdana size=1 \>". $descr . "</td \></tr \>\n";
echo "<tr \><td \><font face=verdana size=1 \>Order:</td \>\n";
echo "<td ><a href=\"mailto:[email protected]?subject=Order" . $i . "\" \>Order Me </td \></tr \>\n";
echo "</table \></center \><br \><br \><br \>\n";
$i++;
}
echo "\n";
-
Sep 5th, 2004, 04:14 PM
#2
In HTML, you may only omit quotes around attribute values if the value consists only of alphabetic OR only of numeric characters. A mix of the two or any non-alphanumeric characters require the use of quotes.
In XHTML, quotes are always mandatory.
That means that, for valid HTML, you have to do this:
<table width="80%" border=1 cellpadding=2 cellspacing=1 >
and for valid XHTML:
<table width="80%" border="1" cellpadding="2" cellspacing="1" >
This may or may not be the source of the error.
Two more things:
1) mysql_result is not recommended. The mysql_fetch_* functions are far faster and even easier to use in this case.
2) Your HTML is hopelessly outdated. The use of the <center> and <font> tags is not good. They are deprecated.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 6th, 2004, 12:19 AM
#3
Thread Starter
Addicted Member
Eh...I'll update then, but I'm so used to the old stuff :\
-
Sep 7th, 2004, 07:11 AM
#4
Frenzied Member
Your old stuff will slowly begin to be removed from future browsers (or at least I hope). Switch now to avoid problems.
-
Sep 29th, 2004, 01:43 AM
#5
Junior Member
iieew start using templates mate.
-
Sep 29th, 2004, 07:15 AM
#6
Frenzied Member
This thread is nearly a month old... and you bumped it for that?
-
Sep 29th, 2004, 07:19 AM
#7
Hyperactive Member
Does this helps ?
PHP Code:
$query = mysql_query("SELECT * FROM packagestable") or die(mysql_error());
//echo "\n<br><br>";
while($num = mysql_fetch_array($query))
{
echo "\n\n\n<center><table width=80% border=1 cellpadding=2 cellspacing=1>\n";
echo "<tr><td><font face=verdana size=1>Package Name:</td>\n";
echo "<td><font face=verdana size=1>" . $num[title] . "</td></tr>\n";
echo "<tr><td><font face=verdana size=1>Programmer(s):</td>\n";
echo "<td><font face=verdana size=1>" . $num[author] . "</td></tr>\n";
echo "<tr><td><font face=verdana size=1>Language(s):</td>\n";
echo "<td><font face=verdana size=1>" . $num[description] . "</td></tr>\n";
echo "<tr><td><font face=verdana size=1>Price:</td>\n";
echo "<td><font face=verdana size=1>". $num[price] . "</a></td></tr>\n";
echo "<tr><td><font face=verdana size=1>Description:</td>\n";
echo "<td><font face=verdana size=1>". $num[language] . "</td></tr>\n";
echo "<tr><td><font face=verdana size=1>Order:</td>\n";
echo "<td><a href=\"mailto:[email protected]?subject=Order" . $num . "\">Order Me </td></tr>\n";
echo "</table></center><br><br><br>\n";
}
echo "\n";
Tapan Bhanot,
CEO, Avis Software.
Website: www.avissoftware.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|