On the same page that an INSERT INTO takes place, I need to grab that newly created row's auto increment value to store a unique URL inside another column on the same row, and have an image to represent the url.
I figure that after the data submission, a new query could be made to get the newest id (using mysqli_insert_id) and place the id at the end of a url, then INSERT or UPDATE that url into a column.. is that right?
I've tried a few things, but I either get errors, or no errors but no UPDATE or INSERT happens. Here is what I was just messing with.
<?php
//Grab new insert ID
$id=mysqli_insert_id($link);
?>
<input type="radio" name="editurl" value="http://www.somesite.com/somefile.php?variable=$id" style="display:none;" checked="checked">
<?php
//Insert value containing specific ID
$tbl_name="opl_comp";
$editurl=$_POST['editurl'];
$editlink="UPDATE $tbl_name SET edit='$editurl' WHERE id='$id'";
$result=mysqli_query($link,$editlink) or die("Error: ".mysqli_error($editlink));
?>
I was trying with this, hoping to at least get the URL into the database, then go from there.. though even if it worked, I'd still be unsure how to get an image to display in place of text.
Any tips on accomplishing this would be helpful