I have a database with just 2 fields. The first is a list of numbers and the second is a status of the numbers. I am trying to have a form that will allow me to mass input the list of numbers and update their status to used. I cannot figure out where I am messing up. Any and all help is much appreciated.
The PHP
$pin=$_POST['pin'];
$xx=explode("\n", $pin);
$sql="UPDATE new_table SET Status = 'used' WHERE number = '". $pin . "'";
foreach($xx as $pin){
if($pin!=""){
$sql.="('".trim($pin)."'),";
}
}
$sql=substr($sql,0,-1);
$mysql=new mysqli('127.0.0.1', '******', '********', '******');
$mysql->query($sql);
$mysql->close();
}
?>
The form
<html>
<body>
<form method="post">
<label> Enter Sims (1 for each line)</label>
<br/>
<textarea rows="10" cols="100" name="pin" ></textarea>
<br/>
<input type="submit" value="save" />
</form>
</body>
</html>