<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Your code seems to work for a menu change where the
uid, I want to be the uid of the member who is navigating the site.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I will also have similar links on members' user
pages, profile pages, etc....so for these, the uid wouldn't change, it would
always be the uid of that node's author.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I made the following change and it seems to
work:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><?php<BR>global $user;<BR>$node_type =
'story';<BR>if (db_num_rows(db_query("SELECT * FROM {node} WHERE type='%s' AND
uid=%d", <BR>$node_type, <STRONG><FONT
color=#ff0000>$node->uid</FONT></STRONG>))) {<BR> print(t("View
Story"));<BR>}<BR>else {<BR> print(t("Create
Story"));<BR>}<BR>?></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>----- Original Message ----- </FONT>
<DIV><FONT face=Arial size=2>From: "Jason Flatt" <</FONT><A
href="mailto:drupal@oadaeh.net"><FONT face=Arial
size=2>drupal@oadaeh.net</FONT></A><FONT face=Arial size=2>></FONT></DIV>
<DIV><FONT face=Arial size=2>To: <</FONT><A
href="mailto:support@drupal.org"><FONT face=Arial
size=2>support@drupal.org</FONT></A><FONT face=Arial size=2>></FONT></DIV>
<DIV><FONT face=Arial size=2>Sent: Friday, October 05, 2007 3:34 PM</FONT></DIV>
<DIV><FONT face=Arial size=2>Subject: Re: [support] db query to find out if
member has node of type X</FONT></DIV></DIV>
<DIV><FONT face=Arial><BR><FONT size=2></FONT></FONT></DIV><FONT face=Arial
size=2>> On Friday 05 October 2007 03:02:22 Neil: esl-lounge.com
wrote:<BR>>> How would I find out if User A had authored a node of type
X?<BR>>><BR>>> I have a link "View Story" that I would like to be
"Create Story" if that<BR>>> member hasn't yet created that node
type.<BR>>><BR>>> Is that a complicated db query to do?<BR>>
<BR>> Probably something like this would do it:<BR>> <BR>> global
$user;<BR>> $node_type = 'story';<BR>> if (db_num_rows(db_query("SELECT *
FROM {node} WHERE type='%s' AND uid=%d", <BR>> $node_type, $user->uid)))
{<BR>> print(t("View story"));<BR>> }<BR>> else {<BR>>
print(t("Create story"));<BR>> }<BR>> <BR>> Note: that is totally
untested code and is likely to contain one or more <BR>> errors.<BR>>
<BR>> -- <BR>> Jason Flatt<BR>> </FONT><A
href="http://www.oadaeh.net/"><FONT face=Arial
size=2>http://www.oadaeh.net/</FONT></A><BR><FONT face=Arial size=2>> Father
of Six: </FONT><A href="http://www.flattfamily.com/"><FONT face=Arial
size=2>http://www.flattfamily.com/</FONT></A><FONT face=Arial size=2> (Joseph,
14; Cramer, 12; Travis, <BR>> 10; Angela; Harry, 7; and William, 12:04 am,
12-29-2005)<BR>> Linux User: </FONT><A
href="http://www.xubuntu.org/"><FONT face=Arial
size=2>http://www.xubuntu.org/</FONT></A><BR><FONT face=Arial size=2>> Drupal
Fanatic: </FONT><A href="http://drupal.org/"><FONT face=Arial
size=2>http://drupal.org/</FONT></A><BR><FONT face=Arial size=2>> -- <BR>>
[ Drupal support list | </FONT><A href="http://lists.drupal.org/"><FONT
face=Arial size=2>http://lists.drupal.org/</FONT></A><FONT face=Arial size=2>
]<BR>></FONT></BODY></HTML>