Jump to content

weekenthe9

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

weekenthe9's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This is the query I was trying: UPDATE comments_test SET (`user`, `comment_Link`, `Project_Key`) VALUES ('A', 'B', '12') WHERE `Key`='6' But it gives an error message saying: ERROR 1064: You have an error in your SQL syntax.
  2. How can you update multiple columns together? Does this work? $query = "UPDATE ".$table_name." SET (`Field1`, `Field2`, `Field3`) VALUES ('$Value1', '$Value2', '$Value3')";
  3. Sorry about that, I accidentally used an html tag.. Let me repost: <input type="text" name="someName" readonly="readonly"> This would make the textfield readonly. The question is, is there some string [someString] such that <input type="text" name="someName" readonly="[someString]"> is NOT readonly? I tried false and empty string, but both of them still makes the textfield readonly P.S.: I do know that not putting the readonly attribute will make the textfield NOT readonly
  4. errr I don't think I did the strikeout text...
  5. <input type="text" name="someName" readonly="readonly"> This would make the textfield readonly. The question is, is there some string such that <input type="text" name="someName" readonly=""> is NOT readonly? I tried false and empty string, but both of them still makes the textfield readonly P.S.: I do know that not putting the readonly attribute will make the textfield NOT readonly
  6. echo "<form name=\"input\" action=\"mysql_test_comments_added.php\" method=\"post\">"; echo "<table border=\"1\">"; echo "<tr><td>User</td><td>Comments</td><td>Comment Date</td></tr>"; while ($sapedUsers[$i]) { $result = mysql_query("SELECT * FROM ".$comments_tb." WHERE Project_Key=$PKey AND user=\"$sapedUsers[$i]\"") or die(mysql_error()); $row = mysql_fetch_array( $result ); if ($editable != 1) { $ltstring = " readonly=\"readonly\" "; $ltstring2 = " style=\"border:none;\" "; } else { $ltstring = " "; $ltstring2 = " "; } echo "<tr><td>"."<input".$ltstring2."type=\"text\"".$ltstring."name=\"user[".$i."]\" value=\"".$sapedUsers[$i]."\">"; echo "</td><td>"."<input".$ltstring2."type=\"text\"".$ltstring."name=\"comment_link[".$i."]\" value=\"".$row['comment_Link']."\">"; echo "</td><td>"."<input".$ltstring2."type=\"text\"".$ltstring."name=\"comments_Date[".$i."]\" value=\"".$row['comment_date']."\">"; echo "</td></tr>"; $i = $i + 1; } echo "<input type=\"hidden\" name=\"item_index\" value=\"".$i."\">"; echo "<input type=\"hidden\" name=\"Project_Key\" value=\"".$PKey."\">"; echo "</table>"; if ($editable == 1) { echo "<br><input type=\"submit\" value=\"Submit\">"; } echo "</form>"; _______________________________________________________________ and here's the target of the form: $user = $_POST["user"]; $comment_link = $_POST["comment_link"]; $Project_Key = $_POST["Project_Key"]; $comments_Date = $_POST["comments_Date"]; $item_index = $_POST["item_index"]; $i = 0; while ($i < $item_index) { $result = mysql_query("SELECT * FROM ".$comments_tb." WHERE Project_Key=$Project_Key AND user=\"$user[$i]\"") or die(mysql_error()); $row = mysql_fetch_array( $result ); if (!$row) { $goodreq = "INSERT INTO ".$comments_tb." (`user`, `comment_Link`, `project_Key`, `comment_Date`) VALUES ('$user[$i]', '$comment_link[$i]', '$Project_Key', '$comments_Date[$i]');"; } else { $goodreq = "UPDATE ".$comments_tb." SET `comment_Link` = '$comment_link[$i]', `comment_date` = '$comments_Date[$i]' WHERE Project_Key=$Project_Key AND user='$user[$i]'"; } echo $goodreq; mysql_query($goodreq) or die(mysql_error()); $i = $i + 1; }
  7. I just found that the condition to make the updates show on the webpage is: Delete the webpage (e.g. somePage.php) from the server and re-upload it, then refresh the webpage Although this does not solve the problem, but maybe it's a useful hint...
  8. Basically, when user updates the data from the webpage, although the database has been updated, the result is not shown on the webpage. All the data shown on the webpage are the old ones before the update. This is weird because the data on the webpage comes from the database, but now they have a mismatch. It takes some time and/or a reboot for web explorer for the new data to be shown on the webpage
  9. I made a webpage using php that allows user to update mysql database through an html form. There is an option on this page that disables modification, so it only displays the current data. However after the user submits the data and goes back to this page, the data has not been updated (while the db is). Has this got something to do with sessions or cookies? Thanks a lot!
  10. That's exactly what I wanted! Thank you so much!!!
  11. If I don't have the submit button, then on every entry I can only add one item from the dropdown list (e.g. "Red"), what if I want to add several ("Red, Green")?
  12. [Field Name]: [textbox] [Field Name]: [textbox] [Field Name]: [textbox] .... [Field Name]: [a drop down list] [add button] [current list, not editable] [Field Name]: [textbox] [submit button] There's nothing special about this form about the red line. Here's what I want this line to do: Let's say if the dropdown list has 3 values: Red, Green and Blue. if I select "Red" and click the "Add" button beside it, the form would reload with all the values I previously entered, but the [current list, not editable] is now "Red". Now if I select "Green" and click "Add", the form would reload again, with all the values I previously entered, and the [current list, not editable] should now be "Red, Green". After I'm done with adding stuff from the dropdown list, I will click "Submit" button on the bottom of the page, and all the field I entered, as well as the "Red, Green" list would be sent to a next page which will record these information into database. I'm not sure about how I should code that red line. I know this sounds really confusing, but I can't really find a good way to express it. If you're willing to help but not sure about what I'm asking, please feel free to ask Thanks a lot!
  13. After a recent server reboot (my workplace uses xitami server), my php code starts to execute in a weird way: 1. echo command works 2. php $_GET and $_POST cannot retrieve any information 3. mysql query commands (in php) work 4. phpinfo generates very weird webpage ************************************************ here's the code <?php phpinfo(); ?> ************************************************ here's what it's supposed to be something like this: http://wiki.gandi.net/_media/en/hosting/using-linux/tutorials/phpinfo.jpg ************************************************ but when I open the page it shows this (pure text in the explorer window): phpinfo() PHP Version => 5.1.2 System => Windows NT RETKA7PZW6 5.0 build 2195 Build Date => Jan 11 2006 16:35:21 Configure Command => cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" Server API => Command Line Interface Virtual Directory Support => enabled Configuration File (php.ini) Path => C:\WINNT\php.ini PHP API => 20041225 PHP Extension => 20050922 Zend Extension => 220051025 Debug Build => no Thread Safety => enabled Zend Memory Manager => enabled IPv6 Support => enabled Registered PHP Streams => php, file, http, ftp, ....... and a lot more. ************************************************ I think the it's not like the php is completely broken (or not even loaded), as it gave the correct version # (5.12). But there is definitely some problem. Could anyone please take a look? Thanks a lot!!
  14. Thanks a lot, I really appreciate it Will try it out tomorrow, hopefully it works
  15. Thanks a lot, I appreciate it. Actually my workplace uses xitami server, not apache. The change that I recently made to server setting is to add the following lines to "defaults.cfg" under xitami folder [Mime] php=application/x-httpd-php [Filter] .php=c:\\php\\php.exe (I'm not exactly sure about this, need to check when I get back to work tomorrow) Which seems alright to me...could these code above be what caused the problem (double slash problem? incorrect slash direction?) or something else went wrong?
×
×
  • 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.