connection problem

hello
51 Replies
NIMA
NIMAOP2mo ago
i test my website in xampp and it was 100% fine and working and now i put it in my website its wont connect to data base im thinking my problem is on my connection part
ἔρως
ἔρως2mo ago
is that the entire code of insert.php?
NIMA
NIMAOP2mo ago
its not insert its concction for insert
NIMA
NIMAOP2mo ago
everything work fine in xamp but in host it give me error 500 i think i got problem in the username and stuff like thath and im not sure what should i put in there
b1mind
b1mind2mo ago
I'm assuming you have the data base set up on the hosting and are using that info to connect?
NIMA
NIMAOP2mo ago
yes i cheak names and it was fix
ἔρως
ἔρως2mo ago
sql injection danger! please use prepared statements
NIMA
NIMAOP2mo ago
i know i just want to see itx fix or no
ἔρως
ἔρως2mo ago
also, it's time to switch to pdo
NIMA
NIMAOP2mo ago
and then add the fix for sql injection why ?
ἔρως
ἔρως2mo ago
some things are a lot easier like, using prepared statements
NIMA
NIMAOP2mo ago
i will cheak thath soo see the diffrent do u know why i cant use the data base
ἔρως
ἔρως2mo ago
if you are using xampp, use the local database for testing also, have a .env file you dont send to your repo with all the login info but without any errors, it's impossible to know also, are you sure the ip is correct? usually cheap hosts have the database in localhost also, make sure the port is correct
NIMA
NIMAOP2mo ago
yes i copy the ip from website
ἔρως
ἔρως2mo ago
and are you sure you cant connect?
NIMA
NIMAOP2mo ago
if it was connect . it must show the data in the index tabel at first page Connection failed: Connection refused this is what i get when im testing Connection
ἔρως
ἔρως2mo ago
then do a die(mysqli_connect_error()); after the require contact your host and make sure the username and password are correct
NIMA
NIMAOP2mo ago
i get it from c pannel no one send me anything hamoon c pannel in website i need to create it in there
ἔρως
ἔρως2mo ago
contact the support team
NIMA
NIMAOP2mo ago
aright
ἔρως
ἔρως2mo ago
wait click where it says "add user to database" you have the user and database, but both arent related you need to add the user to the database after it is created
NIMA
NIMAOP2mo ago
opss i think Manage User Privileges User: nimakhad_main Database: nimakhad_book Success: You saved “nimakhad_main”’s privileges on the database “nimakhad_book”. let me test it and see what will happen
ἔρως
ἔρως2mo ago
now try it also, make sure you gave all the privileges to it
NIMA
NIMAOP2mo ago
it still say Connection refused
ἔρως
ἔρως2mo ago
change the passwlrd password
NIMA
NIMAOP2mo ago
it give agine error i think my ip is not fix all all stuff is fix rn let me make sure ip is true
ἔρως
ἔρως2mo ago
alright
NIMA
NIMAOP2mo ago
my ip was wrong and now its fix but still cant get acces to data base
ἔρως
ἔρως2mo ago
did you enable all permissions?
NIMA
NIMAOP2mo ago
Yes
b1mind
b1mind2mo ago
So since you said yes to this but obviously not correct, I would back track and double check everything
NIMA
NIMAOP2mo ago
im cheaking rn but i cant finde any problem there is no error in the insert file when i put data in input and press submit it go to whit page and not even redirect to my index
b1mind
b1mind2mo ago
Also you should have logs on the server when you visit, I would check them
NIMA
NIMAOP2mo ago
in c pannel ?
b1mind
b1mind2mo ago
I'd assume
ἔρως
ἔρως2mo ago
are you sure the user has access to the database? did you saved when you set all permissions?
NIMA
NIMAOP2mo ago
yes i do it many times
ἔρως
ἔρως2mo ago
this is missing the list of users in the database
NIMA
NIMAOP2mo ago
idk how but i fix it i dealet all html / php and all stuff + all sql and data base and it got fix but i think my problem was this button
NIMA
NIMAOP2mo ago
this keep my website to old code and not update the code
ἔρως
ἔρως2mo ago
yeah, that can do it too disabling all caching while in development is important but that was a nice catch from you i would never though it was cache but then again, if you ask https://shouldiblamecaching.com/ the answer is always "Yes"
b1mind
b1mind2mo ago
Its always DNS or caching >.>;; 😂
ἔρως
ἔρως2mo ago
now it makes sense as to why it was always returning error 500 after everything was fixed
Want results from more Discord servers?
Add your server