hello friends , here the code i did, the output is like http://www.domain.com/rai/2037/play.php and i want to insert this url and overwrite any existing value <?php $servername = "localhost"; $username = "root"; $password = "root"; $dbname = "tube"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT video FROM videos WHERE video LIKE '%rai%'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { preg_match('/(http:\/\/www.domain.com\/rai\/)(.*play.php)/', $row["video"], $link); if (empty($link[0])) { echo "Nothing found!"; } else { echo $link[0]; } } } $conn->close(); ?> PHP: here i want to replace $row["video"] value with $link[0] thanks for any help
} else { echo $link[0]; $conn->query('UPDATE videos SET video ="'.$link[0].'" WHERE video ="'.$row['video'].'"'); } PHP: