Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 13:21

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



PHP / Mysql Problem

Discussion on PHP / Mysql Problem within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1

 
Nanoxx™'s Avatar
 
elite*gold: 15
Join Date: Feb 2013
Posts: 2,880
Received Thanks: 465
PHP / Mysql Problem

Hey,

ich habe ein kleines Problem mit einem PHP Script

PHP:

PHP Code:
<?php

$host  
"localhost";
$user  "username";
$pass  "password";
$datab "db";
$table "Programme";

$PId addslashes($_GET['id']);

$db = @mysql_connect($host$user$pass);
if (
$db
{
    if (@
mysql_select_db($datab$db)) 
    {

        
$query "UPDATE $table SET Downloads = Downloads + 1 WHERE ProgramID = '$PId'";
        @
mysql_query($query);
        
       
        if (
mysql_affected_rows() == 0
        {
            exit(
0);
        }
        

        
$result mysql_query("SELECT DownloadUrl FROM Programme WHERE ProgramID = '$PId'");
        
$dlurl mysql_result($result,0,0);

    }
}

header("Location: "$dlurl);
exit;
?>
MYSQL:

PHP Code:
CREATE TABLE `Programme
(
  `
Name`         TEXT       DEFAULT NULL,
  `
DownloadUrl`  TEXT       DEFAULT NULL,
  `
ProgramID`    bigint(20) DEFAULT NULL,
  `
Downloads`    bigint(20) DEFAULT NULL
  
ENGINE=InnoDB DEFAULT CHARSET=latin1

Server: Ubuntu 14.04 / Apache / PHP5 / MYSQL 5.5.44

Beim Aufruf bleibt die Seite weiß (Kein Download / Kein Fehler)

Kann mir da jemand helfen?
Nanoxx™ is offline  
Old 11/07/2015, 01:07   #2
 
matrix72's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 745
Received Thanks: 59
Würde sagen, dass $dlurl keinen Wert bekommt.
Gib mal aus wie viele Zeilen bei der Query gezählt werden.
matrix72 is offline  
Thanks
1 User
Old 11/07/2015, 01:20   #3

 
Nanoxx™'s Avatar
 
elite*gold: 15
Join Date: Feb 2013
Posts: 2,880
Received Thanks: 465
PHP Code:
<?php

$host  
"localhost";
$user  "username";
$pass  "password";
$datab "db";
$table "Programme";

$PId addslashes($_GET['id']);

echo 
'A';
$db = @mysql_connect($host$user$pass);

    if (@
mysql_select_db($datab$db)) 
    {
        echo 
'B';
Funktioniert nicht... Aber -> A wird ausgegeben B nicht mehr. Daten sind richtig (Da ich über zb. Navicat verbinden kann)
Nanoxx™ is offline  
Old 11/07/2015, 02:20   #4
 
matrix72's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 745
Received Thanks: 59
Bitte mach mal die '@' bei den Mysql functions weg, damit du
wenigstens eine Error Anzeige bekommst.
matrix72 is offline  
Thanks
1 User
Old 11/07/2015, 03:11   #5

 
Nanoxx™'s Avatar
 
elite*gold: 15
Join Date: Feb 2013
Posts: 2,880
Received Thanks: 465
PHP Code:
Fatal errorCall to undefined function mysql_connect() in /var/www/html/Downloads/download.php on line 12 
Das ganze ist ja schon fertig... welche version von php muss ich installieren damit ich das so wieder benutzen kann? :|

//Problem gelöst -> mysqli benutzen!
Nanoxx™ is offline  
Old 11/07/2015, 04:01   #6
 
matrix72's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 745
Received Thanks: 59
Generell solltest du zu MySQLi tendieren, da MySQL veraltet ist und bald von PHP wahrscheinlich entfernt wird.
matrix72 is offline  
Thanks
1 User
Old 11/07/2015, 17:16   #7
 
Mikesch01's Avatar
 
elite*gold: 203
Join Date: Sep 2007
Posts: 732
Received Thanks: 190
Welche PHP-Version hast du denn benutzt, dass mysql_* Funktionen nicht mehr vorhanden sind?^^
Mikesch01 is offline  
Reply


Similar Threads Similar Threads
Problem with mysql (EN) Mysql geht nicht mehr on (DE)
01/06/2015 - Metin2 Private Server - 6 Replies
EN: Helo guys , i installed mysql 5.6 version , and i put a DB that i had in my PC from a metin2 server . When i wanted to log in with "mysql -u root -p" it said "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' " . And when i have the default database , it works , and when i import then one by one works too , but when i start the server , the users are missing ... DE: Hallo leute , ich hab mysql 5.6 installiert , und ich hab eine DB die auf mein...
[MYSQL]Mysql.sock problem.
06/15/2013 - Metin2 Private Server - 3 Replies
http://www.metin2dream.com/upload/images/sinttuvnv .jpg Solution?, i reinstall mysql, is dedicated
[PROBLEM]:[Root]:Mysql:[...]/tmp/mysql.sock
10/22/2011 - Metin2 Private Server - 3 Replies
Hallo Community habe jetzt seit ein Paar Tagen einen Fehler Namens: failed, retrying in 5 secondsmysql_real_connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Screen: http://img809.imageshack.us/img809/9805/helpg.png



All times are GMT +2. The time now is 13:21.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.