how to diplay this ineserted data?

Reply

Join Date: Jul 2008
Posts: 11
Reputation: asyieen is an unknown quantity at this point 
Solved Threads: 0
asyieen asyieen is offline Offline
Newbie Poster

how to diplay this ineserted data?

 
0
  #1
Aug 9th, 2008
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....

  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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 100
Reputation: petr.pavel is an unknown quantity at this point 
Solved Threads: 14
petr.pavel's Avatar
petr.pavel petr.pavel is offline Offline
Junior Poster

Re: how to diplay this ineserted data?

 
0
  #2
Sep 18th, 2008
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.
Petr 'PePa' Pavel

The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC