Calm down.
Will thois work with Phoenix and BcStorm?
Printable View
The way you say that makes MySQLi so bad, which isn't at all.
You guys are fucking genius. Using the old MySQL extention when it's deprecated like a boss. And suddenly they know PDO and prefer that one over MySQLi? I guess you like named prepared params better?
Or is it the cross database engine that did it, which you dont even need in the current Habbo development as everyone uses MySQL....
I'm trying to update my register a bit by using functions and prepared statements. But I'm getting a really annoying error and I don't know why I get it :S
The error:
Catchable fatal error: Object of class mysqli could not be converted to string in C:\xampp\htdocs\SnowCMS\classes\class_user.php on line 10
The line:
The function:PHP Code:$checkuser = $this->$DB->prepare("SELECT * FROM users WHERE username = ?");
At the moment it uses swiftdb. I thought phoenix and swift had the same ticketsystem (or how you call it), so it will work on both as long as you add cms_news. In the release I will give a simple sql to add it.PHP Code:public function CheckUser($username)
{
global $DB;
$checkuser = $this->$DB->prepare("SELECT * FROM users WHERE username = ?");
$checkuser->bind_param('s', $username);
if($checkuser->execute())
{
$checkuser->store_result();
}
return false;
}
Can't really answer that =P I thought PDO isn't that useful in the habbo section. Also I didn't really think about using PDO at all =P I just learned MySQLi.
Take a min to review this bit:Quote:
global $DB;
$checkuser = $this->$DB
Shouldnt it be:PHP Code:public function CheckUser($username)
{
global $DB;
$checkuser = $this->$DB->prepare("SELECT * FROM users WHERE username = ?");
$checkuser->bind_param('s', $username);
if($checkuser->execute())
{
$checkuser->store_result();
}
return false;
}
PHP Code:public function CheckUser($username)
{
global $DB;
$DB->prepare("SELECT * FROM users WHERE username = ?");
$DB->bind_param('s', $username);
if($DB->execute())
{
$DB->store_result();
}
return false;
}
I don't think that's a problem, this is in my core:
That's kind of impossible? You know it are prepared statements right? =PPHP Code:$c = Config::$DB;
$DB = new mysqli($c['db_host'], $c['db_user'], $c['db_pass'], $c['db_name']);
Wow this PHP confuses me, anyone can teach me that PHP? LOL
I have a new problem, when is try to go to for example this url:
It automatical redirects to:
I know why this happends, the only problem is, I don't know how to fix it :/
Update: Made a function to get handlers for pages like the register:
Also coded the route system into a function instead of in the index.php.PHP Code:public function GetHandler()
{
global $page;
if(is_file('/CMS/TPL/handlers/handler_'.$page.'.php'))
{
require('/CMS/TPL/handlers/handler_'.$page.'.php');
}
}
It's just OOP using MySQLi.
Going to be totally honest and straight up, this project looks like shit. A part of this actually looks like you have no idea what you are doing. I wish you the best though.
Use constructors, not globals
Wow, how great. I restarted my PC and all the files I had opened in notepad changed in to files with only this:
Happily I know how I coded the stuff so I hope I can code it all back this weekend.Quote:
NUL NUL NUL NUL etc...
Update: I already coded it and also made it better, this weekend Ill post some updates.
This coding looks like shit, you should first learn proper PHP and then do a CMS
Also as they say you shouldnt use globals