jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 where is your class with fetchColumn() method? Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491070 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 where is your class with fetchColumn() method? In the functions.php \/ <?php class user { function isAdmin($odb) { $SQL = $odb -> prepare("SELECT `rank` FROM `users` WHERE `ID` = :id"); $SQL -> execute(array(':id' => $_SESSION['ID'])); $rank = $SQL -> fetchColumn(0); if ($rank == 2) { return true; } else { return false; } } function isReseller($odb) { $SQL = $odb -> prepare("SELECT `rank` FROM `users` WHERE `ID` = :id"); $SQL -> execute(array(':id' => $_SESSION['ID'])); $rank = $SQL -> fetchColumn(0); if ($rank == 1) { return true; } else { return false; } } function LoggedIn() { @session_start(); if (isset($_SESSION['username'], $_SESSION['ID'])) { return true; } else { return false; } } function hasMembership($odb) { $SQL = $odb -> prepare("SELECT `expire` FROM `users` WHERE `ID` = :id"); $SQL -> execute(array(':id' => $_SESSION['ID'])); $expire = $SQL -> fetchColumn(0); if (time() < $expire) { return true; } else { $SQLupdate = $odb -> prepare("UPDATE `users` SET `membership` = 0 WHERE `ID` = :id"); $SQLupdate -> execute(array(':id' => $_SESSION['ID'])); return false; } } function notBanned($odb) { $SQL = $odb -> prepare("SELECT `status` FROM `users` WHERE `ID` = :id"); $SQL -> execute(array(':id' => $_SESSION['ID'])); $result = $SQL -> fetchColumn(0); if ($result == 0) { return true; } else { session_destroy(); return false; } } } class stats { function totalUsers($odb) { $SQL = $odb -> query("SELECT COUNT(*) FROM `users`"); return $SQL->fetchColumn(0); } function totalBoots($odb) { $SQL = $odb -> query("SELECT COUNT(*) FROM `logs`"); return $SQL->fetchColumn(0); } function runningBoots($odb) { $SQL = $odb -> query("SELECT COUNT(*) FROM `logs` WHERE `time` + `date` > UNIX_TIMESTAMP()"); return $SQL->fetchColumn(0); } function totalnews($odb) { $SQL = $odb -> query("SELECT COUNT(*) FROM `news`"); return $SQL->fetchColumn(0); } function totaltickets($odb) { $SQL = $odb -> query("SELECT COUNT(*) FROM `tickets`"); return $SQL->fetchColumn(0); } function totalBootsForUser($odb, $user) { $SQL = $odb -> prepare("SELECT COUNT(*) FROM `logs` WHERE `user` = :user"); $SQL -> execute(array(":user" => $user)); return $SQL->fetchColumn(0); } function totalusertickets($odb, $user) { $SQL = $odb -> prepare("SELECT COUNT(*) FROM `tickets` WHERE `username` = :user"); $SQL -> execute(array(":user" => $user)); return $SQL->fetchColumn(0); } function usersforplan($odb, $plan) { $SQL = $odb -> prepare("SELECT COUNT(*) FROM `users` WHERE `membership` = :membership"); $SQL -> execute(array(":membership" => $plan)); return $SQL->fetchColumn(0); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491072 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 Have you included this file on the top of index.php file? Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491073 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 Have you included this file on the top of index.php file? No am I meant to ? Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491074 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 I don't know maybe the file is included inside another included file, you have to tell me Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491077 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 I don't know maybe the file is included inside another included file, you have to tell me There's an index.php in the main directory that im trying to get on to. That doesn't include anything on functions.php and there's another index.php in the includes folder that doesn't do anything I don't think and the code in there is just... haha i dunno why it said 'Derp', I didnt make this but I am editing it so I can just use the source. <?php echo "Derp"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491078 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 (edited) Fatal error: Call to a member function query() on a non-object in This error comes from mysqli library not from pdo. Can you explain this? Ah...I googled it comes from pdo as well. So then check if your database credentials are correct, inside db.php file. Edited September 14, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491081 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 This error comes from mysqli library not from pdo. Can you explain this? I didn't use the original SQL file that's why. I used a different one that didn't belong to it. I can't get the original one that belonged to the source I am using. I need to make an SQL then :/ If I learn how to do it... Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491082 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 Ok, got it. Go to db.php and add the line after the $obd object. Run the script again do a "view source" and post the new error. <?php if(strpos(strtolower($_SERVER['SCRIPT_NAME']),strtolower(basename(__FILE__)))){ die('Error!'); } define('DB_HOST', '*REMOVED*'); define('DB_NAME', '*REMOVED*'); define('DB_USERNAME', '*REMOVED*'); define('DB_PASSWORD', '*REMOVED*'); $odb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD); $odb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); ?> Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491084 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 Ok, got it. Go to db.php and add the line after the $obd object. Run the script again do a "view source" and post the new error. <?php if(strpos(strtolower($_SERVER['SCRIPT_NAME']),strtolower(basename(__FILE__)))){ die('Error!'); } define('DB_HOST', '*REMOVED*'); define('DB_NAME', '*REMOVED*'); define('DB_USERNAME', '*REMOVED*'); define('DB_PASSWORD', '*REMOVED*'); $odb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD); $odb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); ?> Result \/ Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'REMOVED_test.SiteConfig' doesn't exist' in /home/REMOVED/public_html/TZ/v3/header.php:2 Stack trace: #0 /home/REMOVED/public_html/TZ/v3/header.php(2): PDO->query('SELECT `Tab` FR...') #1 /home/REMOVED/public_html/TZ/v3/index.php(21): require_once('/home/REMOVED/...') #2 {main} thrown in /home/REMOVED/public_html/TZ/v3/header.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491086 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 google this sql error, i'm going back in 30 min. Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491087 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 google this sql error, i'm going back in 30 min. I googled it but I don't understand what people mean :/ I'm such a newb. Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491091 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 (edited) It's simple - " Table 'REMOVED_test.SiteConfig' doesn't exist" Edited September 14, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491094 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 It's simple - " Table 'REMOVED_test.SiteConfig' doesn't exist" I have done that but other people use other web hosting and talk about things I have no idea of . Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491095 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 I have done that...... Obviously, you haven't done yet You need to fix the issue if you want to go further. Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491098 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 Obviously, you haven't done yet You need to fix the issue if you want to go further. Do you know how to create an SQL file..? At this minute I don't know how to fix anything on there haha, I might as well delete the whole thing and just stick with my current one.. www.rmzhcp.comyr.com < do you like it? Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491100 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 The easiest way for you is to use some DB GUI tool like phpMyAdmin, not personally using but for beginners is good. Then, connect to mysql server, open up the database named - "REMOVED_test" and create a table - SiteConfig. Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491101 Share on other sites More sharing options...
rizmah Posted September 14, 2014 Author Share Posted September 14, 2014 The easiest way for you is to use some DB GUI tool like phpMyAdmin, not personally using but for beginners is good. Then, connect to mysql server, open up the database named - "REMOVED_test" and create a table - SiteConfig. I'm already using phpmyadmin, just started to use it so ill look around to making it. What content should i put in this siteconfig? Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491102 Share on other sites More sharing options...
jazzman1 Posted September 14, 2014 Share Posted September 14, 2014 What content should i put in this siteconfig? This is very interesting question You need to open a new thread I think Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491103 Share on other sites More sharing options...
rizmah Posted September 15, 2014 Author Share Posted September 15, 2014 This is very interesting question You need to open a new thread I think I have been given the original sql file so I have that now but a dude of Skype said that it all was originally run on XAMPP and im trying to run it off 000webhost. He said that's the problem. Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491137 Share on other sites More sharing options...
jazzman1 Posted September 15, 2014 Share Posted September 15, 2014 I've never used 000webhost I don't know, maybe they limit you. Quote Link to comment https://forums.phpfreaks.com/topic/291057-what-am-i-doing-wrong/page/2/#findComment-1491143 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.