Jump to content

[SOLVED] Why is this query giving errors?


jwwceo

Recommended Posts

$query="INSERT INTO reservations (package_id,user_id,ccnum,exp_date,avs,total,num_people,)
VALUES('$_SESSION['packageid_v']','$_SESSION['user_id_v']','$_SESSION['ccnum_v']','$_SESSION['expdate_v']','123','$_SESSION['total_v']','$_SESSION['numpeople_v']')";

 

I get an T_ENCAPSED_AND_WHITESPACE error. But can't see why?

 

JW

Link to comment
https://forums.phpfreaks.com/topic/81730-solved-why-is-this-query-giving-errors/
Share on other sites

Your getting it because of the multiple quotes used incorrectly. Try

<?php
$query="INSERT INTO reservations (package_id,user_id,ccnum,exp_date,avs,total,num_people,)
VALUES('{$_SESSION['packageid_v']}', '{$_SESSION['user_id_v']}', '{$_SESSION['ccnum_v']}', '{$_SESSION['expdate_v']}', '123', '{$_SESSION['total_v']}','{$_SESSION['numpeople_v']}')";
?>

 

Ken

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.