Re: Re: [PHP] Troubled code (or my troubled brain)

From: Date: Sun, 02 Jul 2000 23:50:55 +0000
Subject: Re: Re: [PHP] Troubled code (or my troubled brain)
Groups: php.general 
Request: Send a blank email to php-general+get-4414@lists.php.net to get a copy of this message
Thank you very much to everybody that responded to my question. My problem has now been fixed. I've got one more question though, is there any way to format show_source("something.txt"); ? It doesn't like to adjust to the size of tables, it just expands the tables and then it screws the whole page up if there's a long line in it. Thanks once again!! On Sun, 2 Jul 2000, Jay Greenspan wrote: > Date: Sun, 2 Jul 2000 12:16:49 -0700 > To: <tyler.longren@midiowa.net> > From: "Jay Greenspan" <jay@trans-city.com> > Subject: Re: [PHP] Troubled code (or my troubled brain) > > Start by removing the quotes around the variable. > if ($id == $name) is more like it. > > this is also pretty weird: > > $result = mysql_query ("SELECT * FROM user_code WHERE language LIKE > 'php'"); > > use LIKE with wildcards, for instance > select .... where language like 'php%' > > otherwise.. > > select ... where language = 'php' > > -j > > >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@lists.php.net > >For additional commands, e-mail: php-general-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.general (#4414) next »