No post editing :bemused:
I've learned that you can represent the variable for the primary key value using a URL extension to insert any primary key value into the WHERE statement.. though I'm having problems getting this to work correctly.
So for example when someone goes to website.com/file.php?game_id=45
It will use 45 as the primary key value for the WHERE id = variable statement, yes?
Here is what I have
update form
<?php
$link = mysqli_connect('mysql.powerhost.com','u195276486_comp','password','u195276486_comp');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$tbl_name="opl_comp"; // Table name
?>
<?php
$sql="SELECT notes FROM $tbl_name WHERE id='".$game_id."'";
$result=mysqli_query($link,$sql) or die("Error: ".mysqli_error($link));
?>
<p>edit game record #<?php echo $game_id;?></p>
<form id="form1" name="form1" method="post" action="update.php">
<textarea name="notesupdate" id="notesupdate" cols="45" rows="5"><?php echo $rows['notes']; ?></textarea>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</form>
<?php
// close MySQL connection
mysqli_close($link);
?>
As of now, this page will only display an empty text area
update action
<?php
//Connect & name table
$link = mysqli_connect('mysql.powerhost.com','u195276486_comp','password','u195276486_comp');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$tbl_name="opl_comp";
//grab text from the form
$notesupdate=$_POST['notes'];
//update notes column under specified primary key value
if(isset($_POST['submit'])) {
$update="UPDATE $tbl_name SET notes='".addslashes($notesupdate=$_POST['notes'])."' WHERE id='".$game_id."'";
$result=mysqli_query($link,$update) or die("Error: ".mysqli_error($link));
}
//Thanks
if($result){
echo "Thanks. You can view the compatibility list <a href='complist.php'>here</a>.";
echo "<BR>";
echo "<a href='insert.php'><-- Back to submission form</a>";
}
else {
echo "There was a problem. Please try again later.";
}
?>
<?php
// close connection
mysqli_close($link);
?>
Perhaps a nudge in the right direction might get this going for me, as usual :p