Re: One more question

From: Date: Tue, 27 Jun 2000 17:05:29 +0000
Subject: Re: One more question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3369@lists.php.net to get a copy of this message
Hi Tyler, You could be running into the problem in several different areas of your code. I would recommend: Assigning your query to a variable. When you are debugging, print out the variable - this way you can see exactly what the query is - you can also then try the query directly in MySQL. i.e. print $query = "SELECT language, description, date, type, email, id, name FROM user_code where id = '$id'"; $result = mysql_query ($query); Use print mysql_error() after making queries. This will show you any errors that are happening with MySQL. HTH, Zak At 01:08 AM 6/27/00 -0700, Tyler Longren wrote:
Hey Zak, You did a good job of answering my question before...here's another for you. The provided code doesn't display anything. It's supposed to display the code with the $id (http://www.url.com/viewcode.php?id=$id). <? $connection = mysql_connect("xxx","xxx","xxx") or die ("Unable to connect to server."); $db = mysql_select_db("cr0n", $connection) or die ("Unable to find requested database."); $result = mysql_query ("SELECT language, description, date, type, email, id, name FROM user_code where id = '$id'"); 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"]; echo"<Center><u><b>PHP Code</u></b></center><Br><table width=75% cellspacing=0 cellpadding=0 bgcolor=#000000><tr><td bgcolor=#000000><table width=100% height=0% border=0 cellspacing=0 cellpadding=0> <tr>
    <td height=8 bgcolor=#000000><font color=#FFFFFF size=-1 face=Arial,
Helvetica, sans-serif>Author:
      <a href=\"mailto:$email\"><font Helvetica,
sans-serif>$author</font></a>&nbsp;&nbsp;&nbsp;Views:"
      require 'counter.php3';
echo "</font></td></tr><tr><td height=124 valign=top bgcolor=#4A5A63>"; show_source("./code/$id.txt"); echo "</td></tr></table></td></tr></table>"; } mysql_free_result($result); ?> Any ideas? Regards, Tyler Longren
Zak Greant Creative Director Nucleus Information Service Inc. "A camel is a horse designed by a committee." - Alex Issigonis (Designer of the Mini)

« previous php.general (#3369) next »