Php ORA-01722错误消息
我试图将一些数据输入到oracle表中,收到错误代码ORA-01722。我相信这是因为交易员ID是一个数字,但它说它不能将字符串转换为数字。代码如下 形式 错误代码警告:oci_execute()[function.oci execute]:ORA-01722:第19行recipesql.php中的数字无效Php ORA-01722错误消息,php,oracle,Php,Oracle,我试图将一些数据输入到oracle表中,收到错误代码ORA-01722。我相信这是因为交易员ID是一个数字,但它说它不能将字符串转换为数字。代码如下 形式 错误代码警告:oci_execute()[function.oci execute]:ORA-01722:第19行recipesql.php中的数字无效 $query = "INSERT INTO MEDIA (Media_Id, Name, MediaType, Recipe, Video_Link, Trader_ID) VALUES
$query = "INSERT INTO MEDIA (Media_Id, Name, MediaType, Recipe, Video_Link, Trader_ID)
VALUES (MEDIA_seq.nextval,'$RecipeName','$MediaType','$Recipe','$Link','$TraderID')";
i、 e.MEDIA_seq.nextval
未包含在''
中。否则,它将被解释为VARCHAR2
,并将其插入到NUMBER
列中,导致出现ORA-01722
//include connection
include ('PHP/connection.php');
//has form been submitted?
if(isset($_POST['Submit'])){
$RecipeName=$_POST['Name'];
$MediaType=$_POST['MediaType'];
$Recipe=$_POST['Recipe'];
$Link=$_POST['Video_Link'];
$TraderID=$_POST['Trader_ID'];
//Insert data
$query = "INSERT INTO MEDIA
(Media_Id, Name, MediaType, Recipe, Video_Link, Trader_ID)
VALUES
('MEDIA_seq.nextval','$RecipeName','$MediaType','$Recipe','$Link','$TraderID')";
$runquery = oci_parse($connection,$query);
oci_execute($runquery);
}
//to check if the if statement is working
else
{
echo "Error";
}
$query = "INSERT INTO MEDIA (Media_Id, Name, MediaType, Recipe, Video_Link, Trader_ID)
VALUES (MEDIA_seq.nextval,'$RecipeName','$MediaType','$Recipe','$Link','$TraderID')";