connection problem

hello
51 Replies
NIMA
NIMA3w 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
ἔρως
ἔρως3w ago
is that the entire code of insert.php?
NIMA
NIMA3w ago
its not insert its concction for insert
NIMA
NIMA3w 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
b1mind3w ago
I'm assuming you have the data base set up on the hosting and are using that info to connect?
NIMA
NIMA3w ago
yes i cheak names and it was fix
ἔρως
ἔρως3w ago
sql injection danger! please use prepared statements
NIMA
NIMA3w ago
i know i just want to see itx fix or no
ἔρως
ἔρως3w ago
also, it's time to switch to pdo
NIMA
NIMA3w ago
and then add the fix for sql injection why ?
ἔρως
ἔρως3w ago
some things are a lot easier like, using prepared statements
NIMA
NIMA3w ago
i will cheak thath soo see the diffrent do u know why i cant use the data base
ἔρως
ἔρως3w 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
NIMA3w ago
yes i copy the ip from website
ἔρως
ἔρως3w ago
and are you sure you cant connect?
NIMA
NIMA3w 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
ἔρως
ἔρως3w ago
then do a die(mysqli_connect_error()); after the require contact your host and make sure the username and password are correct
NIMA
NIMA3w ago
i get it from c pannel no one send me anything hamoon c pannel in website i need to create it in there
ἔρως
ἔρως3w ago
contact the support team
NIMA
NIMA3w ago
aright
ἔρως
ἔρως3w 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
NIMA3w 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
ἔρως
ἔρως3w ago
now try it also, make sure you gave all the privileges to it
NIMA
NIMA3w ago
it still say Connection refused
ἔρως
ἔρως3w ago
change the passwlrd password
NIMA
NIMA3w 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
ἔρως
ἔρως3w ago
alright
NIMA
NIMA3w ago
my ip was wrong and now its fix but still cant get acces to data base
ἔρως
ἔρως3w ago
did you enable all permissions?
NIMA
NIMA3w ago
Yes
b1mind
b1mind3w ago
So since you said yes to this but obviously not correct, I would back track and double check everything
NIMA
NIMA3w 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
b1mind3w ago
Also you should have logs on the server when you visit, I would check them
NIMA
NIMA3w ago
in c pannel ?
b1mind
b1mind3w ago
I'd assume
ἔρως
ἔρως3w ago
are you sure the user has access to the database? did you saved when you set all permissions?
NIMA
NIMA3w ago
yes i do it many times
ἔρως
ἔρως3w ago
this is missing the list of users in the database
NIMA
NIMA3w 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
NIMA3w ago
this keep my website to old code and not update the code
ἔρως
ἔρως3w 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
b1mind3w ago
Its always DNS or caching >.>;; 😂
ἔρως
ἔρως3w 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