[thelist] PHP Newbie Stuck....

sales at iibiz.com sales at iibiz.com
Fri Jun 1 10:44:16 CDT 2001


Hi all!

Lets see, got my database (CLIENTS) set up, made an input form that appears
to be working, but I'm having trouble with my "output" form.

I'm getting an error stating:

"Warning: Supplied argument is not a valid MySQL result resource at line
36."

My code from line 36 on is posted below.

"cname" is identified further up on the page........any body see what my
problem could be?  (Besides the fact that I'm a moron?!?)(The core of this
code was copied from a book I'm using, but I inserted MY tables and
variables......)

while ($row = mysql_fetch_array($result)) {
 $cname = $row["cname"];
 $sql2 = "select * from CLIENTS where company_name = $cname";
 $result2 = mysql_query($sql2);
 $row2["FIELD"] = mysql_fetch_array($result2);
print("<tr><td bgcolor=\"#003399\"><b>");
printf("<font color=\"white\">%s</font></b></td></tr>\n",
$row["company_name"]);
printf("<td>By: %s\n",
$row["name"]);
printf("<br>Posted: %s<hr>\n",
$row["type"]);
printf("%s</td></tr>\n",
$row["body"]);
}

Thanks,
Sandy





More information about the thelist mailing list