Jump to content

Html Output to view file on server linked to a database


sperophp

Recommended Posts

@move_uploaded_file( $upload_Temp , $uploadFile); 
chmod($uploadFile, 0644);
$upload_URL = "uploads/".$upload_Name ;
$uploadFile = "uploads/".$upload_Name ;
$id=$_POST['id'];
 $name=$_POST['name']; 
 $upload_Name=($_FILES['FILE']['name']);
 //Writes the information to the database
 mysql_connect("localhost", "freak_admin", "what") or die(mysql_error()); 
 mysql_select_db("freak_doc") or die(mysql_error()); 
 mysql_query("INSERT INTO `users_cv` VALUES ('$id', '$name', '$upload_Name')");

Hello Good Php Gurus!

 

i have tried to find my way around this but no show.from the php admin everything works fine including the name of the file visible.

 

the above code works when i view the info on my view.php(the field for name shows)

however the field for upload_name is blank because the idea I had isnt working below

<td> echo "<a href=" ./ $upload_URL . basename($row_users['file']) . ">

         {$row_users['upload_Name']}</a>";</td>

 

Can someone help me with what i am doing wrong?

 

thanks

newbie

 

i dont really understand your question but at first glance, you are assigning $upload_Name in line 7, but you refer to it in line 3

$upload_URL = "uploads/".$upload_Name ;
...
...
$upload_Name=($_FILES['FILE']['name']);

fyi, youd prolly get better help in a different forum.  this is not an HTML question

Do not really understand where you coming from.

But this line seems weird to me.

mysql_query("INSERT INTO `users_cv` VALUES ('$id', '$name', '$upload_Name')");

 
isn't it be like mysql_query("INSERT INTO `users_cv` (id,name,upload_Name) VALUES ('$id', '$name', '$upload_Name')"); ??

If the VALUES provides a value for every column in the table in the correct order then there is no need to specify the column names.

 

However, as you suggest, it is better to do so. If the table is subsequently altered the the query will fail if the columns are not specified.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.