Jump to content

problems, problems :'(


beansandsausages

Recommended Posts

Hey all, My problem is ......

 

i have a script that gets the information from the db as followed :

 

 

$game_show = mysql_query(sprintf("SELECT * FROM `members` WHERE game_show='N' ORDER BY 'id' DESC ")) or die('Error: ' . mysql_error());

 

that works fine, when it brings the results up i want it to have a option to edit the details :

 <input type=text name=\"update\" value=".$on['game_show']." size=1> <input type=submit value=update> 

i just dont know how to save it in the database on that page,

i mean all the results will had diffrent values etc.. i have tried severl things and all just dont work.

Link to comment
https://forums.phpfreaks.com/topic/84861-problems-problems/
Share on other sites

  • Replies 56
  • Created
  • Last Reply

current code i am using is :

 

 
if($_GET[action] == 'update_off' )
			{
				//second level security

				if($info[security] <= '7' ) 

						{ 		
							$page_to_view = " Tried to view who has update off. ";

							echo "  <br /><br />$space<span style=\"color: orange\"> <strong>Unable to view this page. Level 7 security or higher required. This action has been logged.<strong></span> "; 
								$sql = "INSERT INTO `logged_1` (`id`, `username`, `player_id`, `page_to_view`, `ip_address`) VALUES ('','" . $info['username'] . "', '" .$info['id'].  "', '" . $page_to_view . "', '$info[ip]')";
       									if ( !$result = mysql_query($sql) ) { die('MySQL Error: ' . mysql_error());



					}		

			} else
				 { 
				echo " "; ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <?php echo "<br /> <br /> $space This is all game members who have the update messages turned <strong>off</strong>.   <br />";

				echo " $space <table width=\"50%\"> <td width=\"15%\">$space <u>Username</u></td> <td width=\"10%\"><u>Game Id</u></td> <td width=\"15%\"><u>Action</u></td> <td width=\"15%\"><u>Change</u></td></table>";

				$get_on = mysql_query(sprintf("SELECT * FROM `members` WHERE game_show='N' ORDER BY 'id' DESC ")) or die('Error: ' . mysql_error());
				while($on = mysql_fetch_array($get_on))
			{

				echo " <table width=\"50%\"> <td width=\"15%\"> $space <a href=\"view.php?\">" .$on['username']. "</a></td> <td width=\"10%\">" .$on['id']. "</td><td width=\"15%\">Contact</a></td><td width=\"15%\"><select><option value=No selected>No</option><option value=yes >Yes</select></option> <input type=submit value=update></td></table>";

}

		}
		}

 

Now i get a option value for each player but i cant seem to get it to work, i know there no form stuff in there i have just deleted it in a spit of madness {mad} argh ..

Link to comment
https://forums.phpfreaks.com/topic/84861-problems-problems/#findComment-432620
Share on other sites

the link is : <a href=?action=override&id=".$on['id'].">Change</a>

 

php code when link is clicked is :

 

 

if($_GET['action'] =='override&$on[id]') { echo " ".$on['id']." "; }

 

when link is clicked it displays the wrigh info : http://localhost/public/mem.php?action=override&id=2

 

just returns a blank page tho :(

Link to comment
https://forums.phpfreaks.com/topic/84861-problems-problems/#findComment-432650
Share on other sites

okay ill try explane it again.

 

I have this code :

	$get_on = mysql_query(sprintf("SELECT * FROM `members` WHERE game_show='N' ORDER BY 'id' DESC ")) or die('Error: ' . mysql_error());
while($on = mysql_fetch_array($get_on))

Witch works fine, it displays all members whos game_show is set to N, Then it displays them in a list :

 

User_1  id_990                |              Change

User_2  id_009                |              Change

User_3  id_954                |              Change

User_4  id_456                |              Change

 

The change is a form button :

<input type=text name=update value=".$on['game_show']." size=1> <input type=submit value=update>

 

What i need is to de able to hit the change button and it change the layout.

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/84861-problems-problems/#findComment-432759
Share on other sites

[code]CODE SORRY FOR CAPS BROKE BUTTON

if($_GET[action] == 'update_off' )

{

//second level security

 

if($info[security] <= '7' )

 

{

$page_to_view = " Tried to view who has update off. ";

 

echo "  <br /><br />$space<span style=\"color: orange\"> <strong>Unable to view this page. Level 7 security or higher required. This action has been logged.<strong></span> ";

$sql = "INSERT INTO `logged_1` (`id`, `username`, `player_id`, `page_to_view`, `ip_address`) VALUES ('','" . $info['username'] . "', '" .$info['id'].  "', '" . $page_to_view . "', '$info[ip]')";

      if ( !$result = mysql_query($sql) ) { die('MySQL Error: ' . mysql_error());

 

 

 

}

 

} else

{

echo "  <form action=\"mem.php?action=update\" method=\"post\"><br /> <br /> $space This is all game members who have the update messages turned <strong>off</strong>.  <br />";

[/code]

 

AND LINK BIT

 

if($_GET['action'] =='update' ) { echo " ".$_POST["game_show"]." "; }

 

SORRY I BETS ITS DEAD BASIC.

echo " $space <table width=\"50%\"> <td width=\"15%\">$space <u>Username</u></td> <td width=\"10%\"><u>Game Id</u></td> <td width=\"15%\"><u>Action</u></td> <td width=\"15%\"><u>Change</u></td></table>";

 

$get_on = mysql_query(sprintf("SELECT * FROM `members` WHERE game_show='N' ORDER BY 'id' DESC ")) or die('Error: ' . mysql_error());

while($on = mysql_fetch_array($get_on))

{

 

echo " <table width=\"50%\"> <td width=\"15%\"> $space <a href=\"view.php?\">" .$on['username']. "</a></td> <td width=\"10%\">" .$on['id']. "</td><td width=\"15%\">Contact</a></td><td width=\"15%\"><input type=text name=update value=".$on['game_show']." size=1> <input type=submit value=update></td></table>";

 

}

 

echo "<br /><br /> $space <a href=mem.php>Finished</a> "; }

 

THIS BIT OF CODE IS WHERE IF I CHANGE IT TO Y GET A DIFF LAYOUT

 

input type=text name=update value=".$on['game_show']." size=1>

Link to comment
https://forums.phpfreaks.com/topic/84861-problems-problems/#findComment-432780
Share on other sites

burnside, I don't get what you're trying to do. Your code is 'stupid' in a way. You're telling it to check if security is <= 7, and if so, you display an error and do something with the query which I don't know what. Otherwise, print out the form. No where in that code does it submit data to the database once a form is submitted and security is > 7.

 

Here, I rewrote your code a bit: (this uses $_POST and not $_GET. Don't use $_GET since you're not understanding it)

<?php
if($_POST['submit']){
//second level security
if($info[security] <= '7' ){ 		
	$page_to_view = " Tried to view who has update off. ";
	echo "  <br /><br />$space<span style=\"color: orange\"> <strong>Unable to view this page. Level 7 security or higher required. This action has been logged.<strong></span> "; 
	$sql = "INSERT INTO `logged_1` (`id`, `username`, `player_id`, `page_to_view`, `ip_address`) VALUES ('','" . $info['username'] . "', '" .$info['id'].  "', '" . $page_to_view . "', '$info[ip]')";
       	$result = mysql_query($sql) or die(mysql_error());
}
else {
	// Ken2k7: this is doing nothing, please finish this //
	echo " ";
?>
<form method="post"> <?php echo "<br /> <br /> $space This is all game members who have the update messages turned <strong>off</strong>.   <br />";
	echo " $space <table width=\"50%\"> <td width=\"15%\">$space <u>Username</u></td> <td width=\"10%\"><u>Game Id</u></td> <td width=\"15%\"><u>Action</u></td> <td width=\"15%\"><u>Change</u></td></table>";
	$get_on = mysql_query(sprintf("SELECT * FROM `members` WHERE game_show='N' ORDER BY 'id' DESC ")) or die('Error: ' . mysql_error());
	while($on = mysql_fetch_array($get_on)){
		echo " <table width=\"50%\"> <td width=\"15%\"> $space <a href=\"view.php?\">" .$on['username']. "</a></td> <td width=\"10%\">" .$on['id']. "</td><td width=\"15%\">Contact</a></td><td width=\"15%\"><select name='meselect'><option value='No selected'>No</option><option value=yes >Yes</select></option> <input type=submit name=submit value=update></td></table>";
	}
}
}

Link to comment
https://forums.phpfreaks.com/topic/84861-problems-problems/#findComment-432788
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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