Jump to content

Conectar inserir valores no phpmyadmin através de javascript


André Gomes
 Share

Recommended Posts

Boas,

Tenho uma conexão á minha base de dados feita em php, com o seguinte código:

include_once "mysql_connect.php";

//select a database to work with
$selected = mysql_select_db("$db_name") or die("Could not select data base");

if (!$selected)
{
 die('Could not connect:');
}
mysql_select_db($selected);

O meu ficheiro "mysql_connect.php" é o seguinte:


$db_host = "localhost";
$db_user = "root";
$db_pass = "pass";
$db_name = "teste";
@mysql_connect("$db_host", "$db_user", "$db_pass") or die ("Could not connect to MYSQL");

Alguém sabe me dizer se é possivel conectar e inserir nessa base de dados através de javascript?

Já experimentei colocar este código dentro da minha função em javascript, mas não funciona!

Obrigado 🙂

Edited by André Gomes
GeSHi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.