Problem with post on_insert

QuestionsProblem with post on_insert
C3media asked 4 years ago

Hi Abu,

I have this function to insert on DB, but equal need to send data by post method:

PROBLEM:Parse error: syntax error, unexpected 'var' (T_VAR)

Thanks by your help…

Regards, this is the code

function add_proyecto(&$data)
{

var smsusuario = "xxxxxxx";
var smsclave = "xxxxxxxxxx";
var smstos = "xxxxxxxxxxxx";
var smstexto = "Testing text";

$.post("http://servicio.smsmasivos.com.ar/enviar_sms.asp?api=1", { USUARIO: smsusuario, CLAVE: smsclave, TOS: smstos, TEXTO: smstexto } );

//Working Fine:
$id = intval($_GET["rowid"]);
$data["params"]["id"] = $id;
date_default_timezone_set("Bogota");
$fechaenvio = date(" Y/m/d");
$sql = "INSERT INTO `proyecto`
(`id`, `barrio_idbarrio`, `necesidades_idnecesidades`, `proyecto`, `sector`, `actualizacion`)
VALUES
(NULL, '{$data["params"]["barrio_idbarrio"]}', '{$data["params"]["necesidades_idnecesidades"]}', '{$data["params"]["proyecto"]}', '{$data["params"]["sector"]}', '".$fechaenvio."')";
mysql_query($sql);

1 Answers
Abu Ghufran answered 4 years ago

$.post is jquery javascript syntax that cannot be used inside php.
To make remote call inside php, you may use curl functions. Refer php documentation and google for that.

Your Answer

11 + 8 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!