iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-26-2008, 03:23 AM
edhan's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Singapore
Posts: 716
edhan RepRank 3edhan RepRank 3edhan RepRank 3
Default How to inlcude email in table?

Hi

Hope this is the correct section to ask. I am confused as why I can include the email into the new table. Here is the extraction portion where I am trying to include the email.
Code:
function get_id_by_username($user)
{
$cond = "username='".trim($user)."' and active='1'";
$result = getField("register",$cond,"userid");

if($result != false && mysql_num_rows($result)>0)
{
$row = mysql_fetch_array($result);
return $row[0];
}

else
{
return false;
}
}
if($_POST['btnsend']==$__syslang["Send"])
{
$flagexists=strpos($_POST['txtemailids'],",");
if($flagexists)
{
$toemailids = explode(",",$_POST['txtemailids']);
}
else
{
$toemailids = $_POST['txtemailids'];
}
$sent = 0;
if(is_array($toemailids))
{
$lastmsgid = get_last_msgid();

for($i=0;$i<count($toemailids);$i++)
{
$tofriendid = get_id_by_username($toemailids[$i]);
	if($tofriendid)
{
	if(check_addressbook($_SESSION['userid'], $tofriendid))
{
	$check_msg .= " - $toemailids[$i]<br>";
	$failed = 1;
{
	$res =get_user($tofriendid,"username");
	$row = mysql_fetch_array($res);
	$usersname =$row['username'];
	$msg .= "- $usersname<br>";

}
	$table_name = "friendrequests";
	$field_names = "fromid,toid,messageid,ondate";
	$val = array();
	$val[0] = $_SESSION['userid'];
	$val[1] = $tofriendid;
	$val[2] = ($lastmsgid + 1);
	$val[3] = date("Y-m-d h:m:s");
	$insertedid = insert_into_db($table_name, $field_names, $val);
if($insertedid > 0)
	{
$sentmsg .= " - $toemailids[$i]<br>";
	$sent = 1;
	$inserted = 1;
Here are the portion that I modify but still can't work.

Code:
	if(check_addressbook($_SESSION['userid'], $tofriendid, $tofriendemail))
...
	$res =get_user($tofriendid,"username",$tofriendemail,"email");
	$row = mysql_fetch_array($res);
	$usersname =$row['username'];
	$email =$row['email'];
	$msg .= "- $usersname<br>- $email";
....

	$table_name = "friendrequests";
	$field_names = "fromid,toid,email,messageid,ondate";
	$val = array();
	$val[0] = $_SESSION['userid'];
	$val[1] = $tofriendid;
	$val[2] = $tofriendemail;
	$val[3] = ($lastmsgid + 1);
	$val[4] = date("Y-m-d h:m:s");
	$insertedid = insert_into_db($table_name, $field_names, $val);
But I can't seem to add the email into the table. It just only add userid, username, msg and date into the table.

What did I do wrong? Any help is greatly appreciated. Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-27-2008, 11:02 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,648
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: How to inlcude email in table?

Its the @ symbol in the following line:
$res =get_user($tofriendid,"username",$tofriendemail,"email");
I am assuming the bolded portion is actually "username@domain.com".

Two solutions. Either change the line to this:
$res =get_user($tofriendid,"username",$tofriendemail,'username@domain.com');
(note the quotes) or to this:
$res =get_user($tofriendid,"username",$tofriendemail,"username\@domain.com");
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #3 (permalink)  
Old 10-27-2008, 11:48 AM
edhan's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Singapore
Posts: 716
edhan RepRank 3edhan RepRank 3edhan RepRank 3
Default Re: How to inlcude email in table?

Quote:
Originally Posted by wige View Post
Its the @ symbol in the following line:
$res =get_user($tofriendid,"username",$tofriendemail,"email");
I am assuming the bolded portion is actually "username@domain.com".

Two solutions. Either change the line to this:
$res =get_user($tofriendid,"username",$tofriendemail,'username@domain.com');
(note the quotes) or to this:
$res =get_user($tofriendid,"username",$tofriendemail,"username\@domain.com");
Yes. email is the username@domain.com

$res =get_user($tofriendid,"username",$tofriendemail,"username\@domain.com");

The email is the field in the table. Same goes with the username is the field in table. The $tofriendid will actually be in the form of username1,username2,username3 .... or just username1 added into a new table. So, if it is username1,username2,username3 then the email will be emailuser1,emailuser2,emailuser3 will be added into the new table.

As the username1,username2,username3 will be entered manually by my user to be included as friend in the new table, the emails have to be corresponding to the username1,username2,username3 etc from the default table and save into a new table.

Hope this explanation is not too confusing. So, I won't be able to define username@domain.com since I will not know what username will be key in.
Reply With Quote
  #4 (permalink)  
Old 10-28-2008, 05:59 AM
edhan's Avatar
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Singapore
Posts: 716
edhan RepRank 3edhan RepRank 3edhan RepRank 3
Default Re: How to inlcude email in table?

Quote:
Originally Posted by edhan View Post
Yes. email is the username@domain.com

$res =get_user($tofriendid,"username",$tofriendemail,"username\@domain.com");

The email is the field in the table. Same goes with the username is the field in table. The $tofriendid will actually be in the form of username1,username2,username3 .... or just username1 added into a new table. So, if it is username1,username2,username3 then the email will be emailuser1,emailuser2,emailuser3 will be added into the new table.

As the username1,username2,username3 will be entered manually by my user to be included as friend in the new table, the emails have to be corresponding to the username1,username2,username3 etc from the default table and save into a new table.

Hope this explanation is not too confusing. So, I won't be able to define username@domain.com since I will not know what username will be key in.
Also, how to change this to include the email?

function get_id_by_username($user)

$cond = "username='".trim($user)."' and active='1'";

$result = getField("register",$cond,"userid");

if($result != false && mysql_num_rows($result)>0)

The above extract the username so how do I add the email to change $cond = "username='".trim($user)."', email and active='1'";
but still not showing email to add.

Any advice how to change that?
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML email versus PLAIN TEXT email - eCommerce Site fulleffect Graphics & Design Discussion Forum 10 09-05-2008 10:21 PM
Email spam bots - display name vs. actual email address apalmer123@msn.com Web Programming Discussion Forum 25 09-04-2007 02:13 PM
Email (not address, but email body) publishing ADAM Web Design Internet Industry 1 08-23-2007 11:05 PM
Forged Email Headers and Email Load on Server zephyrireland Hosting Issues 13 10-05-2006 07:28 PM
Table Align to table sysop9999 Graphics & Design Discussion Forum 3 11-10-2005 11:00 AM


All times are GMT -4. The time now is 06:08 AM.



Search Engine Optimization by vBSEO 3.3.0