Jump to content

Search the Community

Showing results for tags 'insertquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi I have two tables Employer and Job. Emp_ID as PK of Employer and Job_id as PK of Job. I want to put Emp_ID as Foreign key for jobs. and when the employer logs in his empid is being stored as a session and when he creates a job his empid will be entered in the job table. I've created my session, and insert query but it doesn't seem to work, as emp_id in Job table doesnt get updated. All my other values(cname, location) works. The empid is autoincrement from the Employer table. //joblisting.php code <?php session_start(); $empid = $_SESSION['empid']; if(!(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] == "YES")) { header("Location: index.php"); exit; } $dbhost = 'localhost'; $dbname = 'jobseeker1'; $dbuser = 'root'; $dbpass = ''; $con = @mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname, $con); $cname=mysql_real_escape_string($cname); $jobtitle=mysql_real_escape_string($jobtitle); $jobtype=mysql_real_escape_string($jobtype); $jobresp=mysql_real_escape_string($jobresp); $jobreq=mysql_real_escape_string($jobreq); $location=mysql_real_escape_string($location); $salary=mysql_real_escape_string($salary); $phone=mysql_real_escape_string($phone); $email=mysql_real_escape_string($email); $sql="INSERT INTO `joblisting` (cname, jobtitle, jobtype, jobresp, jobreq, location, salary, phone, email, empid) VALUES('$_POST[cname]','$_POST[jobtitle]','$_POST[jobtype]','$_POST[jobresp]','$_POST[jobreq]','$_POST[location]','$_POST[salary]','$_POST[phone]','$_POST','$empid')"; $result=mysql_query($sql); if($result){ echo "1 job listing added"; echo "<a href='employerpage.php'> Go back to employer page</a>"; } else { echo "<a href='addjob.php'> Can not add job. Try again.</a>."; die(mysql_error()); } ?>
×
×
  • 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.