Jump to content

Ajutor PHP/Panel SA:MP


Konti.

Recommended Posts

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/u175840649/public_html/panel/includes/connection.php on line 2

Warning: mysql_connect(): Access denied for user 'port_7779'@'10.2.1.9' (using password: YES) in /home/u175840649/public_html/panel/includes/connection.php on line 2
Nu se poate efectua conexiunea MYSQL.

 

Fille Connection.php

 

<?php
$link = mysql_connect('127.0.0.1', 'port_7779', 'parolamea') or die("Nu se poate efectua conexiunea MYSQL.");
mysql_select_db('port_7779', $link);

$dbh = new PDO('mysql:host=127.0.0.1;dbname=port_7779;charset=utf8', 'port_7779', 'parolamea');


?>

Problema intalnita (descriere): O problema la conectarea unu panel.
Ero(area / rile) / warning-(ul / urile):Nu se poate efectua conexiunea MYSQL.
Liniile de cod / sursa / script-ul(obligatoriu):-
Imagini / Video (optional):-
Ati incercat sa rezolvati singur?:Da, am incercat dar nu a mers.

 

Link to comment
Share on other sites

Daca il ai in PC la mysql_connect pune localhost

Si in rest ar trebui sa iti mearga ok daca ai pus datele corecte.

  • Upvote 1

Ofer servicii de web designer/developer(contact me pentru portofoliu etc)

Metode de plata: Paysafecard,Skrill,PayPal,Bitcoin

Ofer si servicii de Penetration Testing.

Vand si VPN-uri. 5 euro pe luna

Skype: live:mrtunne.tkcode

Discord: https://mrtunne.info/discord

Link to comment
Share on other sites

Daca il ai in PC la mysql_connect pune localhost

Si in rest ar trebui sa iti mearga ok daca ai pus datele corecte.

Acum am alta problema...

Fatal error: Call to undefined function localhost() in /home/u175840649/public_html/panel/includes/connection.php on line 2

Link to comment
Share on other sites

mysql_connect('daca il tii pe pc pune localhost', 'user baza de date, daca il tii pe pc pune root, 'parola user baza de date, daca il tii pe pc si folosesti la user root, lasa liber')

 

mysql_select_db('aici pui numele bazei de date care ai creat-o', $link);

$dbh = new PDO('mysql:host=127.0.0.1;dbname=port_7779;charset=utf8', 'port_7779', 'parolamea');

aici pui ce am spus si mai sus:

host: localhost sau ce ip ai de la firma de hosting

dbname: baza de date care ti-au dat-o cei de la firma sau pe care ai creat-o tu

in loc de 'port_7779' ar trebui sa fie userul: deci daca il ai pe pc pui root, daca nu, ce ti-au dat cei de la firma

in loc de 'parolamea' iti pui parola ce ti-au dat-o de la firma sau daca ai pe pc si folosesti la user root, lasi liber. Insa daca ti-ai creat un user cu parola la baza de date care o folosesti, pui parola care ai ales-o acolo.

 

$dbh = new PDO('mysql:host=127.0.0.1;dbname=port_7779;charset=utf8', 'port_7779', 'parolamea');

Link to comment
Share on other sites

Si in locuiesc asta: public PDO::__construct ( string $dsn [, string $username [, string $password [, array$options ]]] )

Cu: 

$dbh = new PDO('mysql:host=127.0.0.1;dbname=port_7779;charset=utf8', 'port_7779', 'parolamea');

????

 

Link to comment
Share on other sites

Si in locuiesc asta: public PDO::__construct ( string $dsn [, string $username [, string $password [, array$options ]]] )

Cu: 

$dbh = new PDO('mysql:host=127.0.0.1;dbname=port_7779;charset=utf8', 'port_7779', 'parolamea');

????

 

Nu, il inlocuiesti cu

$DatabaseHandler = new PDO("mysql:dbname=nume_baza_de_date;host=127.0.0.1", "Nume de utilizator", "Parola");

 

Link to comment
Share on other sites

Uite am inlocuit...
Si oricum nu merge

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in/home/u175840649/public_html/panel/includes/connection.php on line 2

Warning: mysql_connect(): Access denied for user 'port_7779'@'10.2.1.9' (using password: YES) in /home/u175840649/public_html/panel/includes/connection.php on line2
Nu se poate efectua conexiunea MYSQL.

connection.php

Link to comment
Share on other sites

Tu in fisier inca ai mysql.

Incearca sa modifici tot fisierul asa:

<?php
$DatabaseHandler = new PDO("mysql:dbname=nume_baza_de_date;host=127.0.0.1", "Nume de utilizator", "Parola"); or die("Nu se poate efectua conexiunea MYSQL.");
?>

si pui datele tale,in caz ca am gresit ma va corecta WopsS

Ofer servicii de web designer/developer(contact me pentru portofoliu etc)

Metode de plata: Paysafecard,Skrill,PayPal,Bitcoin

Ofer si servicii de Penetration Testing.

Vand si VPN-uri. 5 euro pe luna

Skype: live:mrtunne.tkcode

Discord: https://mrtunne.info/discord

Link to comment
Share on other sites

Tu in fisier inca ai mysql.

Incearca sa modifici tot fisierul asa:

<?php
$DatabaseHandler = new PDO("mysql:dbname=nume_baza_de_date;host=127.0.0.1", "Nume de utilizator", "Parola"); or die("Nu se poate efectua conexiunea MYSQL.");
?>

si pui datele tale,in caz ca am gresit ma va corecta WopsS

Poftim:

Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR) in /home/u175840649/public_html/panel/includes/connection.php on line 2

Link to comment
Share on other sites

Posibil sa mai ai si alte scripturi in panel sau ce ai tu,care mai au mysql prin el

Ofer servicii de web designer/developer(contact me pentru portofoliu etc)

Metode de plata: Paysafecard,Skrill,PayPal,Bitcoin

Ofer si servicii de Penetration Testing.

Vand si VPN-uri. 5 euro pe luna

Skype: live:mrtunne.tkcode

Discord: https://mrtunne.info/discord

Link to comment
Share on other sites

@TheTuNNeFPS nu mai e valabila asta cu or die. Este acum try-catch

 try
{
    $DatabaseHandler = new PDO("mysql:dbname=nume_baza_de_date;host=127.0.0.1", "Nume de utilizator", "Parola");
}
catch (PDOException $e)
{
    throw new Exception($e->getMessage());
}

 

Acolo primeai eroarea aia pentru ca era ; inainte de or.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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. For more details you can also review our Terms of Use and Privacy Policy.