I Can't upload imige as my database donot support update although i give all previliges to the user root.Whats the problem??
Please Any one help me.The same code work on local PC.
The link is:


The code is given below:

$type= ".jpeg";
$fname = $fname.$type;
$uploaddir = 'upload/';
$uploadfile = $uploaddir . $fname;
if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
    $success="Data Added Successfully";
} else{
    $success= "There was an error uploading the file, please try again!";

$q="UPDATE `friendsdb`.`user` SET `link` = '$uploadfile' WHERE `user`.`id` ='$id' LIMIT 1 ;";

if(mysql_query($q)) echo "Your image uploaded successfully.";
else echo mysql_error();

<script language='javascript'>
alert('<?php echo $success; ?>');


You need to provide privileges to somethin_root (or whatever user you have created on your hosting) not the root. root user is not available on shared hosting environment.

Thanks brother mwasif.
I provide all the previliges
to user somethin_root
but the problen doesnot solved.
I also tried for user somethin_admin
also for user somethin_aman
but the result is same.
what can i do now?

Where are you facing this problem? On your local system or on a production server?

Run the following query to show the user's current rights

SHOW GRANTS FOR 'somethin_root'@'localhost';

Thanks a lot @brother mwasif.I solved my problem.
removing `friendsdb`. on line 15.
thanks a lot again.

What was the problem?

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.