Problem with post on_insert

QuestionsProblem with post on_insert
C3media asked 9 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 9 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

13 + 20 =

Login with your Social Id:

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?