0

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....

($_POST ['action'] == 'pointofcontact'){
	
	$projectid = $_POST['projectid']; 
	
	
	$poc = '';

		//echo "Pastikan pilihan anda betul!!<br><br>";
		for ($i=1; $i <= 3; $i++){
		
			$poc = 'poc' . $i;
			
			$poc2 = $_POST[$poc];
			
			if (!empty($poc2)){
			$query = "insert into projectcontact set resourcesid = '$poc2', projectid = '$projectid'";
	
			$result = mysql_query($query);
			$projectid = $_POST['projectid'];
			}
			//echo $poc2."<br>";
			
		}
	
	if ($result){
		
		header ('Location: createproject.php?action=projectmanager&projectid='. $projectid);
		
		
		
	}


and number 2 is this :-

else if ($_POST ['action'] == 'uploaddownload'){

$projectid = $_POST['projectid']; 
$docname = $_POST['docname'];

$remarks =  $_POST ['remarks'];



$query = "insert into user_upload set docname= '$docname' ,  remarks = '$remarks' '";

$result = mysql_query ($query);


if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; // $_FILES["file"]["error"] - the error code resulting from the file upload
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />"; // $_FILES["file"]["name"] - the name of the uploaded file
    echo "Type: " . $_FILES["file"]["type"] . "<br />"; // $_FILES["file"]["type"] - the type of the uploaded file
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";//$_FILES["file"]["size"] - the size in bytes of the uploaded file
    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
    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }

}

i wantto display these two element....thanks in advance.....

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by petr.pavel
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.