Fenhopi Posted May 17, 2010 Share Posted May 17, 2010 Hi, this code worked on my local database, but not when I uploaded it to 000webhost. The tables I have set up there is exactly the same as the ones I have on my local server. Here's the code: <? include("include/session.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Opheim Online - Blog</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="styles.css" rel="stylesheet" type="text/css" /> </head> <body> <!-- start header --> <div id="contmain"> <div id="main"> <div id="header"> <div id="logo"> <h1><a href="#"></a></h1> <h2><a href="" id="metamorph"></a></h2> </div> <div id="menu"> <? if($session->logged_in){ ?> <ul> <li><a href="index.php">Home</a></li> <li><a href="blog.php">Blogs</a></li> <li><a href="aboutme.php">About me</a></li> <li><? echo "[<a href=\"userinfo.php?user=$session->username\">My Account</a>]"; ?></li> <li><? echo "[<a href=\"useredit.php\">Edit Account</a>]"; ?></li> <li><? echo "[<a href=\"viewmembers.php\">View Members</a>] "; ?></li> </ul> <? } else{ ?> <ul> <li><a href="index.php">Home</a></li> </ul> <? } ?> </div> <!-- end header --> </div> <!-- start page --> <div id="page"> <!-- start content --> <div id="content"> <div class="box2"> <? if($session->logged_in){ /* Requested Username error checking */ $req_user = trim($_GET['myfriend']); if(!$req_user || strlen($req_user) == 0 || !eregi("^([0-9a-z])+$", $req_user) || !$database->usernameTaken($req_user)){ die("Username not registered"); } $req_user_info = $database->getUserInfo($req_user); $id = $_GET['myfriend']; $username = $_SESSION['username']; $sql2 = "SELECT * FROM friends2 WHERE user1='$username'"; $query2 = mysql_query($sql2); $check2 = mysql_num_rows($query2); // if you want the limit to be 50, you put 49 after < (the number minus 1) $sql = "INSERT INTO friends2 (rid, user1, user2, status) VALUES('', '$username', '$id', '0')"; mysql_query($sql); echo "Friend added"; } ?> </div></div> <!-- end content --> <!-- start sidebar two --> </div><!-- end sidebar two --> <div id="bottom" style="clear: both;"></div> </div><!-- end page --> <!-- start footer --> <div id="footer"> <p>Copyright © 2010, Opheim Online </p> </div> </div> </div> <!-- end footer --> </html> Please point it out to me if there's something you can tell is obviously wrong. Thank you! Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/ Share on other sites More sharing options...
tomfmason Posted May 17, 2010 Share Posted May 17, 2010 what errors are you getting? Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059341 Share on other sites More sharing options...
Fenhopi Posted May 17, 2010 Author Share Posted May 17, 2010 None, I just get redirected to 000webhost´s default error page, which is the annoying part. Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059343 Share on other sites More sharing options...
Andy-H Posted May 17, 2010 Share Posted May 17, 2010 Have you only just setup the account, I think that 000webhost has to check and confirm your site isn't using any copyrighted material and complys to the terms of service before they activate your account, which they do manually... Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059344 Share on other sites More sharing options...
Fenhopi Posted May 17, 2010 Author Share Posted May 17, 2010 Well, no. It's been running with everything other than the friendship system i just added for a week. So I doubt that's it.. Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059346 Share on other sites More sharing options...
chrismarsden Posted May 17, 2010 Share Posted May 17, 2010 could it be that their server requires full php tags? Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059401 Share on other sites More sharing options...
scvinodkumar Posted May 17, 2010 Share Posted May 17, 2010 change <? to <?php and try Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059424 Share on other sites More sharing options...
chrismarsden Posted May 17, 2010 Share Posted May 17, 2010 hahaha thats what i said! Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059433 Share on other sites More sharing options...
Fenhopi Posted May 18, 2010 Author Share Posted May 18, 2010 No, it's not that it requires full php tags. Tested it. Good suggestion though. I'm really open for more suggestions. Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059822 Share on other sites More sharing options...
Andy-H Posted May 18, 2010 Share Posted May 18, 2010 If your using a database, I think that 000webhost uses something otherthan localhost for mysql connection? try adding: error_reporting(E_ALL); ini_set('display_errors', 'on'); To the top of your script. Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059954 Share on other sites More sharing options...
c_cicca Posted May 18, 2010 Share Posted May 18, 2010 You must display the errors, there are many issues that could happen, example: you use function "eregi" this function is not compatible with the new php versions. Link to comment https://forums.phpfreaks.com/topic/202008-this-short-code-works-on-my-local-database-but-not-on-host%C2%B4s-why/#findComment-1059964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.