ERLEDIGT
NEIN
NEIN
ANTWORTEN
9
9
ZUGRIFFE
441
441
EMPFEHLEN
-
Hallo ich bin neu hier und ich habe keine Ahnung ob ich hier richtig bin, desshalb stell ich jetzt eifach ml meine frage!
Also ich weiß wie man mit eine PHP script aus einer Datenbank etwas ausliest un das dann ausgibt, aber ich weiß nicht wie ich es machen soll wenn ich 2 Datenbanken habe und dort dann bestimmte zeilen auslesen möchte (also z.B. ein Ranking wil aus einer die Char statistiken auslesen wie level oder sonnst was und aus der andren den Status sprich online oder offline, da weiß ich dann nicht wie ich diese zeilen von dem account verknüpfen soll)
Ich hoffe ihr könnt mir helfen!
-
Moin,
du kannst Spalten auch nach diesem Schema referenzieren
:
datenbankname.tabellenname.spaltenname
-
Moin,
entweder wie Sven es gesagt hat oder falls es zwei voneinander unabhängige Statements sind oder ggfs. sogar exakt das gleiche, kannst du auch mit dem Befehl mysql_select_db() die zu verwendete Datenbank selektieren auf der die Statements ausgeführt werden die du mit mysql_query() ausführst.Manuel Freiholz
iF.Gainwar
iF.SVNAdmin (http://www.insanefactory.com/if-svnadmin/)
Subversion Benutzeradministration mit PASSWD und LDAP Integration.
-
So jetzt hatte ich mal ausprobiert und jetzt wirft er mir noch ein Error aus!
Warning: mssql_fetch_assoc() expects parameter 1 to be resource, null given in D:\xampp\htdocs\test\useronline.php on line 14
Also ich muss aus der eine DB den Status holen und aus der anderen den Character und den Server!!PHP-Code:<?php
echo '<div align="center"><table width="100%" border="0" style="text-align:center;">';
echo '<td align="center" width="10%" style="background-color: silver;border-bottom: solid grey 1px; border-right: solid grey 1px;"><center><font color="black"><font size="4px">Name</font></center';
echo '<td align="center" width="40%" style="background-color: silver;border-bottom: solid grey 1px; border-right: solid grey 1px;"><center><font color="black"><font size="4px">Server</font></center';
echo'</tr>';
mssql_select_db("ACCOUNT_DBF");
$getguilds = mssql_query('SELECT * FROM ACCOUNT_TBL ORDER BY isuse DESC');
while ($consulta = mssql_fetch_assoc($getaccount)) {
$accountid = $consulta['m_idPlayer'];
mssql_select_db("CHARACTER_01_DBF");
$getname = mssql_query('SELECT m_idPlayer FROM CHARACTER_TBL WHERE m_idPlayer = "'.$accountid.'"');
while ($memberid = mssql_fetch_assoc($getmember)) {
$uid = $memberid['m_idPlayer'];
}
$getname = mssql_query('SELECT m_szName FROM CHARACTER_TBL WHERE m_idPlayer = "'.$uid.'"');
while ($leadername = mssql_fetch_assoc($getname)) {
$member = $name['m_szName'];
}
echo '<tr><td bgcolor=""><font size="3px">'.$member.'</td>';
echo '<td bgcolor=""><font size="3px">'.$consulta['serverindex'].'</a></td>';
}
?>
DB1 = ACCOUNT_DBF (ACCOUNT_TBL_DETAIL) [account, isuse]
DB2 = CHARACTER_01_DBF (CHARACTER_TBL) [account, serverindex, m_szName]
vlt findest ihr ja den Fehler oder könnt mich verbessern
-
Wenn das wirklich von ganzen oben ist der Code, dann wurde die Variable "$getaccount" und "$getmember" noch nicht gesetzt. Hast du da vielleicht einen leichten dreher in deinen Variablen drin die du an die Funktion "mssql_fetch_assoc" übergibst?
[Update]
Ohne jetzt großartig in die Logik der Sache zu gucken würde das für mich so mehr Sinn ergeben:
PHP-Code:<?php
echo '<div align="center"><table width="100%" border="0" style="text-align:center;">';
echo '<td align="center" width="10%" style="background-color: silver;border-bottom: solid grey 1px; border-right: solid grey 1px;"><center><font color="black"><font size="4px">Name</font></center';
echo '<td align="center" width="40%" style="background-color: silver;border-bottom: solid grey 1px; border-right: solid grey 1px;"><center><font color="black"><font size="4px">Server</font></center';
echo'</tr>';
mssql_select_db("ACCOUNT_DBF");
$getguilds = mssql_query('SELECT * FROM ACCOUNT_TBL ORDER BY isuse DESC');
while ($consulta = mssql_fetch_assoc($getguilds)) {
$accountid = $consulta['m_idPlayer'];
mssql_select_db("CHARACTER_01_DBF");
$getname = mssql_query('SELECT m_idPlayer FROM CHARACTER_TBL WHERE m_idPlayer = "'.$accountid.'"');
while ($memberid = mssql_fetch_assoc($getname)) {
$uid = $memberid['m_idPlayer'];
}
$getname2 = mssql_query('SELECT m_szName FROM CHARACTER_TBL WHERE m_idPlayer = "'.$uid.'"');
while ($leadername = mssql_fetch_assoc($getname2)) {
$member = $name['m_szName'];
}
echo '<tr><td bgcolor=""><font size="3px">'.$member.'</td>';
echo '<td bgcolor=""><font size="3px">'.$consulta['serverindex'].'</a></td>';
}
?>Geändert von Gainwar (01.09.10 um 17:21 Uhr)
Manuel Freiholz
iF.Gainwar
iF.SVNAdmin (http://www.insanefactory.com/if-svnadmin/)
Subversion Benutzeradministration mit PASSWD und LDAP Integration.
-
ok das Problem wäre gelöst doch ich habe noch ein Problem mit Login, ich habe schon alles ausprobiert wa sso in Foren oder so stand und jetzt dachte ich, dann frag ich mal hier nach.
login.php
Hier auch noch ein script dass dann auf die Member php sollte da wir überprüftPHP-Code:<?php
$pass = ($_POST['password']);
include("conf.inc.php"); // Includes the db and form info.
//session_start(); // Starts the session.
if ($_SESSION['logged'] == 1) { // User is already logged in.
header("Location: index.php"); // Goes to main page.
exit(); // Stops the rest of the script.
} else {
if (!isset($_POST['submit'])) { // The form has not been submitted.
echo "<form action=\"index.php?site=login\" method=\"POST\">";
echo "<table>";
echo "<tr>";
echo "<td colspan=\"2\">Login:</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"50%\">Username:</td><td width=\"50%\"><input name=\"username\" size=\"18\" type=\"text\" />";
echo "</tr>";
echo "<tr>";
echo "<td width=\"50%\">Password:</td><td width=\"50%\"><input name=\"password\" size=\"18\" type=\"password\" />";
echo "</tr>";
echo "<tr>";
echo "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"submit\"</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
} else {
$username = ($_POST['username']);
$password = md5("kikugalanet" . $pass); // Encrypts the password.
$q = mssql_query("SELECT * FROM ACCOUNT_TBL WHERE account = '$username' AND password = '$password'");
$r = mssql_num_rows($q); // Checks to see if anything is in the db.
if ($r == 1) { // There is something in the db. The username/password match up.
$_SESSION['logged'] = 1; // Sets the session.
header("Location: member.php"); // Goes to main page.
exit(); // Stops the rest of the script.
} else { // Invalid username/password.
exit("Incorrect username/password!"); // Stops the script with an error message.
}
}
}
mssql_close($db_connect); // Closes the connection.
?>
Da wo's hin soll wenn login erfolgreich ist!PHP-Code:<?php
session_start();
?>
<?php
include("conf.inc.php"); // Includes the db and form info.
session_start(); // Starts the session.
if ($_SESSION['logged'] != 1) { // There was no session found!
header("Location: index.php?site=login"); // Goes to login page.
exit(); // Stops the rest of the script.
}
//echo "This is the main page!";
//echo "<br />";
//echo "<a href=\"logout.php\">Logout?</a>"
?>
member.php
config.inc.phpHTML-Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Legend Of Warrior</title> <link href="default.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <!-- start header --> <div id="header"> <div id="logo"> <h1><a href="#">TEST</a></h1> </div> <!-- Begin Vista-Buttons.com --> <link href="index-files/styles_ptb2t.css" type="text/css" rel="stylesheet"/> <style type="text/css">A#vbUL_ptb2ta{display:none}</style> <table id="vista-buttons_com_idptb2t" width="0" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right:0px" title ="Home"> <a href="index.php?site=home"><img id="xpi_ptb2t" src="index-files/btptb2t_0.png" name="vbptb2t" width="141" height="40" border="0" alt="Home" /></a></td><td style="padding-right:0px" title ="Forum"> <a href="http://low-forum.square7.ch/forum.php" target="_blank"><img id="xpi_otb2t" src="index-files/btotb2t_0.png" name="vbotb2t" width="141" height="40" border="0" alt="Forum" /></a></td><td style="padding-right:0px" title ="User Panel"> <a onmouseover='xpshow("wtb2t",0,this);' onmouseout='xpsmout(this);'><img id="xpi_wtb2t" src="index-files/btwtb2t_0.png" name="vbwtb2t" width="141" height="40" border="0" alt="User Panel" /></a><div> <ul id="vbUL_wtb2t" class="vbULptb2t"> <li><a href="index.php?site=register" title="Register Account">Register Account</a></li> <li><a href="index.php?site=login" title="login">login</a></li></ul></div></td><td style="padding-right:0px" title ="Ranking"> <a onmouseover='xpshow("4tb2t",0,this);' onmouseout='xpsmout(this);'><img id="xpi_4tb2t" src="index-files/bt4tb2t_0.png" name="vb4tb2t" width="141" height="40" border="0" alt="Ranking" /></a><div> <ul id="vbUL_4tb2t" class="vbULptb2t"> <li><a href="index.php?site=top100" title="Top 100 Players">Top 100 Players</a></li> <li><a href="index.php?site=top20" title="Top 20 Guilds">Top 20 Guilds</a></li> <li><a href="index.php?site=mostpenya" title="Most Penya ">Most Penya </a></li> <li><a href="index.php?site=mostplay" title="Most Playtime">Most Playtime</a></li> <li><a href="index.php?site=gmrank" title="GM Ranking">GM Ranking</a></li></ul></div></td><td style="padding-right:0px" title ="Team"> <a href="index.php?site=team"><img id="xpi_ztb2t" src="index-files/btztb2t_0.png" name="vbztb2t" width="141" height="40" border="0" alt="Team" /></a></td><td style="padding-right:0px" title ="Downloads"> <a onmouseover='xpshow("utb2t",0,this);' onmouseout='xpsmout(this);'><img id="xpi_utb2t" src="index-files/btutb2t_0.png" name="vbutb2t" width="141" height="40" border="0" alt="Downloads" /></a><div> <ul id="vbUL_utb2t" class="vbULptb2t"> <li><a href="index.php?site=fullclient" title="Full Client">Full Client</a></li> <li><a href="index.php?site=patcher" title="Patcher">Patcher</a></li></ul></div></td><td style="padding-right:0px" title ="Donate"> <a href="index.php?site=donate"><img id="xpi_vtb2t" src="index-files/btvtb2t_0.png" name="vbvtb2t" width="141" height="40" border="0" alt="Donate" /></a></td></tr></table><script type="text/javascript"> var vbImgPath="index-files/"</script> <script type="text/javascript" src="index-files/scptb2t.js"></script> <a id="vbUL_ptb2ta" href="http://vista-buttons.com">Javascript Sub Menu by Vista-Buttons.com v5.0.0</a> <!-- End Vista-Buttons.com --> </div> <!-- end header --> <div id="wrapper"> <!-- start page --> <div id="page"> <div id="sidebar1" class="sidebar"> <ul> <li> <h2>Server</h2> <br /> <ul><center><font size="2px"> <legend></legend><table border="0" width="150"> <tbody><tr> <th scope="row"><div align="left">Accounts:</div></th> <td><div align="right"> <iframe src="include/accounts.php" marginwidth="30" marginheight="0" width="100" frameborder="0" height="20"> </iframe></div></td> </tr> <th scope="row"><div align="left">Character:</div></th> <td><div align="right"> <iframe src="include/character.php" marginwidth="30" marginheight="0" width="100" frameborder="0" height="20"> </iframe></div></td> </tr> <th scope="row"><div align="left">Online:</div></th> <td><div align="right"> <iframe src="include/online.php" marginwidth="30" marginheight="0" width="100" frameborder="0" height="20"> </iframe></div></td> </tr> <th scope="row"><div align="left">Peak:</div></th> <td><div align="right"> <iframe src="include/peak.php" marginwidth="30" marginheight="0" width="100" frameborder="0" height="20"> </iframe></div></td> </tr> </tbody></table> <hr /></font> <legend></legend><table border="0" width="150"> <tbody><tr> <th scope="row"><div align="left">Login:</div></th> <td><div align="right"> <iframe src="include/status.php" marginwidth="0" marginheight="0" width="100" frameborder="0" height="30"> </iframe></div></td> </tr> <tr> <th scope="row"><div align="left">Auth:</div></th> <td><div align="right"> <iframe src="include/status1.php" marginwidth="0" marginheight="0" width="100" frameborder="0" height="30"> </iframe></div></td> </tr> <tr> <th scope="row"><div align="left">Channel 1:</div></th> <td><div align="right"> <iframe src="include/status2.php" marginwidth="0" marginheight="0" width="100" frameborder="0" height="30"> </iframe></div></td> </tr> <tr> <th scope="row"><div align="left">Teamspeak:</div></th> <td><div align="right"> <iframe src="include/ts.php" marginwidth="0" marginheight="0" width="100" frameborder="0" height="30"> </iframe></div></td> </tr> </tbody></table> </ul> </li> <li> <h2>Panel Menü</h2> <br /> <ul><center> <li><a href="membervote.php">Vote</a></li> <li><a href="login/logout.php">Logout</a></li> </ul> </li> <li> <h2>Vote</h2> <ul> <br /> <br /> </ul> </li> </div> <!-- start content --> <div id="content"> <?php switch($_GET['site']) { case '': include "news.php"; break; case 'register': include "register.php"; break; case 'download': include "downloads.php"; break; case 'team': include "team.php"; break; case '': include "news.php"; break; } ?> </div> <!-- end content --> <!-- start sidebars --> </center> <!-- end sidebars --> <div style="clear: both;"> </div> </div> <!-- end page --> </div> <div id="footer"> <p>.</p> </div> </body> </html>
vorallem habe ich das Problem mit Session oderPHP-Code:<?php
$db_user = "xxxx"; // Username
$db_pass = "xxxx"; // Password
$db_database = "ACCOUNT_DBF"; // Database Name
$db_host = "xxxx/SQLEXPRESS"; // Server Hostname
$db_connect = mssql_connect ($db_host, $db_user, $db_pass); // Connects to the database.
$db_select = mssql_select_db ($db_database); // Selects the database.
//function form($data) { // Prevents SQL Injection
//global $db_connect;
//$data = ereg_replace("[\'\")(;|`,<>]", "", $data);
//$data = addslashes(trim($data), $db_connect);
// return stripslashes($data);
//}
?>
Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\test\index.php:147) in D:\xampp\htdocs\test\login.php on line 36
Ich hoffe wieder einmal ihr könnt mir helfen
wenn ihr noch was braucht einfach melden!
mfg ocram
-
Mmmh, Google spuckt dazu satte 23 Mio Ergebnisse aus, eine Reihe davon dürften die Lösung beinhalten, bspw. die PHP-FAQ
-
Ja da habe cih auch schon genug beiträge gelesen, habe es dann auch ausprobiert, da es nicht ge****t hat habe cih es hier rein geschrieben, weil ich denke wenn die leute die das Problem lösen könnten, können sich mit den PHP seiten einen besseren überblick verschaffen (meine Meinung)
mfg ocram
PS sry für Rechtschreibfehler bin grad nicht mehr der fitteste
-
Und damit die Leute richtig gut helfen können, hast du haufenweise Code gepostet, den sie durchwühlen sollen, aber das einzige, was erstmal wirklich interessant wäre, für dich behalten: Die Datei+Zeile, wo lt. Fehlermeldung die Ausgabe begann(index.php Zeile 147)?
-
//Problem selber gelöst
######Close#####
Ähnliche Themen
-
NULL-Ausgabe aus MSSQL Server 2005
Von Garuses im Forum Relationale DatenbanksystemeAntworten: 2Letzter Beitrag: 08.01.10, 15:50 -
[MSSQL 2005] Tabelle zwischen 2 Datenbanken kopieren.
Von Jantz im Forum Relationale DatenbanksystemeAntworten: 7Letzter Beitrag: 17.09.09, 00:14 -
MSSQL Server 2005 Cache verwalten (vergrößern, leeren)
Von darklord9579 im Forum Relationale DatenbanksystemeAntworten: 0Letzter Beitrag: 13.03.08, 08:40 -
Job erstellen im MSSQL-Server 2005
Von Naru84 im Forum Relationale DatenbanksystemeAntworten: 0Letzter Beitrag: 20.08.07, 16:08 -
vb.net 2005 Express - Connect zu MSSQL-Server 2000?
Von ballistic im Forum .NET DatenverwaltungAntworten: 2Letzter Beitrag: 05.09.06, 16:39





Zitieren

Login






[PHP] [Codeschnipsel] ImageColor aus HTML-Farbcodierung erstellen