Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Insert data in to the textbox in PHP Reply To: Insert data in to the textbox in PHP

#169293
dnyanesh
Participant

hey Traq Good morning,

Thanks for reply…

yesterday i made some changes in update code now it is working…. sorry i am troubling you.

i have started MYSQLi . but the problem my all colleagues are using mysql and as i am new. i may ask you some fullish questions while learning.

instead of mysql in the above code if i use mysqli . Do i need to config any file or else i can use it directly as per the syntax given in the manual

<?php
$con = mysql_connect(“localhost”,”root”,””);
mysql_select_db(“firstweb”);
$id =$_GET[‘id’];
if (isset($_POST[“update”]))
{
$name = mysql_real_escape_string(htmlspecialchars($_POST[“name”]));
$email = mysql_real_escape_string(htmlspecialchars($_POST[“email”]));
$date = mysql_real_escape_string(htmlspecialchars($_POST[“date”]));
$mobile = mysql_real_escape_string(htmlspecialchars($_POST[“mobile”]));
$gender = mysql_real_escape_string(htmlspecialchars($_POST[“gender”]));
$lang = mysql_real_escape_string(htmlspecialchars($_POST[“lang”]));
//$photo =($_POST[“photo”]);
$photo=$_FILES[‘file’][‘name’];
move_uploaded_file($_FILES[‘file’][‘tmp_name’],”targetfolder/”.$photo);
//$id = mysql_real_escape_string(htmlspecialchars($_POST[“id”]));

                               mysql_query("UPDATE emp_data SET name='$name',email='$email',date='$date',mobile='$mobile',gender='$gender',lang='$lang',photo='$photo' where id='$id'");
        }
                       $result = mysql_query("SELECT * FROM emp_data WHERE id='$id'");

                       $row =mysql_fetch_array($result);

 ?&gt;

Guide me on this….