Hi all,

Having a small issue with some PHP i'm re-writing.
I'm converting my old mysql to Mysqli for a new project.

my database is called "jobboard" my table is called "details".

The Idea is to have a drop down and then select the persons name (Which has the ID).
So it would be http://www.domain.com/Update.php?ID=5

or something...

This is the error I am getting:

Notice: Undefined index: ID in C:\wamp\www\JobBoard\Admin\Update.php on line 16
SELECT ID, Employer, LearningProvider, ContractedProvider, LearningDeliverySite, VacancyDescription, VacancyTitle, EmployerDescription, VacancyLocation, WorkingWeek, WeeklyWage, NoVacancies, VacancyRefNumber, ClosingDateForApplications, InterviewBeginForm, PossibleStartDate, TrainingToBeProvided, LearningProviderDescription, ContactDetails, VacancyType, ApprenticeshipFramework, SkillsRequired, PersonalQualities, ImportantOtherInformation FROM details WHERE ID = ''

No database selected

However, I am pretty sure I am selecting a db etc as I am adding and deleting users?

<?php


        // Connect to our DB with mysql_connect(<server>, <username>, <password>)    
        mysqli_connect("localhost", "Jobboard","Password123", "jobboard") or die(mysql_error());
       // mysqli_select_db($con,"jobboard" ) or die(mysql_error());

$error='';
require('config.php');
require('header.php');
echo '<a href="logout.php">Logout</a>';


            $employer_id = $_POST['ID'];

            $query = "SELECT ID,
                     Employer,
                    LearningProvider,
                    ContractedProvider,
                    LearningDeliverySite,
                    VacancyDescription,
                    VacancyTitle,
                    EmployerDescription,
                    VacancyLocation,
                    WorkingWeek,
                    WeeklyWage,
                    NoVacancies,
                    VacancyRefNumber,
                    ClosingDateForApplications,
                    InterviewBeginForm,
                    PossibleStartDate,
                    TrainingToBeProvided,
                    LearningProviderDescription,
                    ContactDetails,
                    VacancyType,
                    ApprenticeshipFramework,
                    SkillsRequired,
                    PersonalQualities,
                    ImportantOtherInformation 
                          FROM details WHERE ID = '{$employer_id}'";

            $result = mysql_query($query) or die('<p>' . $query . '</p><div>' . 
                                   mysql_error() . '</div>');

            $Employer = mysql_fetch_assoc($result);  

?>
 <h2>Updating <?php echo $Employer['Employer'] ?></h2>
                <div class="block ">
                    <table class="form">
                       <form name="Form" action="update_ac.php" method="post">
<!--Intro-->
Employer: <input type="text" name="Employer" value="<?Php echo $Employer['Employer']?>"><br></p>
Learning Provider: <input type="text" name="customer_name_letterhead" value="<?Php echo $Employer['LearningProvider']?>"><br>
Contracted Provider: <input type="text" name="customer_name_letterhead" value="<?Php echo $Employer['ContractedProvider']?>"><br>
Notes go here
</textarea><br>

Thanks

mysqli_connect does not combine with mysql_query

Member Avatar for diafol

Undefined index: ID in C:\wamp\www\JobBoard\Admin\Update.php on line 16

Well, you don't have post data such as a form field sent, e.g.

<input ... name="ID" />

Use an

if(isset($_POST['ID'])){    

Maybe

using a mysqli with mysql is the issue :)

Member Avatar for diafol

Yep, my mistake.

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.