Hi,
My problem is this I have an insert statement that works fine and all the relevant info goes into my database.
The first two fields are id_premium & user_id. Once this info is entered the next thing i want to do is select the id_premium where user_id = whatever but i keep getting
Resource #7 to echo out instead of the id_premium number.
Could someone please have a look at the code i'm baffled
Regards
Graham
if (isset($_POST['submit']))
// Check if the form has been submitted
{
// Connect to the database
require_once ('../mysql_connect3.php');
$a = $_SESSION['user_id'];
$b = escape_data($_SESSION['qualifications']);
$c = escape_data($_SESSION['experience']);
$d = escape_data($_SESSION['additional_locations']);
$e = escape_data($_SESSION['availability']);
$f = escape_data($_SESSION['rate_per_hour']);
$g = escape_data($_SESSION['additional_number']);
$h = escape_data($_SESSION['email_address']);
$i = escape_data($_SESSION['additional_information']);
$j = escape_data($_SESSION['county']);
$k = escape_data($_SESSION['town']);
$l = escape_data($_SESSION['contact_name']);
$m = escape_data($_SESSION['contact_number']);
// Add the premium add
$query1 = "INSERT INTO premium
(
user_id,
qualifications,
experience,
additional_locations,
availability,
rate_per_hour,
additional_number,
email_address,
additional_information
)
VALUES
(
'$a',
'$b',
'$c',
'$d',
'$e',
'$f',
'$g',
'$h',
'$i'
)";
$result1 = @mysql_query($query1);
if ($result1)
{
********** Problem *****************
// Select the id_premium from the premium table before inserting into the users table
$query2 = "SELECT id_premium FROM premium WHERE user_id='$a'";
$result2 = @mysql_query ($query2);
echo"$result2"; // This outputs Resource #7
echo '</div>'; // This div is to shut the header div early NB !!
include('includes/footer.htm');
exit();
}
My problem is this I have an insert statement that works fine and all the relevant info goes into my database.
The first two fields are id_premium & user_id. Once this info is entered the next thing i want to do is select the id_premium where user_id = whatever but i keep getting
Resource #7 to echo out instead of the id_premium number.
Could someone please have a look at the code i'm baffled
Regards
Graham
if (isset($_POST['submit']))
// Check if the form has been submitted
{
// Connect to the database
require_once ('../mysql_connect3.php');
$a = $_SESSION['user_id'];
$b = escape_data($_SESSION['qualifications']);
$c = escape_data($_SESSION['experience']);
$d = escape_data($_SESSION['additional_locations']);
$e = escape_data($_SESSION['availability']);
$f = escape_data($_SESSION['rate_per_hour']);
$g = escape_data($_SESSION['additional_number']);
$h = escape_data($_SESSION['email_address']);
$i = escape_data($_SESSION['additional_information']);
$j = escape_data($_SESSION['county']);
$k = escape_data($_SESSION['town']);
$l = escape_data($_SESSION['contact_name']);
$m = escape_data($_SESSION['contact_number']);
// Add the premium add
$query1 = "INSERT INTO premium
(
user_id,
qualifications,
experience,
additional_locations,
availability,
rate_per_hour,
additional_number,
email_address,
additional_information
)
VALUES
(
'$a',
'$b',
'$c',
'$d',
'$e',
'$f',
'$g',
'$h',
'$i'
)";
$result1 = @mysql_query($query1);
if ($result1)
{
********** Problem *****************
// Select the id_premium from the premium table before inserting into the users table
$query2 = "SELECT id_premium FROM premium WHERE user_id='$a'";
$result2 = @mysql_query ($query2);
echo"$result2"; // This outputs Resource #7
echo '</div>'; // This div is to shut the header div early NB !!
include('includes/footer.htm');
exit();
}