Msword Posted August 8, 2007 Share Posted August 8, 2007 <?php require("dbconnect.php"); mysql_select_db("runecrypt", $sql); if (isset($_GET['pid']) == 0) { print '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title></title> </head> <body> <form method="get" name="edit"> <table style="text-align: left; margin-left: auto; margin-right: auto; width: 325px; height: 61px;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="text-align: center;">Person to edit PID</td> <td><input name="pid"></td> </tr> </tbody> </table> <div style="text-align: center;"><input value="Submit" type="submit"><br> </div> </form> <form method="get" action=" " name="edit"></form> </body> </html>'; } if (isset($_POST['name'])) { echo "124142"; echo "god damn not sposed to be here"; $name = $_POST["name"]; $pictureurl = $_POST["pictureurl"]; $exinfo = $_POST["exinfo"]; $dsc = $_POST["dsc"]; $location = $_POST["location"]; $quest = $_POST["quest"]; $membonly = $_POST["membonly"]; $contributors = $_POST["contributors"]; $date = date("F j, Y, g:i a"); mysql_query("UPDATE pdatabase SET name='$name', pictureurl='$pictureurl', exinfo='$exinfo', dsc='$dsc', location='$location', quest='$quest', membonly='$membonly', contributors='$contributors', lastupdate='$date' WHERE pid=$pid"); } if (isset($_GET['pid'])) { echo "1312"; $pid = mysql_real_escape_string($_GET["pid"]); $result = mysql_query("SELECT * FROM pdatabase WHERE pid='$pid'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo '<html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>Add Person to Database</title> </head> <body> <div style="text-align: center;"> <h2><span style=\"color: rgb(255, 0, 0);\"><a href="editperson.php">Refresh Page</a></span></h2> <form method="post" action="editperson.php" name="edititem">Edit Person in Database<br> <table style="text-align: left; margin-left: auto; margin-right: auto; height: 374px; width: 661px;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="width: 140px; text-align: center;">Name</td> <td style="width: 415px; text-align: center;"><input value="' . $row['name'] . '" input maxlength="40" size="40" name="name"></td> </tr> <tr> <td style="width: 140px; text-align: center;">Picture Name</td> <td style="width: 415px; text-align: center;"><input value="' . $row['pictureurl'] . 'input maxlength="255" size="40" name="pictureurl"><span style="text-decoration: underline;"><br> </span><span style="font-family: monospace;">full link please(http://draftx.net/test/pictures/nopic.png)<br> nopic.png if none</span></td> </tr> <tr> <td style="width: 140px; text-align: center;">Examine Info</td> <td style="width: 415px; text-align: center;"><input value="' . $row['examine'] . 'textarea cols="40" rows="5" name="exinfo"></textarea><br> What it says when you examine the person</td> </tr> <tr> <td style="width: 140px; text-align: center;">Description</td> <td style="width: 415px; text-align: center;"><input value="' . $row['desc'] . 'textarea cols="40" rows="5" name="dsc"></textarea><br> About the person, any extra information</td> </tr> <tr> <td style="width: 140px; text-align: center;">Location</td> <td style="width: 415px; text-align: center;"><input value="' . $row['location'] . 'input maxlength="50" size="40" name="location"><br> <pre><a href="AreaURL">AreaName</a></pre> </td> </tr> <tr> <td style="width: 140px; text-align: center;">Quests</td> <td style="width: 415px; text-align: center;"><input value="' . $row['quest'] . 'textarea cols="40" rows="5" name="quest"></textarea><br> <pre><a href="QuestURL">QuestName</a><br>Put <br> after every line<br>None if person is involved in no quests</pre> </td> </tr> <tr> <td style="width: 140px; text-align: center;">Members Only</td> <td style="width: 415px; text-align: center;"><input value="' . $row['membonly'] . 'input maxlength="5" size="5" name="membonly"><br> Yes/No</td> </tr> <tr> <td style="text-align: center;">Contributors</td> <td style="text-align: center;"><input value="' . $row['contributors'] . 'textarea cols="40" rows="5" name="contributors"></textarea><br> <pre><a href="ContibutorForumURL">ContributorName</a></pre> </td> </tr> </tbody> </table> <input value="Submit" type="submit"></form> </div> </body> </html>'; } } ?> I think the problem is the logic, 1312 and 124142(these are just for testing) get displayed, but it doesn't go to the last page like its sposed to. Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/ Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 what is this if (isset($_GET['pid']) == 0) { it shoud be f ($_GET['pid'] == 0) { this means f (True or false == 0) { because this is bool isset($_GET['pid']) Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318112 Share on other sites More sharing options...
Msword Posted August 8, 2007 Author Share Posted August 8, 2007 No, i'm checking to see if the variable is set, so i know what i need to do. Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318113 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 No, i'm checking to see if the variable is set, so i know what i need to do. maybe but i said it on the first post i have doing that is wrong var_dump(isset($_GET['pid']); this = false if (isset($_GET['pid']) == 0) { this is the same as ! isset($_GET['pid']) or not isset now is that what you want Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318121 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 i dont know if im helping you but you need to restructure your code look $result = mysql_query("SELECT * FROM pdatabase WHERE pid='$pid'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo '<html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>Add Person to Database</title> </head> what do you mean with the while loop loop the html page for several time or maybe no because you only use ID for the condition Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318124 Share on other sites More sharing options...
Msword Posted August 8, 2007 Author Share Posted August 8, 2007 i don't understand what your saying... sorry anyways, that part of the code is showing up when it needs 2 Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318126 Share on other sites More sharing options...
trq Posted August 8, 2007 Share Posted August 8, 2007 i don't understand what your saying... sorry Neither do we understand you. What exactly (and in detail) is your question/problem? Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318129 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 that is part of your code and u are attempting to use WHILE LOOOP please see the code i post on your code are trying to loop the declaration of new html?? i guess change all my comment first then post the new code where we can start looking Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318130 Share on other sites More sharing options...
Msword Posted August 8, 2007 Author Share Posted August 8, 2007 wth the damn edit button disappeared.... $name = $_POST["name"]; $pictureurl = $_POST["pictureurl"]; $exinfo = $_POST["exinfo"]; $dsc = $_POST["dsc"]; $location = $_POST["location"]; $quest = $_POST["quest"]; $membonly = $_POST["membonly"]; $contributors = $_POST["contributors"]; $date = date("F j, Y, g:i a"); mysql_query("UPDATE pdatabase SET name='$name', pictureurl='$pictureurl', exinfo='$exinfo', dsc='$dsc', location='$location', quest='$quest', membonly='$membonly', contributors='$contributors', lastupdate='$date' WHERE pid=$pid"); } if (isset($_GET['pid'])) { echo "1312"; $pid = mysql_real_escape_string($_GET["pid"]); $result = mysql_query("SELECT * FROM pdatabase WHERE pid='$pid'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo '<html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>Add Person to Database</title> </head> <body> <div style="text-align: center;"> <h2><span style=\"color: rgb(255, 0, 0);\"><a href="editperson.php">Refresh Page</a></span></h2> <form method="post" action="editperson.php" name="edititem">Edit Person in Database<br> <table style="text-align: left; margin-left: auto; margin-right: auto; height: 374px; width: 661px;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="width: 140px; text-align: center;">Name</td> <td style="width: 415px; text-align: center;"><input value="' . $row['name'] . '" input maxlength="40" size="40" name="name"></td> </tr> <tr> <td style="width: 140px; text-align: center;">Picture Name</td> <td style="width: 415px; text-align: center;"><input value="' . $row['pictureurl'] . '" input maxlength="255" size="40" name="pictureurl"><span style="text-decoration: underline;"><br> </span><span style="font-family: monospace;">full link please(http://draftx.net/test/pictures/nopic.png)<br> nopic.png if none</span></td> </tr> <tr> <td style="width: 140px; text-align: center;">Examine Info</td> <td style="width: 415px; text-align: center;"><input value="' . $row['examine'] . '" textarea cols="40" rows="5" name="exinfo"></textarea><br> What it says when you examine the person</td> </tr> <tr> <td style="width: 140px; text-align: center;">Description</td> <td style="width: 415px; text-align: center;"><input value="' . $row['desc'] . '" textarea cols="40" rows="5" name="dsc"></textarea><br> About the person, any extra information</td> </tr> <tr> <td style="width: 140px; text-align: center;">Location</td> <td style="width: 415px; text-align: center;"><input value="' . $row['location'] . '" input maxlength="50" size="40" name="location"><br> <pre><a href="AreaURL">AreaName</a></pre> </td> </tr> <tr> <td style="width: 140px; text-align: center;">Quests</td> <td style="width: 415px; text-align: center;"><input value="' . $row['quest'] . '" textarea cols="40" rows="5" name="quest"></textarea><br> <pre><a href="QuestURL">QuestName</a><br>Put <br> after every line<br>None if person is involved in no quests</pre> </td> </tr> <tr> <td style="width: 140px; text-align: center;">Members Only</td> <td style="width: 415px; text-align: center;"><input value="' . $row['membonly'] . '" input maxlength="5" size="5" name="membonly"><br> Yes/No</td> </tr> <tr> <td style="text-align: center;">Contributors</td> <td style="text-align: center;"><input value="' . $row['contributors'] . '" textarea cols="40" rows="5" name="contributors"></textarea><br> <pre><a href="ContibutorForumURL">ContributorName</a></pre> </td> </tr> </tbody> </table> <input value="Submit" type="submit"></form> </div> </body> </html>'; i have narrowed it down to something being wrong with this, its getting executed, but not doing what it's sposed to. Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318134 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 if (isset($_GET['pid'])) { echo "1312"; $pid = mysql_real_escape_string($_GET["pid"]); $result = mysql_query("SELECT * FROM pdatabase WHERE pid='$pid'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { the error may be in the if or while echo you get variable to see if you get your expected data then print_r($row); to see if the result is not 0 zeroooo and again this is wrong with the logic you have in the script while($row = mysql_fetch_array($result)) { Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318138 Share on other sites More sharing options...
Msword Posted August 8, 2007 Author Share Posted August 8, 2007 I think its the update, would this show an error if there was one? mysql_query("UPDATE pdatabase SET name='$name', pictureurl='$pictureurl', exinfo='$exinfo', dsc='$dsc', location='$location', quest='$quest', membonly='$membonly', contributors='$contributors', lastupdate='$lastupdate' WHERE pid=$pid") or die(mysql_error()); it just says 'Mysql error' Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318152 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 dude you have allot of bug or structuring prob look if (isset($_POST['name'])) { echo "124142"; echo "god damn not sposed to be here"; $name = $_POST["name"]; $pictureurl = $_POST["pictureurl"]; $exinfo = $_POST["exinfo"]; $dsc = $_POST["dsc"]; $location = $_POST["location"]; $quest = $_POST["quest"]; $membonly = $_POST["membonly"]; $contributors = $_POST["contributors"]; $date = date("F j, Y, g:i a"); mysql_query("UPDATE pdatabase SET name = '$name', pictureurl = '$pictureurl', exinfo = '$exinfo', dsc = '$dsc', location = $location', quest = '$quest', membonly = '$membonly', ontributors = '$contributors', lastupdate = '$date' WHERE pid = $pid"); i reformat that but i found thid ^^^^^^^^ WHERE pid = $pid" where is $pid set Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318155 Share on other sites More sharing options...
Msword Posted August 8, 2007 Author Share Posted August 8, 2007 <?php require("dbconnect.php"); mysql_select_db("runecrypt", $sql); if (isset($_GET['pid']) == 0 and isset($_POST['name']) == 0) { echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title></title> </head> <body> <form method="get" name="edit"> <table style="text-align: left; margin-left: auto; margin-right: auto; width: 325px; height: 61px;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="text-align: center;">Person to edit PID</td> <td><input name="pid"></td> </tr> </tbody> </table> <div style="text-align: center;"><input value="Submit" action="addperson.php" type="submit"><br> </div> </form> <form method="get" name="edit"></form> </body> </html>'; } if (isset($_POST['name'])) { echo "123456"; $pid = $_POST["pid"]; echo $pid; echo 'hello world'; $name = $_POST["name"]; $pictureurl = $_POST["pictureurl"]; $exinfo = $_POST["exinfo"]; $dsc = $_POST["dsc"]; $location = $_POST["location"]; $quest = $_POST["quest"]; $membonly = $_POST["membonly"]; $contributors = $_POST["contributors"]; $lastupdate = date("F j, Y, g:i a"); mysql_query("UPDATE pdatabase SET name='$name', pictureurl='$pictureurl', exinfo='$exinfo', dsc='$dsc', location='$location', quest='$quest', membonly='$membonly', contributors='$contributors', lastupdate='$lastupdate' WHERE pid='$pid'") or die("Mysql error"); } if (isset($_GET['pid'])) { echo "1312"; $pid = mysql_real_escape_string($_GET["pid"]); $result = mysql_query("SELECT * FROM pdatabase WHERE pid='$pid'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo '<html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>Add Person to Database</title> </head> <body> <div style="text-align: center;"> <h2><span style=\"color: rgb(255, 0, 0);\"><a href="editperson.php">Refresh Page</a></span></h2> <form method="post" action="editperson.php" name="edititem"> <input type="hidden" id="pid" value="' . $row['pid'] . '"/> Edit Person in Database<br> <table style="text-align: left; margin-left: auto; margin-right: auto; height: 374px; width: 661px;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="width: 140px; text-align: center;">Name</td> <td style="width: 415px; text-align: center;"><input value="' . $row['name'] . '" input maxlength="40" size="40" name="name"></td> </tr> <tr> <td style="width: 140px; text-align: center;">Picture Name</td> <td style="width: 415px; text-align: center;"><input value="' . $row['pictureurl'] . '" input maxlength="255" size="40" name="pictureurl"><span style="text-decoration: underline;"><br> </span><span style="font-family: monospace;">full link please(http://draftx.net/test/pictures/nopic.png)<br> nopic.png if none</span></td> </tr> <tr> <td style="width: 140px; text-align: center;">Examine Info</td> <td style="width: 415px; text-align: center;"><input value="' . $row['examine'] . '" textarea cols="40" rows="5" name="exinfo"></textarea><br> What it says when you examine the person</td> </tr> <tr> <td style="width: 140px; text-align: center;">Description</td> <td style="width: 415px; text-align: center;"><input value="' . $row['desc'] . '" textarea cols="40" rows="5" name="dsc"></textarea><br> About the person, any extra information</td> </tr> <tr> <td style="width: 140px; text-align: center;">Location</td> <td style="width: 415px; text-align: center;"><input value="' . $row['location'] . '" input maxlength="50" size="40" name="location"><br> <pre><a href="AreaURL">AreaName</a></pre> </td> </tr> <tr> <td style="width: 140px; text-align: center;">Quests</td> <td style="width: 415px; text-align: center;"><input value="' . $row['quest'] . '" textarea cols="40" rows="5" name="quest"></textarea><br> <pre><a href="QuestURL">QuestName</a><br>Put <br> after every line<br>None if person is involved in no quests</pre> </td> </tr> <tr> <td style="width: 140px; text-align: center;">Members Only</td> <td style="width: 415px; text-align: center;"><input value="' . $row['membonly'] . '" input maxlength="5" size="5" name="membonly"><br> Yes/No</td> </tr> <tr> <td style="text-align: center;">Contributors</td> <td style="text-align: center;"><input value="' . $row['contributors'] . '" textarea cols="40" rows="5" name="contributors"></textarea><br> <pre><a href="ContibutorForumURL">ContributorName</a></pre> </td> </tr> </tbody> </table> <input value="Submit" action="editperson.php" type="submit"></form> </div> </body> </html>'; } } ?> that is current code. is it now the way $pid i get get[pid] because that seems to not be working? Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318159 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 explain the prob we're not getting you what do you really want Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318160 Share on other sites More sharing options...
Msword Posted August 8, 2007 Author Share Posted August 8, 2007 Ok, what is happening, its going to the first form, i put in a number, it takes me to the form where it has everything filled in. I submit the form, having changed a few things, and they don't change, no errors, and it brings me to a page where it says '123456hello world' like it is made to. I need the thing to get updated. pid isn't getting echo'd and i think that is the problem, why isn't it getting echo'd? is something wrong with getting this from the form: <input type="hidden" id="pid" value="' . $row['pid'] . '"/> Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318162 Share on other sites More sharing options...
teng84 Posted August 8, 2007 Share Posted August 8, 2007 this should work if the $pid is really set mysql_query("UPDATE pdatabase SET name='".$name."', pictureurl='".$pictureurl."', exinfo='".$exinfo."', dsc='".$dsc."', location='".$location."', quest='".$quest."', membonly='".$membonly."', contributors='".$contributors."', lastupdate='".$lastupdate."' WHERE pid=".$pid."") Quote Link to comment https://forums.phpfreaks.com/topic/63829-solved-problems/#findComment-318169 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.