Ok, the way i have it set up is when a user clicks the "mail me" link it echos there name in the compose form but i want to make also make it so they can compose a new mail, without the id link.
Its set up to get a name from there favorites, then a new compose but keeps getting an error:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL
result resource in /home/public_html/datingsite/compose.php on line 134
"Witch Is: $rowuser=mysql_fetch_object($ruser);"
Here is the php, any thoughts.
<? include("cookie.php");
include("connect.php");
if(!ereg("read_message",$HTTP_REFERER))
{
include("checksubscription.php");
}
if($send)
{
if($send==$UsErCoOkIe)
header("location:message.php?30");
}
if($submit)
{
if($sendto)
{
$quser1=mysql_query("select * from users where identity='$sendto'",$db);
$ruser1=mysql_fetch_object($quser1);
if($original)
$subject="RE: $subject";
$to_client_id=$ruser1->userid;
}
$rcuser=mysql_query("select * from users where identity='$UsErCoOkIe'",$db);
$rowcuser=mysql_fetch_object($rcuser);
$cuser=$rowcuser->identity;
$body=$body."\n\n";
$remail=mysql_query("select email from users where userid='$to_client_id'",$db);
$rowemail=mysql_fetch_object($remail);
$email=$rowemail->email;
if(!$subject)
{
$subject="[None]";
}
$que="insert into inbox(title,msg,userid,sender,time) values('$subject','$body','$to_client_id','$cuser',now())";
mysql_query($que,$db);
mysql_query("insert into outbox(title,msg,userid,sender,time)
values('$subject','$body','$to_client_id','$cuser',now())",$db);
mysql_query("insert into email(userid,sender,time) values('$to_client_id','$cuser',now())",$db);
// Edit the following variables to customize the message sent to the recipient
$sub="New mail in your dating account";
$url=$SITE_URL."login.php";
$content="There is new mail in your account at darkwaterstusio.net dating
To check the mail visit http://darkwaterstudio.net/datingsite/index.php";
$from="webmaster@darkwaterstudio.net";
sendmail($email,$sub,$content,$from);
// You should not need to edit any active code beneath this line
header("location:message.php?19");
}
?>
The Main Form:
<FORM method=post name=CFForm_1>
<table border=0 cellspacing=5 class=blue_text>
<tbody>
<tr>
<td align=right bgcolor="#E1E1E1" class="big_txt">To:</td>
<?if($send){?>
<td bgcolor="#E1E1E1" class="normal_txt"><input type="text" name="sendto" value=<?echo $send?>>
</td>
<?}else{?>
<td bgcolor="#E1E1E1" class="normal_txt"><?
$quser="select * from users where username='$UsErCoOkIe'";
$ruser=mysql_query($quser,$db);
$rowuser=mysql_fetch_object($ruser);
$userid=$rowuser->userid;
$query="select * from lovebasket where userid='$userid'";
$rto=mysql_query($query,$db);
?>
<select name=to_client_id>
<option value="">Select</option>
<?
while($rowto=mysql_fetch_object($rto))
{
$quser="select * from users where userid='$rowto->loveid'";
$ruser=mysql_query($quser,$db);
$rowuser=mysql_fetch_object($ruser);
$name=$rowuser->identity;?>
<option selected value=<?echo $rowto->loveid?>> <?echo $name?> </option>
<?}?>
</select>
(from your Favourites) </td>
<?}?>
</tr>
<tr>
<td align=right class="big_txt">Subject:</td>
<td class="normal_txt"><input maxlength=48 name=subject size=48>
</td>
</tr>
<tr>
<td align=right valign=top bgcolor="#F7F7F7" class="big_txt">Your Message:</td>
<td bgcolor="#F7F7F7" class="normal_txt"><textarea class=general_text cols=50 name=body rows=10><?
if($original){echo "\n\n";
for($i=0; $i<30;$i++){
echo "-";}echo "\n";?>Original Message:<?echo "\n"."\n";?><?echo stripslashes($original);}?></textarea>
</td>
</tr>
<tr>
<td align=middle colspan=2><input name="imageField" type="image" src="images/send_me.jpg" width="81" height="13" border="0">
<input type=hidden name=submit value="Send message">
<?if($original){?>
<input type=hidden name=original value="<?echo $original?>">
<?}?>
</td>
</tr>
</tbody>
</table>
</FORM>