[Solved] MySQL PHP Column Update Query


You haven’t provided any code or an attempt for us to go off of something so I’ll give you a brief way of doing it. Look up PDO here This is a really easy to follow and secure way to manipulate data in your database using php. Again as you haven’t given me much to go off i’m unsure if you want to just set something at specific count of characters along OR if you want to just update the entire thing, SO i’ll help you with the latter as it will help give you some base understanding.

Please read into PDO further as this is just an example further down the line and will not run if you just blindly copy and paste it in.

<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "test";

try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);


$sql = "UPDATE table SET x='yz,zyz,zy' WHERE id= 1"; // No clue if you've even given anything IDs

$stmt = $conn->prepare($sql);

$stmt->execute();

echo $stmt->rowCount() . " records UPDATED";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}

$conn = null;
?>

As you haven’t really provided any Schema of the table you are updating this is the best I could provide based off of what you have given me.. try to include as much information as possible as I’m unsure if this is what you even want

7

solved MySQL PHP Column Update Query