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