i3lack Posted July 12, 2008 Share Posted July 12, 2008 I have my own site, and all files worked on the free host but i upgraded to paid so now i get errors can someone please help me!!! Warning: Division by zero in /home/grandma/public_html/index.php on line 4 Warning: mysql_query() [function.mysql-query]: Access denied for user 'grandma'@'localhost' (using password: NO) in /home/grandma/public_html/index.php on line 16 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/grandma/public_html/index.php on line 16 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/grandma/public_html/index.php on line 19 Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/grandma/public_html/index.php on line 20 Any HELP PLEASE PLEASE, i have had so called expert scripters tell me the cant help =( i really need this to work. Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/ Share on other sites More sharing options...
xtopolis Posted July 12, 2008 Share Posted July 12, 2008 You are dividing by zero on line 4 of index.php Your mysql access seems to be wrong now, meaning the username/pass/etc you coded are no longer valid. I see grandma@localhost which I think means you had it hosted on a machine of your own? Post some code, but that math error, and the access error are the main ones. The other mysqls might clear up if you fix the first one regarding your access. Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588161 Share on other sites More sharing options...
.josh Posted July 12, 2008 Share Posted July 12, 2008 Yeah I get the feeling they told you they couldn't help because you aren't showing any kind of code or explaining anything about the code. Your first warning is obvious: you're script is trying to divide something by zero. Why is it doing that? I wouldn't know, because you didn't provide any code. Your other errors are most likely related to each other. Your 2nd error means that you provided 1 or more wrong of the following: host, username, or password (for your database). Since you provided wrong info, the 3rd error probably happened. And since you have no connection, your 4th and 5th error is due to not having a result returned. Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588162 Share on other sites More sharing options...
i3lack Posted July 12, 2008 Author Share Posted July 12, 2008 ok then... here is one of the 6 problems! the top file is the bottom files part thats error i get from bottom file Warning: include_once(include/db_connect.php) [function.include-once]: failed to open stream: No such file or directory in /home/grandma/public_html/register.php on line 3 Warning: include_once() [function.include]: Failed opening 'include/db_connect.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/grandma/public_html/register.php on line 3 <?php session_start(); include_once "include/db_connect.php"; if (isset($_SESSION['username'])){ header("Location: mb.php"); exit(); } $from_user=strip_tags($_POST['ref']); if ($_POST['Submit']){ // Define post fields into simple variables $reg_username = $_POST['reg_username']; $email = $_POST['email']; $email1 = $_POST['email1']; $location=strip_tags($_POST['location']); $reg_username=trim($reg_username); $today = gmdate('Y-m-d h:i:s'); $reg_username = stripslashes($reg_username); $email = stripslashes($email); $quote = stripslashes($quote); $reg_username = strip_tags($reg_username); $email = strip_tags($email); Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588164 Share on other sites More sharing options...
PFMaBiSmAd Posted July 12, 2008 Share Posted July 12, 2008 Fricken cross-posted thread also -http://www.phpfreaks.com/forums/index.php/topic,206347.0.html Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588174 Share on other sites More sharing options...
i3lack Posted July 12, 2008 Author Share Posted July 12, 2008 so the other one is dealing with anohter problem tho! :-\ Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588177 Share on other sites More sharing options...
xtopolis Posted July 12, 2008 Share Posted July 12, 2008 i3lack, tell us this. Was the site hosted on a computer that you own, in your house or w/e? And now you've paid for your website to be hosted on someone else's server, like godaddy, 1and1, etc? You scripts all have the same problem, so there is no need to spread out the questions. You have moved the files from somewhere where they no longer appear in the same way. Firstly, the mysql error we cannot help you with. It's telling you the information you supplied is wrong. I'm guessing it's the 'localhost' pointer. You need to fix that on your own. The rest is simply saying "I can't find this file"[failed to open steam]. It's telling you where it's looking for it, so find it and/or put it there. YOU NEED TO READ YOUR OWN ERROR MESSAGES BEFORE POSTING ANY MORE QUESTIONS, IMO Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588180 Share on other sites More sharing options...
chronister Posted July 12, 2008 Share Posted July 12, 2008 It looks like they are the same issue to me.... the include files will work best like this.... <?php include_once($_SERVER['DOCUMENT_ROOT'].'/include/db_connect.php'); ?> Try that and ensure that your DB credentials are correct. Between the 2 your errors will probably clear up. Nate Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588181 Share on other sites More sharing options...
i3lack Posted July 12, 2008 Author Share Posted July 12, 2008 i am on a hosted plan they have always been hosted from someone elses server...hosting24, hostmonster, ect.. what info do you need??? Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588182 Share on other sites More sharing options...
chronister Posted July 12, 2008 Share Posted July 12, 2008 Have you tried the things that have been suggested?? I kinda agree with xtopolis..... Your error messages are telling you what is wrong. Don't divide by 0, get the right mysql credentials in the script.... fix your include path as it is wrong. Try the things that have been suggested and if they don't work post the new error messages.... but we have given you things to try based upon what your telling us.... so let us know if those work or not. Nate Quote Link to comment https://forums.phpfreaks.com/topic/114379-php-mysql-help/#findComment-588192 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.