Autor Zpráva
nofate
Profil
[/pre]

[pre]
[i][/i]
Anonymní
Profil *
hmm...co třeba select??
peta
Profil *
NETESTOVANO!!

---config.inc.php---
$SQLhost = "localhost"; //server (host)
$SQLuser = "jmeno"; //MySQL user
$SQLpsw = "heslo"; //MySQL password
$SQLdbname = "nazevdatabaze"; //MySQL DB name

$SQLserver = mysql_connect($SQLhost,$SQLuser,$SQLpsw) or die("Error: Nepripojen k DB serveru!");
$SQLdb = mysql_select_db($SQLdbname) or die ("Error: Nepripojen k DB!");

---vytvor.php---
include("config.inc.php");
//smaz
$dotaz="DROP TABLE IF EXISTS pokus";
$vysl = mysql_query($dotaz) or die(mysql_error());

//vytvor
$dotaz="
CREATE TABLE pokud (
id int(11) NOT NULL AUTO_INCREMENT,
login varchar(16) default NULL,
psw varchar(40) default NULL,
ip varchar(15) default NULL,
PRIMARY KEY(id),
KEY (login),
KEY (psw)
) TYPE=MyISAM COLLATE cp1250_general_ci;
";
$vysl = mysql_query($dotaz) or die(mysql_error());

---pridej.php---
include("config.inc.php");
$tab = "pokud";
$dotaz = "INSERT INTO $tab VALUES ('','tonik','heslo','ip')";
$vysl = mysql_query($dotaz) or die(mysql_error());

---zobraz.php---
include("config.inc.php");
$tab = "pokus";
$dotaz = "SELECT * FROM $tab WHERE `login` = 'tonik' LIMIT 1";
$vysl = mysql_query($dotaz) or die(mysql_error());
$pocet = mysql_NumRows($vysl);
if ($pocet>0)
{
while ($row = mysql_fetch_array($vysl))
{
print_r($row);
echo "<hr>";
}
}


http://mm.gene.cz/
peta
Profil *
chybka 1: za cp1250_general_ci; by nemel byt strednik
(na ostatni prijdes)
Toto téma je uzamčeno. Odpověď nelze zaslat.