Jump to content

Update Table Value's via Drop down box.


SiMoZ

Recommended Posts

Hey thanks for reading my thread, 

 

Currently im working on a Status Page for my Game Hacking Website. What i want todo is have a back Panel that i can Select "Game A" from a drop down box, and select the Detection status from another drop down box. Click the submit button, and it changes the values in the Database.

 

I'm new to coding in PHP.

<?PHP 
// Create connection

$con=mysqli_connect("localhost","Username","Password","Database");


// Check connection
if (mysqli_connect_errno($con))
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM haxstatus");

$Hackname="";
$Status="";
$update="";

while($row = mysqli_fetch_array($result)) 

{
	$id=$row["Status"];
  	$name=$row["GameName"];
  	$Hackname.="<OPTION VALUE=\"$id\">".$name.'</option>';
}
  

  
$list = mysqli_query($con,"SELECT * FROM haxstatus");

//dump the sql table in a table
echo "<table border='1'>
<tr>
<th>Game Name:</th>
<th>Detection Status:</th>
</tr>";

while($row = mysqli_fetch_array($list))
  {
  echo "<tr>";
  echo "<td>" . $row['GameName'] . "</td>";
  echo "<td>" . $row['Status'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

?>


    <p> 
    </p>
    <p> </p>
    <p>
      <SELECT NAME=name>
        <OPTION VALUE=0>Game Name
        <? echo $Hackname?>
      </SELECT>
            

      <SELECT Name="Detection">
        <OPTION VALUE=0>Edit Detection Status
        <OPTION VALUE=1>Detected
        <OPTION VALUE=2>Undetected         
      </SELECT>

          
<form action="update.php" method="post">
  <input type="submit">
</form>

  
<?PHP 
$con=mysqli_connect("localhost","Username","Password","Database");

if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
// i attempted to Update the table haxstatus and set Status to the drop down box named detection
$sql="UPDATE haxstatus SET Status=$_POST[Detection] WHERE ('GameName')";

if (!mysqli_query($con,$sql))
  {
  die('Error: ' . mysqli_error());
  }
echo "Updated";


mysqli_close($con);
?>

When i click submit i get this error 

 

Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/gamead/public_html/update.php on line 15
Error:

 

 

 

 

 

 

Thank you in advanced if you choose to help.

Edited by SiMoZ
Link to comment
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.