Jump to content

Recommended Posts

Hi there!

 

My current output is the following:

 

ID Name Logged In GM E-Mail Banned 
1  Admin_Zack  0  4   0  
4  itsaname  2  0   0  
5  GUEST1  0  0   0  
6  Branden  2  4  syekiya@verizon.net  0  
7  Account  0  0   0  

 

What I want to do is the following:

If Logged in is 2, replace the number 2 with the word Yes.

 

 

Here is my script!

 

 

Please Note: Ignore $content .=

This is used on a CMS that uses $content .= as a placeholder on where to put the information!

 

$con = mysql_connect($dbhost, $dbuser, $dbpass);
$update = $_POST['UpdateEmail'];




mysql_select_db($dbname, $con);
$members = mysql_query ('SELECT * FROM accounts') or die ('Error: '.mysql_error ());
$content .= "
<center>
<table border=\"1\">
<tr>
<th>ID</th><th>Name</th><th>Logged In</th><th>GM</th><th>E-Mail</th><th>Banned</th>
</tr>
";

// $banned = str_replace({$row['banned']}, "Yes");

while($row = mysql_fetch_array($members, MYSQL_ASSOC))
{

$content .= "
<tr>
<td> {$row['id']} </td>
<td> {$row['name']} </td>
<td> {$row['loggedin']} </td>
<td> {$row['gm']} </td>
<td> {$row['email']} </td>
<td> {$row['banned']} </td>
</tr>
";
}
$content .= "</table></center></div>";

if ($update != $null) {
mysql_select_db($dbname, $con);
mysql_query("UPDATE accounts
INNER JOIN phpbb_users 
SET accounts.email = phpbb_users.user_email
WHERE accounts.name = phpbb_users.username");
header( 'Location: http://www.mapleluv.com/index.php?pid=4' ) ;

}

$content .= "
<center>
<br><br>
<form action=\"http://www.mapleluv.com/index.php?pid=4\" method=\"post\">
<input type=\"submit\" value=\"Update E-Mail Addresses\" name=\"UpdateEmail\"
</form>
</center>
";


?>

 

 

 

Thank you very much!

Syekiya

Link to comment
https://forums.phpfreaks.com/topic/153484-replace-output-from-mysql-select-quary/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.