Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 17:52

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



MYSQL Error...

Discussion on MYSQL Error... within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
Criespiex3's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 245
Received Thanks: 10
MYSQL Error...

Hey leute,
Ich bin relativ neu in PHP und muss daher einmal hier einen error melden den ich nicht lösen kann...

In meinem register script funktioniert das absenden nicht ich weiß nicht warum


Bild:

Zeile:

Code:
   {
   $insertusr = "INSERT INTO bg_user (user_id, truepasswd, passwd, email, ip) VALUES (?, ?, ?, ?, ?)";
   $qInsert = $conn->prepare ($insertusr);
   $qInsert->bind_param("sssss",$user,$pass,$realpass,$email,$ip);
   $qInsert->execute();
   if ($qInsert->affected_rows == 1)
   {
Criespiex3 is offline  
Thanks
2 Users
Old 06/30/2013, 21:48   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 1
Received Thanks: 0
Äffchen ^.^
Mondsch3in is offline  
Old 06/30/2013, 21:51   #3
 
Criespiex3's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 245
Received Thanks: 10
Quote:
Originally Posted by Mondsch3in View Post
Äffchen ^.^
Sehr hilfreich
Criespiex3 is offline  
Old 06/30/2013, 23:00   #4
 
elite*gold: 0
Join Date: Oct 2012
Posts: 71
Received Thanks: 24
dein Code sieht aus als verwandtest du MYSQLI Habe zwar schon lange nicht mehr mit MYSQLI gearbeitet da ich in der zwischen zeit nur noch mit PDO programmiere.

bis auf ein kleinen Schönheitsfehler kann ich keine Fehler sehen.
zum einen werden die Datentypen in einfachen Anführungszeichen gesetzt zum anderen ist die user id aller Wahrscheinlichkeit ein int.
probiere es mal so

PHP Code:
try {

    
$db = new MySQLi($hostname_config $username_config ,   $password_config $database_config);
    
$insertusr "INSERT INTO bg_user (user_id, truepasswd, passwd, email, ip) VALUES (?, ?, ?, ?, ?)";
    
$qInsert $db->prepare ($insertusr);
    
$qInsert->bind_param('issss'$user$pass$realpass$email$ip);
    
$qInsert->execute();
    if (
$qInsert->affected_rows == 1)
    {
    }
    
$qInsert->close();
    
} catch (
Exception $e) {
    echo 
'Fehler: ' htmlspecialchars($e->getMessage());

wenn du PDO verwarntest gibt es keine bind_param() sondern bindParam() das würte dan so aussehen
PHP Code:
try {
    
$engine ='MYSQL';
    
$dns $engine ':host=' $host ';port=' $port ';dbname=' $database;
    
$db = new  PDO($dns$user$pass, array(PDO::ATTR_PERSISTENT => truePDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
    
$insertusr "INSERT INTO bg_user (user_id, truepasswd, passwd, email, ip) VALUES (:user_id, :truepasswd, :realpass, :email, :ip)";
    
$qInsert $db->prepare ($insertusr);
    
$qInsert->bindParam(':user_id',  $userPDO::PARAM_INT);
    
$qInsert->bindParam(':truepasswd' $passPDO::PARAM_STR);
    
$qInsert->bindParam(':realpass',  $realpass,PDO::PARAM_STR);
    
$qInsert->bindParam(':$email',    $emailPDO::PARAM_STR);
    
$qInsert->bindParam(':ip',        $ipPDO::PARAM_STR);
    
    
$qInsert->execute();
    if (
$qInsert->affected_rows == 1)
    {
    }

} catch (
Exception $e) {
    echo 
'Fehler: ' htmlspecialchars($e->getMessage());

_robox is offline  
Thanks
1 User
Reply




All times are GMT +1. The time now is 17:52.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.