PHP

[php][/php]
Hi,

  Actually i'm  uploading  resume into Mysql Database.I created two pages:

1.uploadresume.php
2.uploader.php

In uploadresume.php:

   I created form to upload the resume.In that i created one more field for job type.I retrieve the values from Database for the Jobtype.

2.In Uploader.php:

     I wrote he code for uploading resume into MMysql Database.[b]

And My Doubt Is[/b]
How Can I insert the Jobtype values into database with resume?

These are my files please help me .It’s little urgent.

                                     [u] uploadresume.php[/u]
<?php ob_start(); session_start(); //database connection query $con=mysql_connect("localhost","root","")or die('could not connect'.mysql_error()); //database seletion query $sel=mysql_select_db("user_db"); $qry="select * from add_jobs"; $res=mysql_query($qry); $num_rows=mysql_num_rows($res); ?>
Upload Resume
Filename:
Select Job Type: --Select-- <?php while($row=mysql_fetch_array($res)) { ?> <?php echo $row['jobtitle']; ?> <?php } ?>

 

 

                                                                        [u]uploader.php[/u]
<?php ob_start(); session_start(); $con=mysql_connect("localhost","root","") or die("could not connect".mysql_error()); $sel=mysql_select_db("user_db",$con); if(isset($_FILES["fileToUpload"])&& $_FILES["fileToUpload"]["size"]>0) { echo $fileName = $_FILES["fileToUpload"]["name"]; echo $tmpName = $_FILES['fileToUpload']['tmp_name']; echo $fileSize = $_FILES["fileToUpload"]["size"]; echo $fileType = $_FILES["fileToUpload"]["type"]; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } $query = "INSERT INTO resume_tbl (name, type, size, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; $res=mysql_query($query) or die('Error, query failed'); if($query) { echo "
File $fileName uploaded
Login"; echo $jobtype; } else { echo "File Not Uploaded"; } }//if(isset($_POST['fileToUpload'])) ?>

Hi,

if I read you right you want to store in addition to the filepath, filesize, filetype and content (?) also a jobtype in the database.

[ol][li]you’ll have to alter the table so that it also has a ‘jobtype’ field.[/li]
[li]you’ll have to read the value from the reply.[/li]
[li]you’ll have to change the query so the value gets inserted.[/li][/ol]

  1. It’s probably easiest to do this via some sort of database administration tool. I don’t know if you have such a thing. look for ‘phpmyadmin’ or something. I guess you want to add it to ‘resume_tbl’.

  2. I see you generate a select with ‘name=“job”’ and I see you ‘echo $jobtype’ but I don’t see you read something into $jobtype.
    [php]
    $jobtype = $_POST[‘job’]; // The method in your form said so.
    [/php]

  3. After you’ve added a field to the database table ‘resume_tbl’ you want to change the query to reflect that and use it.
    [php]
    $query = "INSERT INTO resume_tbl (name, type, size, content, jobtype ) ".
    “VALUES (’$fileName’, ‘$fileSize’, ‘$fileType’, ‘$content’, ‘$jobtype’ )”;
    [/php]

Is this what you were looking for?

O.

Sponsor our Newsletter | Privacy Policy | Terms of Service