db in the same project
Posted: Sun Mar 11, 2012 9:08 am
How do I tell mysql what db to use?
this my dbconnect my db called ssg
and this is my dbconnect for my other db called lqlotl
this most code in action
IN this case I want to pull from one db then the other, so my question this.
How do I tell one select statement to use the db called ssg, the other to use the dbcalled lqlotl?
cheers?
this my dbconnect my db called ssg
Code: Select all
$db = mysql_connect("localhost","root","") or die("Could not connect to db");
if(!$db)
die("no db");
if(!mysql_select_db("ssg",$db))
die("No Database Selected");Code: Select all
$db = mysql_connect("localhost","root","") or die("Could not connect to db");
if(!$db)
die("no db");
if(!mysql_select_db("lqotl",$db))
die("No Database Selected");
Code: Select all
$query = "select * from players where username='$username' ";
$result = mysql_query($query) or die("Could not find user in players");
$result2 = mysql_fetch_array($result);
if (!$result2) {
$regdate=$date=(date("Y/m/d"));
$SQL = "INSERT into players (name, access, cssset, regdate,) VALUES ('$username','1','1','$regdate')";
mysql_query($SQL) or die("could not register player");
header("Location: playermade.php");
}
else {
$lqlotlid = $result2['id'];
$player = $result2['name'];
$lqloflaccess = $result2['access'];
$cssset = $result2['cssset'];
$regdate = $result2['regdate'];
$charslot1 = $result2['chars1'];
$charslot2 = $result2['chars2'];
$charslot3 = $result2['chars3'];
$charslot4 = $result2['chars4'];
$charslot5 = $result2['chars5'];
$charslot6 = $result2['chars6'];
}
How do I tell one select statement to use the db called ssg, the other to use the dbcalled lqlotl?
cheers?