can someone kind give me a sample code it will be highly appreciated thanks!

Recommended Answers

All 3 Replies

update in what sense? do u want to create any table or want to alter any table?

try this.

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

mysql_query("UPDATE Persons SET Age = '36'
WHERE FirstName = 'Peter' AND LastName = 'Griffin'");

mysql_close($con);
?>

Again the same mistake! He wants to connect to the MSSQL and not the MySQL.
Your code modified below -

<?php
$con = mssql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mssql_error());
  }

mssql_select_db("my_db", $con);

mssql_query("UPDATE Persons SET Age = '36'
WHERE FirstName = 'Peter' AND LastName = 'Griffin'");

mssql_close($con);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.