php-general | 2000071
Date: 07/02/00
- Next message: Don Smith: "[PHP] Netscape Trouble"
- Previous message: Meir Kriheli: "Re: [PHP] database opinions"
- Next in thread: John Fuetsch: "Re: [PHP] Troubled code (or my troubled brain)"
- Reply: John Fuetsch: "Re: [PHP] Troubled code (or my troubled brain)"
- Reply: Reuben D Budiardja: "Re: [PHP] Troubled code (or my troubled brain)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello List,
I'm having problems with some code of mine. I don't know why it doesn't
work. Here's the section that's troubled:
if ($id == "$name") {
echo "$count";
}
else {
echo "0";
}
No matter what, this is always 0.
I think that I have something wrong somewhere else in my code however and
I don't know where it's at. So here's the rest of it (don't make fun of
the dirtiness):
<?
echo "<Center><u><b>PHP Code</u></b></center><Br>";
$connection = mysql_connect("host", "user", "pass") or die ("Unable to
connect to server.");
$db = mysql_select_db("cr0n", $connection) or die ("Unable to find
requested database.");
$result = mysql_query ("SELECT * FROM user_code WHERE language LIKE
'php'");
$numrows = mysql_num_rows($result);
while($row = mysql_fetch_array($result)) {
$description = $row["description"];
$email = $row["email"];
$type = $row["type"];
$id = $row["id"];
$language = $row["language"];
$author = $row["name"];
$date = $row["date"];
$result2 = mysql_query("SELECT * FROM counter WHERE name = '$id''");
while($row2 = mysql_fetch_array($result2)) {
$count = $row2["count"];
$name = $row2["name"];
}
echo "<table width=75% align=center bgcolor=#000000 cellpadding=0
cellspacing=0><tr><td bgcolor=#000000><table width=100% border=0
cellspacing=1 cellpadding=1 height=0%>
<tr>
<td height=15 bgcolor=#000000 colspan=2><A
href=\"viewcode.php?id=$id\"><font size=-1 color=#FFFFFF face=Arial,
Helvetica, sans-serif>$description</font></a></td>
</tr>
<tr>
<td bgcolor=#4A5A63 valign=top width=50% height=23>Author: <a
href=\"mailto:$email\"><font size=-1 color=#000000 face=Arial, Helvetica,
sans-serif>$author</font></a></td>
<td bgcolor=#4A5A63 valign=top width=50% height=23>Date: $date</td>
</tr>
<tr>
<td bgcolor=#4A5A63 valign=top width=50% height=24>Category: $type</td>
<td bgcolor=#4A5A63 valign=top width=50% height=24>Views: ";
//here's the troubled section
if ($id == "$name") {
echo "$count";
}
else {
echo "0";
}
echo "</td></tr></table></td></tr></table><Br>";
}
if ($numrows == "0") {
echo "<center><font color=#000000 size=2 face=Arial, Helvetica,
sans-serif>No PHP code has been submitted yet!</font></center>";
}
mysql_free_result($result);
?>
If anybody has any idead, please let me know, this is really bothering me.
Regards,
Tyler
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Don Smith: "[PHP] Netscape Trouble"
- Previous message: Meir Kriheli: "Re: [PHP] database opinions"
- Next in thread: John Fuetsch: "Re: [PHP] Troubled code (or my troubled brain)"
- Reply: John Fuetsch: "Re: [PHP] Troubled code (or my troubled brain)"
- Reply: Reuben D Budiardja: "Re: [PHP] Troubled code (or my troubled brain)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

