mysql macht stress
- witzigerkiller
- Gesperrt
- Beiträge: 878
- Registriert: 05.02.2005 13:27
- Wohnort: Sonthofen
- witzigerkiller
- Gesperrt
- Beiträge: 878
- Registriert: 05.02.2005 13:27
- Wohnort: Sonthofen
Code: Alles auswählen
/ MySQL Variables
$host = "localhost"; // Hostname
$user = "root"; // User of database
$password = ""; // Password of database
$database = "guestbook"; // Name of database
$table_prefix = "gb_"; // Table prefix
Code: Alles auswählen
class db
{
// Get Connect to Database
function sql_connect($host, $user, $password, $database)
{
$connection = mysql_connect($host, $user, $password) OR die(mysql_error());
$database = mysql_select_db($database) or die(mysql_error());
}
// Fetch Entrys from Database
function sql_query($sql)
{
if (mysql_query($sql))
{
return $sql;
}
else
{
die(mysql_error());
}
}
Code: Alles auswählen
$db = new db;
$db->sql_connect($host, $user, $password, $database);
$sql = "SELECT * FROM ".$table_prefix."confirm WHERE ip = '".$_SERVER['REMOTE_ADDR']."'";
$result = $db->sql_query($sql);
if (mysql_num_rows($result) <= 1)
{
$sql = "INSERT INTO ".$table_prefix."confirm (`ip`, `code`) values ('".$_SERVER['REMOTE_ADDR']."', '".$code."')";
$db->sql_query($sql);
}
else
{
$sql = "UPDATE ".$table_prefix."confirm SET `code` = '".$code."' WHERE `ip` = '".$_SERVER['REMOTE_ADDR']."'";
$db->sql_query($sql);
}
Bitte keine Anfragen mehr per PN
When you get me on my nerven I put you in the Gully and do the Deckel drüf and you never will come back to the Tageslicht.
When you get me on my nerven I put you in the Gully and do the Deckel drüf and you never will come back to the Tageslicht.
- witzigerkiller
- Gesperrt
- Beiträge: 878
- Registriert: 05.02.2005 13:27
- Wohnort: Sonthofen
gibts nichts aus.
habs mal umgeschrieben:
habs mal umgeschrieben:
Code: Alles auswählen
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "SELECT * FROM ".$table_prefix."confirm WHERE ip = ".$ip."";
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1' at line 1
Zuletzt geändert von witzigerkiller am 02.08.2006 23:25, insgesamt 1-mal geändert.
Bitte keine Anfragen mehr per PN
When you get me on my nerven I put you in the Gully and do the Deckel drüf and you never will come back to the Tageslicht.
When you get me on my nerven I put you in the Gully and do the Deckel drüf and you never will come back to the Tageslicht.
- witzigerkiller
- Gesperrt
- Beiträge: 878
- Registriert: 05.02.2005 13:27
- Wohnort: Sonthofen
Du gibst ihm nicht mal ein echo... wie
mysql_*
Befehle geben in der Regel nicht selber eine Nachricht aus das es funktioniert hat
Code: Alles auswählen
echo "Erfolgreich ausgeführt";
Befehle geben in der Regel nicht selber eine Nachricht aus das es funktioniert hat

- witzigerkiller
- Gesperrt
- Beiträge: 878
- Registriert: 05.02.2005 13:27
- Wohnort: Sonthofen
- witzigerkiller
- Gesperrt
- Beiträge: 878
- Registriert: 05.02.2005 13:27
- Wohnort: Sonthofen
also es liegt an der mysql classe.. wenn ich alles mit sql_query() schreibe geht das...
darf ich deine mysql klasse haben? das war meine erste klasse die noch nichteinmal funktioniert.
EDIT: WERDE die von phpbb nehmen.
darf ich deine mysql klasse haben? das war meine erste klasse die noch nichteinmal funktioniert.
EDIT: WERDE die von phpbb nehmen.
Zuletzt geändert von witzigerkiller am 03.08.2006 00:00, insgesamt 1-mal geändert.
Bitte keine Anfragen mehr per PN
When you get me on my nerven I put you in the Gully and do the Deckel drüf and you never will come back to the Tageslicht.
When you get me on my nerven I put you in the Gully and do the Deckel drüf and you never will come back to the Tageslicht.