Jump to content
MakeWebGames

Recommended Posts

Posted

for the mail send function in my mailbox i want to use the string replace function and for the 2 arrays to select from a database and I'm stuck as for how to do it.

This is what i have now.

 

	$a=mysql_query("SELECT `from` FROM `replace`");	
		$from=mysql_fetch_array($a);
	$b=mysql_query("SELECT `to` FROM `replace`");
		$to=mysql_fetch_array($b);
	$newmail = str_replace($from, $to, $msg);

Posted

Re: Need a Tip

Using one query is much simplier, try it this way...

$sql_txt = 'SELECT `from`, `to` FROM `replace` WHERE `id` = \'' . $id . '\'';
$sql = mysql_query($sql_txt);
while($results = mysql_fetch_assoc($sql)) {
       $message = str_replace($results['from'], $results['to'], $message);
       // .. do whatever ..
}

 

But is your end goal to change a text from only one message, or how do you want this script to work?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...