943,783 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 599
  • PHP RSS
Aug 9th, 2008
0

how to diplay this ineserted data?

Expand Post »
actually, i'm a newbie in php...i'd like to ask you guys.....how to display back all the data from the database for these coding....here's the coding....

php Syntax (Toggle Plain Text)
  1. ($_POST ['action'] == 'pointofcontact'){
  2.  
  3. $projectid = $_POST['projectid'];
  4.  
  5.  
  6. $poc = '';
  7.  
  8. //echo "Pastikan pilihan anda betul!!<br><br>";
  9. for ($i=1; $i <= 3; $i++){
  10.  
  11. $poc = 'poc' . $i;
  12.  
  13. $poc2 = $_POST[$poc];
  14.  
  15. if (!empty($poc2)){
  16. $query = "insert into projectcontact set resourcesid = '$poc2', projectid = '$projectid'";
  17.  
  18. $result = mysql_query($query);
  19. $projectid = $_POST['projectid'];
  20. }
  21. //echo $poc2."<br>";
  22.  
  23. }
  24.  
  25. if ($result){
  26.  
  27. header ('Location: createproject.php?action=projectmanager&projectid='. $projectid);
  28.  
  29.  
  30.  
  31. }
  32.  
  33.  
  34. and number 2 is this :-
  35.  
  36. else if ($_POST ['action'] == 'uploaddownload'){
  37.  
  38. $projectid = $_POST['projectid'];
  39. $docname = $_POST['docname'];
  40.  
  41. $remarks = $_POST ['remarks'];
  42.  
  43.  
  44.  
  45. $query = "insert into user_upload set docname= '$docname' , remarks = '$remarks' '";
  46.  
  47. $result = mysql_query ($query);
  48.  
  49.  
  50. if ((($_FILES["file"]["type"] == "image/gif")
  51. || ($_FILES["file"]["type"] == "image/jpeg")
  52. || ($_FILES["file"]["type"] == "image/pjpeg"))
  53. && ($_FILES["file"]["size"] < 20000))
  54. {
  55. if ($_FILES["file"]["error"] > 0)
  56. {
  57. echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; // $_FILES["file"]["error"] - the error code resulting from the file upload
  58. }
  59. else
  60. {
  61. echo "Upload: " . $_FILES["file"]["name"] . "<br />"; // $_FILES["file"]["name"] - the name of the uploaded file
  62. echo "Type: " . $_FILES["file"]["type"] . "<br />"; // $_FILES["file"]["type"] - the type of the uploaded file
  63. echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";//$_FILES["file"]["size"] - the size in bytes of the uploaded file
  64. echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";// $_FILES["file"]["tmp_name"] - the name of the temporary copy of the file stored on the server
  65. if (file_exists("upload/" . $_FILES["file"]["name"]))
  66. {
  67. echo $_FILES["file"]["name"] . " already exists. ";
  68. }
  69. else
  70. {
  71. move_uploaded_file($_FILES["file"]["tmp_name"],
  72. "upload/" . $_FILES["file"]["name"]);
  73. echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
  74. }
  75. }
  76. }
  77. else
  78. {
  79. echo "Invalid file";
  80. }
  81.  
  82. }

i wantto display these two element....thanks in advance.....
Last edited by peter_budo; Aug 9th, 2008 at 7:18 am. Reason: Keep It Organized - please use [code] tags
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asyieen is offline Offline
11 posts
since Jul 2008
Sep 18th, 2008
0

Re: how to diplay this ineserted data?

Hi Asyieen,
I'm afraid the reason why nobody has answered so far is that it's not very clear what you actually want.

You posted a script that inserts records into projectcontact and user_upload.
And you say you want to display "these two elements". Word "element" is usually used for referencing a tag in a HTML document, while with databases we speak about tables, their records / rows and their attributes.

So what do you need? To list all records in a database table? Have a look at documentation for mysql_fetch_assoc() there's an example that does just that.
Reputation Points: 27
Solved Threads: 16
Junior Poster
petr.pavel is offline Offline
116 posts
since Mar 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: get_url or fopen challenges
Next Thread in PHP Forum Timeline: Modifying





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC