eduard Posted April 11, 2011 Author Share Posted April 11, 2011 I changed the server´s name (localhost), but I get still this message:array(3) { ["description"]=> string(1) "w" ["price"]=> string(1) "1" ["quantity"]=> string(1) "2" } succesful form submission. initialize DB connection .....Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'zcohosting' (1) in /home/eduardli/public_html/website/insert.php on line 10Could not connect: Unknown MySQL server host 'zcohosting' (1)And my website folder is now on my dektop, but the sever read it as still in my htldocs folder of MAMP!How do I change this? Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 Another question: I´ve uploaded the changed files, but they will work AFTER the host has refreshed his server? (because now it doesn´t!) Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 First, to clarify, the settings on your local machine running MAMP, and the settings on your hosted server are not the same. The username and password for your local MAMP copy of MySQL are probably the default settings unless you changed them. The username and password on your hosted account are definitely not the default settings, either your host would have set you up with a username and password, or you entered that yourself. Either way, the username and password on the 2 servers will not be the same (unless you set up your local installation so that the username and password are the same as you have for the hosted server).For your local machine, it looks like the problem is that the username and password are not correct. For your hosted server, it looks like the server name is not correct. From the error it looks like you're trying to use "zcohosting" as the server name, and it can't find that server. Try these for the server name on your hosted server and see if any of them work:localhost127.0.0.1localhost:/tmp/mysql.sockIf you want to look at the manual for mysql_connect, it's here:http://www.php.net/manual/en/function.mysql-connect.phpYou can see from that that the first 3 parameters are the server name, username, and password. The fourth and fifth parameters are rarely used. There are a couple examples on that page showing various ways to connect. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 I´ve uploaded the changed files, but they will work AFTER the host has refreshed his server? (because now it doesn´t!)You don't really need to "refresh" a server, they should work immediately. Your browser might have files cached, but you can always empty the browser cache to make sure you're getting the current files. Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 First, to clarify, the settings on your local machine running MAMP, and the settings on your hosted server are not the same. The username and password for your local MAMP copy of MySQL are probably the default settings unless you changed them. The username and password on your hosted account are definitely not the default settings, either your host would have set you up with a username and password, or you entered that yourself. Either way, the username and password on the 2 servers will not be the same (unless you set up your local installation so that the username and password are the same as you have for the hosted server).For your local machine, it looks like the problem is that the username and password are not correct. For your hosted server, it looks like the server name is not correct. From the error it looks like you're trying to use "zcohosting" as the server name, and it can't find that server. Try these for the server name on your hosted server and see if any of them work:localhost127.0.0.1localhost:/tmp/mysql.sockIf you want to look at the manual for mysql_connect, it's here:http://www.php.net/manual/en/function.mysql-connect.phpYou can see from that that the first 3 parameters are the server name, username, and password. The fourth and fifth parameters are rarely used. There are a couple examples on that page showing various ways to connect.Thanks very much for your explanations! I´ll study them later today! Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 First, to clarify, the settings on your local machine running MAMP, and the settings on your hosted server are not the same. The username and password for your local MAMP copy of MySQL are probably the default settings unless you changed them. The username and password on your hosted account are definitely not the default settings, either your host would have set you up with a username and password, or you entered that yourself. Either way, the username and password on the 2 servers will not be the same (unless you set up your local installation so that the username and password are the same as you have for the hosted server).For your local machine, it looks like the problem is that the username and password are not correct. For your hosted server, it looks like the server name is not correct. From the error it looks like you're trying to use "zcohosting" as the server name, and it can't find that server. Try these for the server name on your hosted server and see if any of them work:localhost127.0.0.1localhost:/tmp/mysql.sockIf you want to look at the manual for mysql_connect, it's here:http://www.php.net/manual/en/function.mysql-connect.phpYou can see from that that the first 3 parameters are the server name, username, and password. The fourth and fifth parameters are rarely used. There are a couple examples on that page showing various ways to connect.I don´t get it!The configuration I only can do in MAMP PRO which was a demo (expired!)I´m now going to try the values above! Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 I moved my website folder from the htldocs folder (MAMP) to my desktop, but I still get the settings of MAMP? Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 First, to clarify, the settings on your local machine running MAMP, and the settings on your hosted server are not the same. The username and password for your local MAMP copy of MySQL are probably the default settings unless you changed them. The username and password on your hosted account are definitely not the default settings, either your host would have set you up with a username and password, or you entered that yourself. Either way, the username and password on the 2 servers will not be the same (unless you set up your local installation so that the username and password are the same as you have for the hosted server).For your local machine, it looks like the problem is that the username and password are not correct. For your hosted server, it looks like the server name is not correct. From the error it looks like you're trying to use "zcohosting" as the server name, and it can't find that server. Try these for the server name on your hosted server and see if any of them work:localhost127.0.0.1localhost:/tmp/mysql.sockIf you want to look at the manual for mysql_connect, it's here:http://www.php.net/manual/en/function.mysql-connect.phpYou can see from that that the first 3 parameters are the server name, username, and password. The fourth and fifth parameters are rarely used. There are a couple examples on that page showing various ways to connect.The 3 values above don´t work! I still get the same error (´zcohosting´), although I changed that this morning into ´localhost´! Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 I moved my website folder from the htldocs folder (MAMP) to my desktop, but I still get the settings of MAMP?Why did you move your web files outside of the web server root? You realize you can't access them there from a web browser, right?The 3 values above don´t work! I still get the same error (´zcohosting´), although I changed that this morning into ´localhost´!Are you sure you're editing the correct files, and uploading them to the server after you save them? Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 Why did you move your web files outside of the web server root? You realize you can't access them there from a web browser, right?Are you sure you're editing the correct files, and uploading them to the server after you save them?Reply 1: I´m fed up of these conflicts of my local as my host server (as I wrote above I can´t change the settings in MAMP. No, I didn´t realize that I can´t access them from my web browser But another topic of me if there´s another web browser for Mac (10.4)?Reply 2: My correct (php) files aren´t the ones in the folder of my website? And now I upload the folder! Do I have to upload only the changed files? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 Upload any files that are missing or different from what's online. The point is to make what's online match what you have locally. Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 My website looks horrible! First, when i write my domain name I see the index of a MAMP folder! So, the first thing I want is directly my home page! Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 I don't understand your question. Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 WHY hasn´t said somebody e. g. when I started learning MySQL that the settings of my local host MUST be the same as the ones of the host server? It would have saved me a lot of time (until now 6 days!) and stress! Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 WHY hasn´t said somebody e. g. when I started learning MySQL that the settings of my local host MUST be the same as the ones of the host server?Because they don't have to be. The settings on your local machine need to match the settings on your local machine, and the settings on your host need to match the settings on your host. That's it. If you want to set up the same username and password that you use on your host on your local machine also, that's an option, but I've never done that. I just have commented-out code where I enable either the "test server" code or the "live server" code. That's a lot easier than trying to keep a bunch of MySQL accounts synced up.I'm not sure whose fault it is that you're having problems learning this, but I'm pretty sure it's not our fault. There is no connection between your local test server and any online server other than what you set up yourself. They are two completely different servers, with possibly completely different options. My test server and live server don't even run the same operating systems. This isn't Ender's Game, where you split a subatomic particle and put half of it on each server and magically have an instantaneous link between the two. Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 Because they don't have to be. The settings on your local machine need to match the settings on your local machine, and the settings on your host need to match the settings on your host. That's it. If you want to set up the same username and password that you use on your host on your local machine also, that's an option, but I've never done that. I just have commented-out code where I enable either the "test server" code or the "live server" code. That's a lot easier than trying to keep a bunch of MySQL accounts synced up.I'm not sure whose fault it is that you're having problems learning this, but I'm pretty sure it's not our fault. There is no connection between your local test server and any online server other than what you set up yourself. They are two completely different servers, with possibly completely different options. My test server and live server don't even run the same operating systems. This isn't Ender's Game, where you split a subatomic particle and put half of it on each server and magically have an instantaneous link between the two.But thescientist wrote me that he always uses the same user name and password on both servers, so he hasn´t this problem! You don´t have to (no that´s true; you only have to breath, to drink, to eat, to ######, etc.) But, wouldn´t it much easier for a beginning student? I´m not talking about faults, but it is very difficult for you to write ´sorry, we´ve forgotten it! 1 person did, however 2 days ago!P. s. At least I have my home page back! Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 But, wouldn´t it much easier for a beginning student?Not necessarily. Most of the time people who are learning are only working on one server. Regardless, if you're moving your code to a different server, you should be able to realize that you need to change the settings to work with that other server. You should realize that if you understand that the server name, username, and password that you are using is to connect with your server. If you understand that, then it should be obvious that if you're moving servers, the settings to connect to the new server might change. A lot of this stuff is common sense, we can't be expected to completely hold your hand through your entire career. You are going to need to figure most things out yourself. Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 IF YOU UNDERSTAND ........, but at least you could had guessed that I didn´t!So, I finally rearranged my website, but still have the same problem: the data of my html form doesn´t go to a database!How can I solve that regarding the previous posts? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 but at least you could had guessed that I didn´t!Yes, it is blatantly obvious that you are not understanding this stuff. That's most of the problem. Compared to other people, it seems like it takes you much more effort to understand programming concepts.So, I finally rearranged my website, but still have the same problem: the data of my html form doesn´t go to a database!How can I solve that regarding the previous posts?Post the code you're using now and any error messages you're getting from PHP. Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 Yes, it is blatantly obvious that you are not understanding this stuff. That's most of the problem. Compared to other people, it seems like it takes you much more effort to understand programming concepts.Post the code you're using now and any error messages you're getting from PHP.Isn´the solution creating another database and another script insert.php and upload them to the host server (with his user name and password!)? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 11, 2011 Share Posted April 11, 2011 You can either create a new script or fix the existing one. Link to comment Share on other sites More sharing options...
eduard Posted April 11, 2011 Author Share Posted April 11, 2011 You can either create a new script or fix the existing one.I´ve been trying enough to fix!I´m going to make a new one! Link to comment Share on other sites More sharing options...
eduard Posted April 12, 2011 Author Share Posted April 12, 2011 Ok this (1) thread!I´ve been in the cpanel. What are alphanumeric caracters? Link to comment Share on other sites More sharing options...
eduard Posted April 12, 2011 Author Share Posted April 12, 2011 I created a new database in the cpanel, but still this error:array(3) { ["description"]=> string(1) "x" ["price"]=> string(1) "1" ["quantity"]=> string(1) "2" } succesful form submission. initialize DB connection .....Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'eduardli_company' (1) in /home/eduardli/public_html/web_designer/insert.php on line 10Could not connect: Unknown MySQL server host 'eduardli_company' (1)I don´t understand it, because also in this file I changed the data into: "eduardli_company","eduardli","*****" Link to comment Share on other sites More sharing options...
eduard Posted April 12, 2011 Author Share Posted April 12, 2011 What does this mean?H Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.