Yup it send new request to the server without params and should display all images in all categories
Stefce 146 Posting Pro
echo the html code inside php is bad practise and unstylish
Seperate just the HTML code and post it here cause i cannot understand anything
Stefce 146 Posting Pro
@jkon what should i use to securely pass parameter to other page?
@phphp do you mean ?
"SELECT ID, Image, imageID, Category FROM gallery WHERE imageID='".mysqli_real_escape_string($conn, $imageID)."' AND Category='".mysqli_real_escape_string($conn, $category)."'"
Stefce 146 Posting Pro
Hello, how do i escape passing parameters to page where you need to give two parameters ID and category
?
my sql is like this SELECT ID, Image, imageID, Category FROM gallery WHERE imageID={$imageID} AND Category='$category'
but i have a button which should show all pictures no matter what category they are?
Stefce 146 Posting Pro
Man i cannot thank you enough.. really appreciated ! Have a great day or night !
gentlemedia commented: Good stuff! +6
Stefce 146 Posting Pro
Thank you for your info but i cant understand anything i think ill leave as it is for now its working great i think. Thank you again :)
Stefce 146 Posting Pro
here is the HTML too
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>website title</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<!-- Navigation -->
<?php include 'navigation.php'; ?>
<!-- Full Page Image Background Carousel Header -->
<header id="myCarousel" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for Slides -->
<div class="carousel-inner">
<div class="item active">
<!-- Set the first background image using inline CSS below. -->
<div class="fill" style="background-image:url('images/header1.jpg');"></div>
<div class="carousel-caption">
<h2>Caption 1</h2>
</div>
</div>
<div class="item">
<!-- Set the second background image using inline CSS below. -->
<div class="fill" style="background-image:url('images/header2.jpg');"></div>
<div class="carousel-caption">
<h2>Caption 2</h2>
</div>
</div>
<div class="item">
<!-- Set the third background image using inline CSS below. -->
<div class="fill" style="background-image:url('images/header3.jpg');"></div>
<div class="carousel-caption">
<h2>Caption 3</h2>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
</header>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2 class="page-header">Random Pictures</h2>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="images/header1.jpg" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="images/header1.jpg" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="images/header1.jpg" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="images/header1.jpg" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" …
Stefce 146 Posting Pro
Actually this solves the problem but i have a question why is not recomended to use !important
?
Stefce 146 Posting Pro
Here is the full css code
html,
body {
height: 100%;
}
.img-portfolio{
margin-bottom: 30px;
}
.img-hover:hover {
opacity: 0.8;
}
.carousel,
.item,
.active {
height: 100%;
}
.carousel-inner {
height: 100%;
}
/* Background images are set within the HTML using inline CSS, not here */
.fill {
width: 100%;
height: 100%;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
footer {
margin: 50px 0;
}
maybe you will find here the error im not good at css
Stefce 146 Posting Pro
Anyone > ?
Stefce 146 Posting Pro
Hello i have a problem putting margin between the images i have this html code
<div class="row">
<div class="col-lg-12">
<h2 class="page-header">Featured Posts</h2>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="http://placehold.it/700x450" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="http://placehold.it/700x450" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="http://placehold.it/700x450" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="http://placehold.it/700x450" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="http://placehold.it/700x450" alt="">
</a>
</div>
<div class="col-md-4 col-sm-6">
<a href="portfolio-item.html">
<img class="img-responsive img-portfolio img-hover" src="http://placehold.it/700x450" alt="">
</a>
</div>
</div>
and here is the CSS
.img-portfolio {
margin-bottom: 30px;
}
.img-hover:hover {
opacity: 0.8;
}
what is wrong here i cannot understand ?
Stefce 146 Posting Pro
I want to know is it possible to do that and install your own custom software on it ?
Stefce 146 Posting Pro
Help needed with login/input security, URL's for better SEO, aggregate posts from couple website's and display on mine, and dynamic search.
Here are couple of images what i have done so far...
Shared Page
https://postimg.org/image/hy2zzvfr5/
Home Page
https://postimg.org/image/l2tinijoh/
Messages
https://postimg.org/image/ya0ouh4ij/
Account History
https://postimg.org/image/dwjw2lvr9/
Stefce 146 Posting Pro
Yeah sorry i didnt mention that, opportunity to work in the future and receiving paychecks every month, i will say again if all go as planned. I have the Marketing and Advertising strategy figured out already i'm building this project about 1 year but with not much knowledge of PHP. I was having a friend to help me with the coding, but he is working now so doesn't have much time to help me also he is from other country.
Stefce 146 Posting Pro
Definitely positive feedback from me keep it up ! :)
Did you make it by yourself ?
Stefce 146 Posting Pro
Hello i would like to invite all who like to take risks and like to build something new, i'm building a project and i can say its complete about 90% BUT i'm not experienced too much to finish the project by my self, so i need HELP from someone who know better PHP, Bootstrap, CSS and JS. I dont have any money to give from the start so thats why im writing this for those who want to help.. The project is big so if it goes as planned, we all will be happy guarantee.
Thank you and sorry for bad English :)
Stefce 146 Posting Pro
Hello i have list of football teams on every line is a new team but there are countries in brackets i want to remove all of them, here is a example of the list:
Águila (El Salvador)
Águilas (Costa Rica)
Águilas Doradas (Colombia)
Árabe Unido (Panama)
Åtvidaberg (Sweden)
Ñublense (Chile)
Örebro (Sweden)
Örgryte (Sweden)
Öster (Sweden)
Újpest (Hungary)
Ústí nad Labem (Czech Republic)
Čelik Nikšić (Montenegro)
Čelik Zenica (Bosnia and Herzegovina)
České Budějovice (Czech Republic)
Čukarički (Serbia)
İnter Bakı (Azerbaijan)
Pls help me with this, so acually i need to take the first bracket on every line and delete the rest of it
Stefce 146 Posting Pro
Oh im using Edge and Mozilla BTW my default browser is Chrome but on chrome i got a vierd error when i want to connect on localhost its sayin me `Your connection is not private
Attackers might be trying to steal your information from localhost (for example, passwords, messages, or credit cards). NET::ERR_CERT_AUTHORITY_INVALID`
Stefce 146 Posting Pro
For some reason this code doesnt work on my PC
Stefce 146 Posting Pro
Hello, I have a multidimensional array i like to make every category to be clickable and to show its own sub-categories i have something like this... pls help to achieve this.
function makeList(array $Array) {
$Output = '<ul>';
foreach($Array as $Key => $Value) {
$Output .= "<li><input type='submit' name='value[$Key]' value='$Key' />";
if(is_array($Value)) {
$Output .= makeList($Value);
} else {
$Output .= "<a name='$Value' href='#'>".$Value."</a>";
}
$Output .= '</li>';
}
$Output .= '</ul>';
return $Output;
}
$categories = array(
'cars' => array(
'BMW' => array(
'X1',
'X3',
'X5',
'X6'
),
'AUDI' => array(
'A3',
'A6'
),
'MERCEDES' => array(
'A Class' => array('Sedan', 'Coupe', 'Sport'),
'B Class'
)
),
'moto' => array(
'SUZUKI',
'HONDA',
'YAMAHA'
),
'phones' => array(
'SAMSUNG',
'LG',
'MOTOROLA'
)
);
echo makeList($categories);
Stefce 146 Posting Pro
Is this possible to make without database, i have something in mind which i want to achive.
I want to make a categories tree which user can choose final product of the categories and when he chooses to get that final product its own sub categories for ex.
Vehicles > Cars > BWM > M > M2 Coupe
Stefce 146 Posting Pro
Hello, i want to make a categories menu which each will have its own sub-categories and that category will have own sub-categories im trying to make with arrays but i'm not really good at it.. im trying right now with bunch if statements but is there any other method of doing this with loops or something eazier ?
<form action="" method="POST">
<?php
$category = array("Cars" => 1, "Bikes" => 2, "Phones" => 3);
$cars_category = array("Honda" => 1, "BMW" => 2, "Mercedes" => 3);
$bikes_category = array("Suzuki" => 1, "GSXR" => 2, "Yamaha" => 3);
$phones_category = array("Samsung" => 1, "iPhone" => 2, "LG" => 3);
foreach($category as $main_cat => $value) {
?>
<input type="submit" name="main_category[<?= $value ?>]" value="<?= $main_cat ?>" /><br>
<?php
}
if(isset($_POST["main_category"])) {
echo "<br>";
$categ = $_POST["main_category"];
foreach($categ as $value => $name) {
if($value == 1) {
foreach($cars_category as $cars => $value) {
?>
<input type="submit" name="sub_category[<?= $value ?>]" value="<?= $cars ?>" /><br>
<?php
}
} else if($value == 2) {
foreach($bikes_category as $bikes => $value) {
?>
<input type="submit" name="sub_category[<?= $value ?>]" value="<?= $bikes ?>" /><br>
<?php
}
} else if($value == 3) {
foreach($phones_category as $phones => $value) {
?>
<input type="submit" name="sub_category[<?= $value ?>]" value="<?= $phones ?>" /><br>
<?php
}
}
}
}
?>
</form>
Stefce 146 Posting Pro
Hello i have a question about the security of my website, does my website can get hacked somehow if im updating it directly from my database? (ex. images, posts, links...). I have few pages on my website which have PHP code to read info from the database and i do not have any input fields which are availabe to the public. Im asking this question because i cannot make secure system that i can update it from there. if there is other option of doing this please feel free to share and if you need to see the code i will post it just say to me. Thank you very much :)
Stefce 146 Posting Pro
I removed the password line from the sql and its working just with username
Stefce 146 Posting Pro
I checked them like this:
if($pass != $_POST['passbox']) {
?>
<li>Invalid pass</li>
<?php
} else if ($user != $_POST['userbox']) {
?>
<li>Invalid user</li>
<?php
}
Its giving me that the pass is invalid
Stefce 146 Posting Pro
now is updated with the HTML code BTW when i added the password_encrypt
function it started to not log me in the admin.php
. Also here is the register code and it works good.
<form action="admin_login.php" method="POST">
<div class= "col-md-12">
<div class="modal-body">
<br>
<label>Username</label>
<p><input type="text" id="register-username" class="form-control" name="username" /></p>
<label>Password</label>
<p><input type="password" id="register-password" class="form-control" name="password" /></p> <div id="register-message"></div>
<?php
if(isset($_POST["register"])) {
$user = $_POST["username"];
$pass = password_encrypt($_POST["password"]);
//$tac = $_POST["tac"];
/* USER LOCATION */
/*$cost = 10;
$user_ip = getenv('REMOTE_ADDR');
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
$country = $geo["geoplugin_countryName"];*/
if(!empty($user) || !empty($pass)) {
$sql = "SELECT `username` FROM `admins` WHERE `username`='".$user."'";
$result = $conn->query($sql);
if(!$result) {
echo "Database connection failed, try again in few seconds..";
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
} else {
if($result->num_rows >= 1) {
echo "Email or Username already exist, try something else.";
} else {
$sql = "INSERT INTO `admins` VALUES ('', '".$user."', '".$pass."')";
$result = $conn->query($sql);
if($result === false) {
echo "Database connection failed, try again in few seconds...";
} else {
$last_inserted_id = $conn->insert_id;
$affected_rows = $conn->affected_rows;
//exit(header("Location: index.php"));
}
}
}
}else {
echo "<div id='reg_error'>All fields are required!</div>";
}
}
?>
</div>
<div class="modal-footer">
<div class="col-md-12">
<button type="submit" name="register" class="btn btn-success">Register</button>
</div>
</div>
</div>
</form>
Stefce 146 Posting Pro
It gives me always Invalid Username or Password
what is the problem with this code ?
<form action="admin_login.php" method="POST">
<div class="form-group" style="width: 280px;">
<label for="usr">Username</label>
<input type="text" class="form-control" name="userbox" id="user">
<br>
<label for="pass">Password</label>
<input type="password" class="form-control" name="passbox" id="pass">
<br>
<button type="submit" name="login" class="btn btn-success">Log In</button>
</div>
<?php
if(isset($_POST["login"])) {
$user = $_POST["userbox"];
$pass = password_encrypt($_POST["passbox"]);
$sql = "SELECT `ID` FROM `admins` WHERE `username`='".$user."' AND `password`='".$pass."'";
$result = $conn->query($sql);
if(!$result) {
echo "There is problem with connection try again later.";
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
} else {
if($result->num_rows > 0) {
$row = $result->fetch_assoc();
$_SESSION['admin_id'] = $row['ID'];
header('Location: admin.php');
} else {
$_SESSION['admin_id'] = '';
?>
<li>Invalid Username or Password</li>
<a href="#">Forgot your password?</a>
<?php
}
}
//mysqli_close($conn);
}
?>
</form>
**Password encrypt**
function password_encrypt($password) {
$hash_format = "$2y$10$";
$salt_lenght = 22;
$salt = generate_salt($salt_lenght);
$format_and_salt = $hash_format . $salt_lenght;
$hash = crypt($password, "e5h8g7ghe58g7e5hg8e57he58h7j10jxd");
return $hash;
}
function generate_salt($lenght) {
$unique_random_string = md5(uniqid(mt_rand(), true));
$base64_string = base64_encode($unique_random_string);
$modified_base64_string = str_replace('+', '.', $base64_string);
$salt = substr($modified_base64_string, 0, $lenght);
return $salt;
}
function password_check($password, $existing_hash) {
$hash = crypt($password, $existing_hash);
if($hash === $existing_hash) {
return true;
} else {
return false;
}
}
Also i want to ask does this code is secure to use and can i put even more security ?
Stefce 146 Posting Pro
Actyally i needed to remove the trigger_error
and all works good :D
Stefce 146 Posting Pro
NO WAY haha OMG :D btw now gives me another error which idk what is it
Fatal error: Wrong SQL: INSERT INTO kladilnica (Username, Uplata, Dobivka, Date, regTime, Odds, isActive, ticket_id, isShared, is_wined, Location) VALUES ('s', '100', '200', '2016-07-07', '03:07:32pm', '300', 1, 567899149, 0, 0, 'Russia') Error: in C:\xampp\htdocs\bootstrap\navigation.php on line 257
line 257 is the same SQL in this post
Stefce 146 Posting Pro
$sql = "INSERT INTO kladilnica (Username, Uplata, Dobivka, Date, regTime, Odds, isActive, ticket_id, isShared, is_wined, Location) VALUES ('".$user."', '".$bet."', '".$gain."', '".$date."', '".$regTime."' '".$odds."', 1, $randomTicketID, 0, 0, '".$userLocation."')";
$result = $conn->query($sql);
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
I searched on google and found that you need to have equal fields and values in the SQL. But sudently i have that but it gives me the same error again Column count doesn't match value count at row 1
Stefce 146 Posting Pro
Its a input text with dropdown menu which you can choose your default currency.
Stefce 146 Posting Pro
Any help about the info you give to me please ?
Stefce 146 Posting Pro
I have problem with selecting elements from array i have this code which is supposed to take the choosed element and echo it back but instead that this code just takes last element and echo it what is wrong with the code ?
<div class="col-xs-3">
<?php
global $m;
$currencies = array("GBP"=>"£", "EUR"=>"€", "USD"=>"$");
?>
<form action="" method="POST">
<div class="input-group stylish-input-group">
<p><input type="text" class="form-control" placeholder="Bet" name="bet" style="display: inline;" required/></p>
<span class="input-group-addon">
<button type="button">
<span class="glyphicon glyphicon-menu-down" tabindex="0" title="Choose Currency" role="button" data-toggle="popover" data-trigger="focus" data-placement="bottom" data-content="
<?php
foreach($currencies as $m => $value) {
?>
<p><a href='#' type='submit' data-toggle='modal' data-target='#currencyModal'><?= $m; ?></a></p>
<?php
}
?>"/><?php echo $m ?></span>
</button>
</span>
</div>
</form>
</div>
<div class="modal fade" id="currencyModal" tabindex="0" data-trigger="focus" role="dialog" aria-labelledby="myModalLabell">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Set Default Currency</h4>
</div>
<div class="modal-body">
<p>Do you want to make <?php echo $m; ?> your default currency ?</p>
<br>
<p style="font-size: small; color: #90949c;">By setting it by default you will be no longer asked to choose default currency. Also tickets you add automatically will be in the currency you choose as default.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" >YES</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">NO</button>
</div>
</div>
</div>
</div>
Stefce 146 Posting Pro
Hello guys i need to get all currencies in the world is there anyone who knows where to get them in a file so i can import it in my website or someone who can help me to solve with regular expression here is the WEBSITE where i have fund them but i do not know how to sepperate just the currencies if someone could do that for me will be greatly appreciated.
Stefce 146 Posting Pro
How do i get the most repeated value that is inserted just today from 23:59 till 00:00 i have this sql but i dont know how to filter it by date any help will be apreciated.
$sql = "SELECT `MatchTitle`, COUNT(`MatchTitle`) AS `mostPlayed` FROM `matches` GROUP BY `MatchTitle` ORDER BY `mostPlayed` DESC LIMIT 1";
Stefce 146 Posting Pro
I have downloaded fxsound.com like rproffitt recommended me and im pretty satisfied :)
Stefce 146 Posting Pro
Is there any program for boosting my headphones i have searched on internet but all i get is the same steps (right click on volume>Playback Devices > Properties>Enhacements> Enable Sound Equalizer)
Stefce 146 Posting Pro
I want to make dynamic search button i have this code but doesnt work it gives me this errorCould not connect to database. Fatal error: Wrong SQL: SELECT * FROM kladilnica WHERE Location = Macedonia AND Uplata = 50 AND Liked = 50 Error: Unknown column 'Macedonia' in 'where clause' in C:\xampp\htdocs\bootstrap\shared.php on line 238
Here is the code
if(isset($_POST['searchBtn'])) {
$selectCountryBox = $_POST['selectCountryBox'];
$filterByBet = $_POST['filterByBet'];
$filterByLikes = $_POST['filterByLikes'];
$filterByPublisher = $_POST['filterByPublisher'];
//$filterByDate = $_POST['filterByDate'];
$searchArr = array();
if($selectCountryBox != "") $searchArr[] = "Location = {$selectCountryBox}";
if($filterByBet != "") $searchArr[] = "Uplata = {$filterByBet}";
if($filterByLikes != "") $searchArr[] = "Liked = {$filterByLikes}";
if($filterByPublisher != "") $searchArr[] = "Username = {$filterByPublisher}";
//if($filterByDate != "") $searchArr[] = "Date = {$filterByDate}";
$searchArr = implode(" AND ", $searchArr);
$query = "SELECT * FROM kladilnica WHERE {$searchArr}";
$result = $conn->query($query);
if($result === false) {
echo "<b>Could not connect to database.</b>";
trigger_error('Wrong SQL: ' . $query . ' Error: ' . $conn->error, E_USER_ERROR);
} else {
echo "YES!";
echo $result;
/*while($row = $result->fetch_assoc()) {
$getCountry = $row["Location"];
}*/
}
}
Stefce 146 Posting Pro
You have misstake in mysqli_connect order $conn = mysqli_connect($host, $db, $user, $pass)
should be like this $conn = new mysqli_connect($host, $db, $pass, $user);
Stefce 146 Posting Pro
Hello everone, i have a teams.txt
file there are soccer clubs every team on new line i want to split the country from the club when is inserted into database. The country is the last string ex.FC Barcelona (Spain)
Arsenal (England)
Any help will be appreciated.
I have tried with simple string variable and it works but i do not know how to from a file:
$string = "FC Vardar (Macedonia)";
$split = substr($string, 0, strrpos($string, " "));
echo $split;
Stefce 146 Posting Pro
Someone ?
Stefce 146 Posting Pro
@ryantroop i'm using this for opening new page for reading news.
Stefce 146 Posting Pro
I have wierd problem the navigation is working good everywhere but on home.php
file it doesnt work when i press the MORE button to open the dropdown here is my code, what can cause this problem ?
sidebar.css
body,html{
height: 100%;
}
/* remove outer padding */
.main .row{
padding: 0px;
margin: 0px;
}
/*Remove rounded coners*/
nav.sidebar.navbar {
border-radius: 0px;
}
nav.sidebar, .main{
-webkit-transition: margin 200ms ease-out;
-moz-transition: margin 200ms ease-out;
-o-transition: margin 200ms ease-out;
transition: margin 200ms ease-out;
}
/* Add gap to nav and right windows.*/
.main{
padding: 10px 10px 0 10px;
}
/* .....NavBar: Icon only with coloring/layout.....*/
/*small/medium side display*/
@media (min-width: 768px) {
/*Allow main to be next to Nav*/
.main{
position: absolute;
width: calc(100% - 40px); /*keeps 100% minus nav size*/
margin-left: 40px;
float: right;
}
/*lets nav bar to be showed on mouseover*/
nav.sidebar:target + .main{
margin-left: 220px;
}
/*Center Brand*/
nav.sidebar.navbar.sidebar>.container .navbar-brand, .navbar>.container-fluid .navbar-brand {
margin-left: 0px;
}
/*Center Brand*/
nav.sidebar .navbar-brand, nav.sidebar .navbar-header{
text-align: center;
width: 100%;
margin-left: 0px;
}
/*Center Icons*/
nav.sidebar a{
padding-right: 13px;
}
/*adds border top to first nav box */
nav.sidebar .navbar-nav > li:first-child{
border-top: 1px #e5e5e5 solid;
}
/*adds border to bottom nav boxes*/
nav.sidebar .navbar-nav > li{
border-bottom: 1px #e5e5e5 solid;
}
/* Colors/style dropdown box*/
nav.sidebar .navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
/*allows nav box to use 100% width*/
nav.sidebar .navbar-collapse, nav.sidebar .container-fluid{
padding: 0 0px 0 …
Stefce 146 Posting Pro
I have made a huge misstake i have closed connection after getUserData
i have commented the $conn->close();
and now works good :D
function getUserData($table, $field) {
global $conn;
$DBServer = 'localhost';
$DBUser = 'root';
$DBPass = '';
$DBName = 'upstrey';
$conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT `$field` FROM `$table` WHERE `ID`='".$_SESSION['user_id']."'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
if($row = $result->fetch_assoc()) {
return $row["$field"];
}
}
//$conn->close();
}
Stefce 146 Posting Pro
Opps my misstake it happens... :D I get nothing with the right variable names, it loads with out errors but nothing shows on the screen
Stefce 146 Posting Pro
It gives me ERROR: 1046 [3D000]: No database selected
i have do it in other script.
test.php
<?php
$DBServer = 'localhost';
$DBUser = 'root';
$DBPass = '';
$DBName = 'upstrey';
$mysqli = @new mysqli($DBServer, $dbuser, $dbpass, $dbname);
if($mysqli->connect_errno)
die(sprintf("CONNECT ERROR: %s: %s", $mysqli->connect_errno, $mysqli->connect_error));
$result = $mysqli->query("
SELECT
`Uplata`, `Dobivka`, `Date`, `sharedTime`, `match1`, `match2`,
`match3`, `match4`, `match5`, `match6`, `match7`, `match8`, `match9`,
`match10`, `match11`, `match12`, `match13`, `match14`, `match15`,
`match16`,`Odds`, `tip1`, `tip2`, `tip3`, `tip4`, `tip5`, `tip6`,
`tip7`, `tip8`, `tip9`, `tip10`, `tip11`, `tip12`, `tip13`, `tip14`,
`tip15`, `tip16`, `isActive`, `ticket_id`, `isShared`, `Username`,
`Liked`, `is_wined`
FROM
`kladilnica`
WHERE
Username='{s}'
");
if($mysqli->errno)
die(sprintf("ERROR: %s [%s]: %s", $mysqli->errno, $mysqli->sqlstate, $mysqli->error));
while($row = $result->fetch_row())
print $row[0];
?>
Stefce 146 Posting Pro
Does this can happen because connection file is wrong ? Here is the code i have in the connect.php
<?php
$DBServer = 'localhost';
$DBUser = 'root';
$DBPass = '';
$DBName = 'upstrey';
$conn = mysqli_connect($DBServer, $DBUser, $DBPass, $DBName);
// Check connection
if ($conn->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
}
?>
By commenting line 22 i get the information tables of the other file thats hitory.php
and im getting just this error: Warning: mysqli::query(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 27 db problem:
Stefce 146 Posting Pro
It gives me this error again
Warning: mysqli::query(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 27
Warning: main(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 30
db problem:
Warning: main(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 31
Fatal error: Wrong SQL: SELECT `Uplata`, `Dobivka`, `Date`, `sharedTime`, `match1`, `match2`, `match3`, `match4`, `match5`, `match6`, `match7`, `match8`, `match9`, `match10`, `match11`, `match12`, `match13`, `match14`, `match15`, `match16`,`Odds`, `tip1`, `tip2`, `tip3`, `tip4`, `tip5`, `tip6`, `tip7`, `tip8`, `tip9`, `tip10`, `tip11`, `tip12`, `tip13`, `tip14`, `tip15`, `tip16`, `isActive`, `ticket_id`, `isShared`, `Username`, `Liked`, `is_wined` FROM `kladilnica` WHERE Username='s' Error: in C:\xampp\htdocs\bootstrap\tickets_info.php on line 31
Stefce 146 Posting Pro
Line 27: $result = $conn->query($sql);
Line 31: trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);