Pagina 1 din 1

'No database slected' error

Scris: Vin Dec 09, 2011
de LCristian
Mereu cand folosesc scriptul...No database selected ...

Cod: Selectaţi tot

<?php
require_once('cfg/config.php');
	$MySQL=mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($accdb);

$name = $_POST['accid'];
$datetime = date('Y-m-d H:i:s');
$ip = $_SERVER[REMOTE_ADDR];

if($_POST['submit'])
{
  if ($name==false)
  {
    echo 'Please Type In Your Account ID!';
  }
  else
  {
    $idchk=mysql_query("SELECT * FROM accounts WHERE `name`=(".$name.")") or die (mysql_error());
    $mail=mysql_fetch_assoc($idchk);
    mysql_select_db($mydb);
    $user=mysql_query("SELECT * FROM `cq_user` WHERE `account_id`=(".$mail['id'].")") or die (mysql_error());
    $id=mysql_fetch_assoc($user);
    if(mysql_num_rows($idchk)== 0)
    {
      echo 'This AccountID Does Not Exist!';
    }
    else
    {
      $voteip=mysql_query("SELECT * FROM `vote` WHERE `ip`=(".$ip.")") or die (mysql_error());
      if(mysql_num_rows($voteip)== 0)
      {
        $votemail=mysql_query("SELECT * FROM `vote` WHERE `email`=(".$mail['email'].")") or die (mysql_error());
        if(mysql_num_rows($votemail)==0)
        {
           echo "<meta http-equiv=\"refresh\" content=\"0;url=".$url."\" />";
            mysql_query("INSERT INTO vote SET `email`=(".$mail['email']."),`ip`=(".$ip."), `timestamp`=(".date('Y-m-d H:i:s').") ") ;
	        mysql_query("UPDATE cq_user SET `emoney`=`emoney`+(".$emoney.") where id=(".$id['id'].")") ;
           echo 'Your Voting Genreted Sucssesfuly';
        }
        else
        {
          $votemail2=mysql_query("SELECT * FROM `vote` WHERE `email`=(".$mail['email'].") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
        if(mysql_num_rows($votemail2)==0)
        {
          echo 'You Have Already Voted!';
        }
        else
        {
          $voteip2=mysql_query("SELECT * FROM `vote` WHERE `ip`=(".$ip.") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
          if(mysql_num_rows($voteip2)== 0)
          {
            echo 'You Have Already Voted!';
          }
          else
          {
           echo "<meta http-equiv=\"refresh\" content=\"0;url=(".$url.")\" />";
           mysql_query("UPDATE vote SET `ip`=(".$ip."),`timestamp`=(".date('Y-m-d H:i:s').") WHERE `email`=(".$mail['email'].")") ;
           mysql_query("UPDATE cq_user SET `emoney`=`emoney`+(".$emoney.") where id=(".$id['id'].")") ;
           echo 'Your Voting Genreted Sucssesfuly';
          }
        }
        }
      }
        else
        {
        $votemail2=mysql_query("SELECT * FROM `vote` WHERE `email`=(".$mail['email'].") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
        if(mysql_num_rows($votemail2)==0)
        {
          echo 'You Have Already Voted!';
        }
        else
        {
          $voteip2=mysql_query("SELECT * FROM `vote` WHERE `ip`=(".$ip.") AND UNIX_TIMESTAMP(`timestamp`) <= UNIX_TIMESTAMP((" .date('Y-m-d H:i:s', strtotime('-12 Hours'))."))") or die (mysql_error());
          if(mysql_num_rows($voteip2)== 0)
          {
            echo 'You Have Already Voted!';
          }
          else
          {
           echo "<meta http-equiv=\"refresh\" content=\"0;url=(".$url.")\" />";
           mysql_query("UPDATE vote SET `ip`=(".$ip."),`timestamp`=(".date('Y-m-d H:i:s').") WHERE `email`=(".$mail['email'].")") ;
           mysql_query("UPDATE cq_user SET `emoney`=`emoney`+(".$emoney.") where id=(".$id['id'].")") ;
           echo 'Your Voting Genreted Sucssesfuly';
          }
          }
        }
    }
  }
  }
?>
</div>			
Config:

Cod: Selectaţi tot

<?php

$mysql['myhost'] = 'localhost';
$mysql['myuser'] = 'root';
$mysql['mypass'] = 'parolamea';


	$accdb='codatabase';         //account database
	$gamedb='codatabase';			    // game database
	
  
  //status.php
  $serveraddress='94.52.44.211:8080'; 	//IP
	$serverport=5817;		//gameserver connection port
	$servername='XSGaming'; 	//name
 
	
$url='http://bit.ly/xsg_vote'; //your VOTE site
$emoney='80050';
	

	$MySQL=mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($gamedb);
Scriptul a fost la inceput criptat si am folosit un decoder online care mi la dat cu X-uri in loc de "a" sau ")" si l`am rescris eu.

'No database slected' error

Scris: Vin Dec 09, 2011
de lookme
problema aste aici

Cod: Selectaţi tot

    $mail=mysql_fetch_assoc($idchk);
    mysql_select_db($mydb);
$mydb ar trebui sa fie $numele bazei de date in cazul tau

Cod: Selectaţi tot

$gamedb
sau

Cod: Selectaţi tot

$accdb

'No database slected' error

Scris: Sâm Dec 10, 2011
de alves
Salut,cred ca problema este in config.Tu ai pus asa:

Cod: Selectaţi tot

$mysql['myhost'] = 'localhost';
$mysql['myuser'] = 'root';
$mysql['mypass'] = 'parolamea';
Eu cred ca trebuie sa pui direct variabile cu numele lor ca sa mearga,adica asa:

Cod: Selectaţi tot

$myhost='localhost';
$myuser='root';
$mypass='parolamea';
Deocamdata asta cred ca e problema,sa imi zici daca merge.