Jump to content

justAnoob

Members
  • Posts

    561
  • Joined

  • Last visited

    Never

Everything posted by justAnoob

  1. the only problem with that is that I can't use the user_id to find the info in the database,, only because a user may have more than item in the database,,, so wouldn't it be better to find the actual id of that specific item by saying something like select id where item_name =$item_name, description =$description etc...
  2. here there it is,,, lol,, thanks.
  3. um,, not me.,,,,, lol try putting a bunch of empty lines before your post,,,
  4. your last post said try this... but there is nothing there just a textfield smashed together with no scroll bar(up and down)
  5. there is nothing there to try,,,, i can see any code in your post...
  6. disregard the last post,, I'll work on it... I get confused pretty easily..
  7. So something like this to get the variable? <?php $sqlquery ="SELECT id FROM abcxyz WHERE item_name ='$item_name', description = '$description', in_return = '$in_return' LIMIT 1"; $result=mysql_query($sqlquery); $gotit = $result; ?>
  8. ken2k7 what do you mean? xtopolis do you know what he is saying?
  9. So I should do a query to get the id eh? Sorry,,, I'm still a newb to PHP... some stuff I know,, but there is a lot I still need to learn.
  10. the items do have a id ... god i feel stupid...... but I'm pretty sure I tried do it that way.. <?php $sql = "UPDATE abcxyz SET item_name = '$item_name', description = '$description', in_return = '$in_return' WHERE id = '$something'"; ?>
  11. Well,,, it works kinda... I can update and change the description and the in_return fields as long as I don't change the item_name... Why,, well when I change the item_name the script is looking for the changed item_name in my database which it won't find...So I'll try and work it out now.. If anyone has any ideas,,, please feel free... And a big thanks to everyone that helped.
  12. alright,, I posted that back into php and put some new values and that worked out great...So I guess the problem is somewhere in the variables from my text field or text boxes........or the problem is where I'm selecting the item_name.
  13. ok,, this works now in mysql interface,,, when I fill in some values UPDATE abcxyz SET item_name = '$item_name', description = '$description', in_return = '$in_return' WHERE item_name = '$gotit'
  14. I take that back,,, it says that the affected rows = 0,,,, so it did nothing.
  15. this line worked inside mysql interface UPDATE abcxyz SET item_name = '$item_name', description = '$description', in_return = '$in_return' WHERE item_name = '$gotit'
  16. If you mean to execute this line inside of mysql $sql = "UPDATE member_trades SET item_name = 'blah', description = 'blah blah', in_return = '$blah blah blah' WHERE item_name = '$item_name'"; I got an error saying to check your sql syntax that corresponds with mysql version
  17. Not sure what you mean... Could you explain.
  18. Nope nothing yet... Still says that is was updated,, but I return to my form table page and everthing is the same. (also checked mysql database for fun,, no change there either.
  19. that is old,,, got in my post somehow by accident... this is the new script..... <?php session_start(); include "connection.php"; $getthatname = $_REQUEST['item_name']; $gotit = $getthatname; if ($_POST["submit"]) { $item_name = mysql_real_escape_string($_POST["item_name"]); $description = mysql_real_escape_string($_POST["description"]); $in_return = mysql_real_escape_string($_POST["in_return"]); mysql_query("UPDATE abcxyz SET item_name = '$item_name', description = '$description', in_return = '$in_return' WHERE item_name = '$gotit'") or die( mysql_error()); echo "$gotit has been updated."; mysql_close(); } ?> I get no errors,, and it echos that it is updated.. But when I go back to my page that has my table with the mysql info.. everything is the same.. So somewher in this script it is not posting the information that I changed on my form.
  20. those 2 lines that you mentioned shouldn't have been there.. that was from something that I was working on earlier... there gone now.... here you go... <form id="form2" name="form2" method="post" action="updatetrade.php"> <?php session_start(); include "connection.php"; $findit = $_SESSION['id']; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = '$result'"); echo "<table width='954' height='523' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" />'; echo "</td><td><div align='center'>"; echo '<input type="submit" name="submit" id="submit" value="Update Trade">'; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; //echo "save delete buttons"; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; ?> </form>
  21. the script that is inside the form is not the problem.. everything works fine there... it is just the mysql update script that I posted earlier.
  22. <form id="form2" name="form2" method="post" action="updatetrade.php"> <?php session_start(); include "connection.php"; $findit = $_SESSION['id']; $result = mysql_query("SELECT id FROM members WHERE username = '$findit'"); $result = mysql_result($result, 0, 0); $sql = mysql_query("SELECT imgpath, imgpath2, imgpath3, imgpath4, imgpath5, item_name, description, in_return FROM abcxyz WHERE user_id = '$result'"); $img2query = mysql_query("SELECT imgpath2 FROM abcxyz WHERE user_id = '$result'"); $num_rows = mysql_num_rows($img2query); echo "<table width='954' height='523' border='0' align='center' cellpadding='0' cellspacing='0' bordercolor='#000000' bgcolor='#BBD4E1'>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td width='188' height='180'><div align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath2'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath3'] . '" width="125" alt="" />'; echo "</div></td><td width='188'><div align='center'>"; echo '<img src="' . $row['imgpath4'] . '" width="125" alt="" />'; echo "</div></td><td width='190'><div align='center'>"; echo '<img src="' . $row['imgpath5'] . '" width="125" alt="" />'; echo "</div></td></tr><tr><td height='43' colspan='4'>"; echo '<strong>Item Name:</strong> <input type="text" name="item_name" value="' . $row['item_name'] . '" size="50" />'; echo "</td><td><div align='center'>"; echo '<input type="submit" name="submit" id="submit" value="Update Trade">'; echo "</div></td></tr><tr><td height='116' colspan='4'>"; echo '<strong>Description:</strong> <textarea name="description" cols="75" rows="5">' . $row['description'] . '</textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td height='124' colspan='4'>"; echo '<strong>Seeking:</strong> <textarea name="in_return" cols="75" rows="5">' . $row['in_return'] . ' </textarea>'; echo "</td><td><div align='center'>"; echo "</div></td></tr><tr><td colspan='4'>"; //echo "save delete buttons"; echo "</td><td><div align='center'>"; echo "</td></tr>"; } echo "</table>"; ?> </form>
  23. ooppsss,, forgot to post that,,, one minute.
  24. No, there are no errors....I am so confused....
  25. Still having problems,,, can anyone help,, this is driving me crazy... I search everywhere for an answer and nothing. <?php session_start(); include "connection.php"; $getthatname = $_REQUEST['item_name']; $gotit = $getthatname; if ($_POST["submit"]) { $item_name = mysql_real_escape_string($_POST["item_name"]); $description = mysql_real_escape_string($_POST["description"]); $in_return = mysql_real_escape_string($_POST["in_return"]); mysql_query("UPDATE abcxyz SET item_name = '$item_name', description = '$description', in_return = '$in_return' WHERE item_name = '$gotit'"); echo "$gotit has been updated."; mysql_close(); } ?> Here is the table that I'm working from......And yes my table is inside a form(form2) and my action is set.... The script echos that it was updated. But when I return to my table on my site,,, the values of the database have not been changed...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.