links to enter or change information

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

links to enter or change information

Post by irealms »

How would i create a link that when clicked would change info in a database?

For example i have a user list for admin to view and i want them to be able to approve or deny (and hence delete) the user if they are not approved already.
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

present

Post by irealms »

Code: Select all

<?
//show members

$query = "SELECT username,charname,email,approved,rank FROM users";
$result = mysql_query($query, $db_conn) or die('query failed');
$num_results = mysql_num_rows($result);
echo '<table cellspacing="5" cellpadding="5"><tr><td><div class="log"><u>Username</u></div></td><td><div class="log"><u>Main character name</u></div></td><td><div class="log"><u>Rank?</u></div></td><td><div class="log"><u>Approved?</u></div></td></tr>';
while ($row = mysql_fetch_assoc($result)) 
&#123;
	
	if ($row&#1111;'approved'] == 1)
	&#123;
		$approved = Yes;
	&#125;
    else 
		&#123;
		$approved = No;
	&#125;
	if ($row&#1111;'rank'] == 1)
	&#123;
		$rank = Officer;
	&#125;
	if ($row&#1111;'rank'] == 2)
	&#123;
		$rank = Leader;
	&#125;
	else
	&#123;
		$rank = Member;
	&#125;
	
	echo '<tr><td><div class="log">'.$row&#1111;username].'</div></td>';
	echo '<td><div class="log">'.$row&#1111;charname].'</div></td>';
	echo '<td><div class="log">'.$rank.'</div></td>';
	echo '<td><div class="log">'.$approved.'</div></td>';
	if ($approved == Yes)
	&#123;
		echo '<td><div class="log"><a href="">Delete</a></div></td>';
	&#125;
	
		&#125;
	echo '</table>';
?>
that is the current code i am not sure what to put in the link so that a query can be activated when the link is clicked.
Post Reply