i don't know much about php. this is a php i'm using to send data form android. but while testing, i'm using it from a html. from this html i send iddevice, latitud and longitud variables.
as you can see in the php code, first i get the name related to the iddevice sent from the html from the DB.
the problem is I'm not getting the name variable from the database. the name should be "manuel", but on my mysql DB i'm getting "Resource id #2" instead. the other variables are correct in database row (iddevice, latitud and longitud).
any idea on why is this happening? thx in advance
php code:
<?php
// conexion a la base de datos
mysql_connect("xxx", "xxx", "xxx") or die (mysql_error());
mysql_select_db("qry899");
// conseguimos el nombre
$newname = mysql_query("SELECT nombre FROM gcm_v3 WHERE iddevice='".$_POST["iddevice"]."'") or die(mysql_error());
// insertamos id de registro devuelto por el GCM
mysql_query("INSERT INTO position (iddevice, nombre, latitud, longitud) VALUES ('".$_POST["iddevice"]."', '$newname', '".$_POST["latitud"]."', '".$_POST["longitud"]."')") or die(mysql_error());
mysql_close();
?>