
08/02/2014, 12:09
|
| | Fecha de Ingreso: febrero-2014 Ubicación: Madrid
Mensajes: 19
Antigüedad: 11 años, 1 mes Puntos: 0 | |
Respuesta: Extraer datos de otra web Cita:
Iniciado por lolainas hola amigo,
en primer lugar las funciones de mysql estan [URL="http://php.net/manual/es/function.mysql-connect.php"]obsoletas[/URL] te recomiendo en su lugar utilizar [URL="http://es.php.net/pdo"]PDO[/URL].
volviendo al tema, ya lo tienes casi hecho.
teniendo una tabla como esta:
Código:
tabla 'registro' {
nombre,
telefono,
provincia,
direccion,
latitud,
longitud
}
y usando PDO: Código PHP: $connection = new PDO('mysql:host=HOST;dbname=DB;', 'USUARIO', 'PASSWORD');
$statement = $connection->prepare(
'INSERT INTO tabla (nombre, telefono, provincia, direccion, latitud, longitud) VALUES(?,?,?,?,?,?);'
);
foreach ($titulos as $titulo)
$statement->execute($titulo->nodeValue);
espero haberte ayudado, saludos. He seguido tus indicaciones y debo estar supertorpe |