timmah1 Posted December 11, 2007 Share Posted December 11, 2007 I am hosting at dreamhost, I just recently switched from gatorhost. This code worked fine at gatorhost, but it don't do anything at dreamhost. Can you see something wrong? <table width="500" border="0" cellpadding="0" cellspacing="0" class="text"> <tr> <td rowspan="2" valign="top"><?php include "DB_config.php"; if ($update =="yes") { $query="update about set content='$_POST[content]' where id = '$id'"; $result2 = MYSQL_QUERY($query); echo "About Us page has been updated"; } else { $user = "SELECT * FROM about"; $result = mysql_query($user); $numberall = mysql_Numrows($result); while($row = mysql_fetch_array( $result )){ ?> <h3>About Us Page</h3> <br /> <form action="" method="post" name="about" id="about"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td><textarea name="content" cols="80" rows="25" id="main"><? echo "$row[content]"; ?></textarea></td> </tr> <tr> <td><input type="hidden" name="update" value="yes" /> <input type="submit" name="update" value="Update" /></td> </tr> </table> </form> <? } } ?> </td> </tr> </table> Thank you in advance Quote Link to comment Share on other sites More sharing options...
tapos Posted December 11, 2007 Share Posted December 11, 2007 <table width="500" border="0" cellpadding="0" cellspacing="0" class="text"> <tr> <td rowspan="2" valign="top"><?php include "DB_config.php"; if ($update =="yes") { $query="update about set content='$_POST[content]' where id = '$id'"; $result2 = mysql_query($query); echo "About Us page has been updated"; } else { $user = "SELECT * FROM about"; $result = mysql_query($user); $numberall = mysql_numrows($result); while($row = mysql_fetch_array( $result )){ ?> <h3>About Us Page</h3> <br /> <form action="" method="post" name="about" id="about"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td><textarea name="content" cols="80" rows="25" id="main"><? echo "$row[content]"; ?></textarea></td> </tr> <tr> <td><input type="hidden" name="update" value="yes" /> <input type="submit" name="update" value="Update" /></td> </tr> </table> </form> <? } } ?> </td> </tr> </table> try the above or u have found no content in the page?? if the second one then please check the database configuration correctly. Thanks -- Tapos Pal Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted December 11, 2007 Share Posted December 11, 2007 MYSQL_QUERY and mysql_Numrows, aren't they case sensitive ??? Quote Link to comment Share on other sites More sharing options...
rab Posted December 11, 2007 Share Posted December 11, 2007 Try using <?php instead of <?. Some hosts have short_tag off. Also the mysql functions should be all lowercase. Quote Link to comment Share on other sites More sharing options...
timmah1 Posted December 11, 2007 Author Share Posted December 11, 2007 All it does is refresh the page, it doesn't update the database You can see it here http://www.wahpconnection.com/admin/?cid=about Quote Link to comment Share on other sites More sharing options...
timmah1 Posted December 11, 2007 Author Share Posted December 11, 2007 Just tried the <?php, and still the same thing, just refreshes Quote Link to comment Share on other sites More sharing options...
tibberous Posted December 11, 2007 Share Posted December 11, 2007 Might be register globals. Make sure dreamhost has them turned on. Quote Link to comment Share on other sites More sharing options...
timmah1 Posted December 11, 2007 Author Share Posted December 11, 2007 Can't I just put a php.ini file in the folder I'm using to turn them on? right now they are turned off Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2007 Share Posted December 11, 2007 Also the mysql functions should be all lowercase. Built in functions are case insensitive. Might be register globals. Make sure dreamhost has them turned on. Do not encourage the use of register_globals, it is being made extinct for a reason. Change this line... if ($update =="yes") to... if ($_POST['update'] =="yes") And see how that goes. Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2007 Share Posted December 11, 2007 Can't I just put a php.ini file in the folder I'm using to turn them on? right now they are turned off Not usually and that is a terrible idea anyway, fix your code! (You've anly had about 3 years to do it!) Quote Link to comment Share on other sites More sharing options...
tibberous Posted December 11, 2007 Share Posted December 11, 2007 They might cause a performance hit, but so long as you initialize variables before you use them, there isn't anything wrong with register globals. Biggest reason not to use them is the fact that there off by default =( Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2007 Share Posted December 11, 2007 The biggest two reasons to not use register globals are - 1) They have been completely eliminated in php6. If you want your code to work when php6 is released, you WILL need to eliminate all dependences on register globals. 2) They were a huge blunder and in one case allows external data (POST/GET) to put values into program variables that normally come from session data. (Allowing you to do things like appear to be logged in or appear to be administrators in publicly released scripts where program variable names are known that get set through register globals from session data.) Register globals were turned off by default in php4.2 in the year 2002. No new code, books, tutorials... should have been written after that point in time that rely on register globals, and no one should be suggesting in 2007/2008 that turning them on is a solution. It is only a short term work around while you fix your code. The solution is to correct any code that is dependent on register globals being on. Quote Link to comment Share on other sites More sharing options...
tmaunga Posted December 11, 2007 Share Posted December 11, 2007 <?php session_start(); //$sess_id = session_id(); $username = $_SESSION['name']; if(empty($username)){ header("location:index.php");} $username = $_SESSION['username']; $querystring = strstr($_SERVER['QUERY_STRING'], '&'); // Updating routines $database = $_SESSION['database']; $includepath = $_SESSION['includepath']; $remotepath = $_SESSION['remotepath']; $querystring = strstr($_SERVER['QUERY_STRING'], '&'); if (isset($_POST["id"]) && $_POST["Submit"] == "Update") { $docid1 = $_POST['id']; $doctitle = $_POST['need_name']; echo $docid1; echo $doctitle; $updateSQL = "UPDATE cust_needs SET need_name = '$doctitle' WHERE id = $docid1"; //print $updateSQL; //die; $result = mysql_query($updateSQL) or die(mysql_error()); header("Location: list_custneeds2.php?"); } if (! empty($_GET["id"])) { $docid = $_GET['id']; $conn = mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD); //mysql_select_db(DB_NAME, $conn); //dbconnect($database); $selectSQL = "SELECT * FROM cust_needs WHERE id = $docid"; $result = mysql_query($selectSQL,$conn) or die(mysql_error()); $row = mysql_fetch_array($result); } ?> <html> <head> <title>Edit record</title> <link href="Styles/admin.css" rel="stylesheet" type="text/css" /> </head> <script language="javascript"> function redirect(){ window.location = "archives.php?id=<?php print $_REQUEST[id];?>" } </script> <body> <?php include('_includes/top.inc'); ?> <table border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF"> <form action="docedit15.php" method="POST" name="formadd"> <tr> <td style="border: 1px solid #AAAAAA"><table border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td align="right" nowrap bgcolor="#DDDDDD">needid:</td> <td colspan="3" bgcolor="#DDDDDD"><input name="DocTitle" type="text" id="DocTitle" size="64" value="<?php echo $row['id']; ?>"/></td> </tr> <tr> <td align="right" nowrap bgcolor="#EFEFEF">needname:</td> <td colspan="3" bgcolor="#EFEFEF"><input name="SubTitle" type="text" id="SubTitle" size="64" value="<?php echo $row['need_name']; ?>"/></td> </tr> <tr> <td bgcolor="#2D4A81" class="text10"><input type="button" value="« Back" title="Back to index page" onClick="javascript:history.go(-1)"></td> <td colspan="2" bgcolor="#2D4A81" class="text10"><input type="submit" name="Submit" value="Update" /></td> <td align="right" bgcolor="#2D4A81" class="text10"><input type="submit" name="Submit2" value="Delete" style="color:#FF0000" /></td> </tr> </table></td> </tr> <input type="hidden" name="id" value="<?php echo $docid; ?>"> <input type="hidden" name="querystring" value="<?php echo $querystring; ?>"> </form> </table> </body> </html> Quote Link to comment 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.