Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×
  • 0

Mysql connect


Fenikss

Question

<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'game';
 
$connect = @mysql_connect($host, $user, $pass) or die('socket error');
@mysql_select_db($db, $connect) or die('socket error - no db');
@mysql_query("SET NAMES 'utf8-polish-ci'");
 
session_start();
 
$user = @mysql_fetch_array(@mysql_query("select * from user where id = '".$_SESSION['user']."' limit 1")) or die('socket error - no table');
 
?>
 
i got errors socket error - no table
i have this table what is wrong?
Link to comment
Share on other sites

  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

2 answers to this question

Recommended Posts

  • 0

Replace or die('socket error - no table'); with

or die(mysql_error());

 

and paste the error here

i have problem here i want create login and haslo this ius code

<?php require_once('game/config/config.php'); ?>
<?php

$db_user = @mysql_num_rows(@mysql_query("select * from user"));
$code = @mysql_query("select * from user order by id asc");
if(!empty($_POST['login'])){
if(!empty($_POST['haslo'])){
if(!empty($_POST['user'])){
$db_user_dane = @mysql_fetch_array(@mysql_query("select * from user where id = '".$_POST['user']."','".$_POST['login']."' and haslo = '".$_POST['haslo']."' limit 1"));
if(!empty($db_user_dane)){
$_SESSION['user'] = $_POST['user'];
header('Location: game.php');
} else {
echo "<span style='color: red; font-weight: bold;'>Bledny Login</span><hr>";
}
} else {
echo "<span style='color: red; font-weight: bold;'>Bledne Haslo</span><hr>";

}
}
}
?>






<center>
<form action='logowanie.php' method='post'>
<select name="user">
<?php
while($wczytuje = @mysql_fetch_array($code)){
echo "<option value='".$wczytuje['id']."'>".$wczytuje['nazwa']."(".$wczytuje['poziom'].")</option>";
}
?>
</select><br>
<input type='text' name='login' style='width: 100px;'><br>
<input type='password' name='haslo' style='width: 100px;'><br>
<input type='submit' value='Zaloguj'><br>
</form>
<hr>

when i paste wrong password message is wrong login when i paste wrong login i have wrong login and when i paste 123 password this is password and login and not work i see message wrong login

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.