redgunner Posted November 16, 2010 Share Posted November 16, 2010 Hi, I am using wamp server with phpmyadmin and my entries get added no problem using localhost method.. I move to my server online and it doesn't add an entry? $username="monstert_admin"; $password="admin"; $database="monstert_admin"; $connection = mysql_connect("localhost", $username, $password) or die("Connection Failure to Database"); // Select Database mysql_select_db($database, $connection) or die ($database . "No Database" . $username); //Select everything from the the table $MyQuery = "SELECT * FROM photos"; $retrieve = mysql_query($MyQuery) or die(mysql_error()); if(mysql_num_rows($retrieve) != 0): $row = mysql_fetch_assoc($retrieve); else: echo ''; endif; if(isset($_POST['Submit']) && !$errors) { $url = $newname; include('img.php'); $image = new SimpleImage(); $image->load($url); $image->resize(500,315); $image->save($newname); mysql_query("INSERT INTO photos (url) VALUES ('$url')"); mysql_query("INSERT INTO photos (id, url) VALUES ('1', 'images/xx.jpg'"); echo "File Uploaded Successfully as <i> "; echo $newname; echo "</i>"; } Quote Link to comment https://forums.phpfreaks.com/topic/218877-localhost-does-what-i-want-but-my-webhost/ Share on other sites More sharing options...
Pikachu2000 Posted November 16, 2010 Share Posted November 16, 2010 Most often, a hosted account will use use an IP address, or actual hostname (sqlsrv_04.somedomain.com) rather than 'localhost' for the MySQL server's hostname. Check your hosting company's FAQs to see if that may be the case. Quote Link to comment https://forums.phpfreaks.com/topic/218877-localhost-does-what-i-want-but-my-webhost/#findComment-1135139 Share on other sites More sharing options...
grissom Posted November 16, 2010 Share Posted November 16, 2010 I know this sounds obvious, but it's easy to make a mistake (as the hedgehog said getting off the toilet brush) - just check that when you set up the database on the server, you typed in the user name and password correctly and didn't inadvertently put in any typos. In those password boxes where the characters come up as asterisks, its easy to put a typo in and not realise. Also check that the server has not "helpfully" appended any suffixes automatically to the username (one of mine does !). Sorry if this sounds obvious, but I've done it myself .... Quote Link to comment https://forums.phpfreaks.com/topic/218877-localhost-does-what-i-want-but-my-webhost/#findComment-1135199 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.