PDA

View Full Version : $query = mysql_query("INSERT INTO `mattx_site`.`forums` (name,category,desc)...



DeejayMachoo$
27-12-2007, 08:43 PM
Hi like

$query = mysql_query("INSERT INTO `mattx_site`.`forums` (name,category,desc) VALUES ('$name','$id','$desc')");

i see no error with this but its not inserting into mattx_site.forums any ideas?

ThisNameWillDo!
27-12-2007, 08:45 PM
I'm confused :S Is your database called mattx_site.forums ? With the . ?

- Vince.

MrCraig
27-12-2007, 08:47 PM
Try..


$query = mysql_query("INSERT INTO `forums` (name,category,desc) VALUES ('$name','$id','$desc')");


I dont know where the mattx_site comes from.. Is that the database name or something?

Cos if your connected to the database, then it should automatically know what database your looking in.

DeejayMachoo$
27-12-2007, 08:47 PM
I'm confused :S Is your database called mattx_site.forums ? With the . ?

- Vince.

nope the db is

mattx_site

and the table is forums


Try..


$query = mysql_query("INSERT INTO `forums` (name,category,desc) VALUES ('$name','$id','$desc')");
I dont know where the mattx_site comes from.. Is that the database name or something?

Cos if your connected to the database, then it should automatically know what database your looking in.

Connecting to multiple db's

MrCraig
27-12-2007, 09:32 PM
try running the query in phpmyadmin and it should tell you any errors that the script may have, as, as far as i can see, theres nothing wrong with code.

Or you could always get round it by doing



$1 = mysql_connect(Database 1);
/*
Queries
*/
mysql_close($1);
$2 = mysql_connect(Database 2);
/*
Queries
*/
mysql_close($2);

Want to hide these adverts? Register an account for free!