make an insert into and then an update in php [closed]

1

I want to make an insert of a single field that is observations and then an update to all the others but I get an error

  

parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)

I do not know if the order in the consultations affects.

<?php
include('conexion.php');
$factura=$_POST['factura'];
$hsalida=$_POST['horasa'];
$hraentrega=$_POST['horaen'];
$hllegada=$_POST['horalle'];
$chofer=$_POST['chofer'];
$vehiculo=$_POST['vehiculo'];
$direccion=$_POST['direccion'];
$fecha_entrega=$_POST['fechaent'];
$observaciones=$_POST['obser'];

$insertar=mysql_query("insert into facturacion(observaciones)values('$observaciones)");or die(mysql_error());

$query=mysql_query("update facturacion set hrasalida='$hsalida', hraentrega='$hraentrega', hrallegada='$hllegada', chofer='$chofer', vehiculo='$vehiculo', direccion='$direccion', fechaentrega='$fecha_entrega' where factura='$factura'");
if($query)
{
    ?>
    <script language="javascript">
    alert("Registro almacenado!");
    </script>
 <?php
}
else
{
?>
?>
    <script language="javascript">
    alert("Registro almacenado!");
    </script>
<?php
}
?>
    
asked by jasiel 14.09.2018 в 21:35
source

1 answer

1

As the message tells you, the error is in this line

$insertar=mysql_query("insert into 
facturacion(observaciones)values('$observaciones')");or 
die(mysql_error());

It should be like this

$insertar=mysql_query("insert into 
facturacion(observaciones)values('$observaciones')") 
or die(mysql_error());

The bad detail is the semicolon

Here the documentation for you to familiarize yourself with the syntax

link

    
answered by 14.09.2018 в 21:41