Jump to content

KaiSheng

Members
  • Posts

    79
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Sinagpore
  • Interests
    Creating web-based applications in php.
  • Age
    20

KaiSheng's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Awww... It's not working. Because the path is inside a folder called image. The code you shown me is echo-ing picture from the current folder same as the php file. ):
  2. Anyone knows how? Display image from the image folder. It is a different folder with the php file.
  3. Yeah, for that you need to come up with another condition inside a condition.
  4. First you need to create a form in php. Second, you need to pass the values you gotten from the form into your database. I'll show you an example. This is your form. <form method="post" action="xxx.php" enctype="multipart/form-data"> <tr> <td><label for="file">File name:*</label></td> <td> <input type="file" name="file" required> </td> </tr> --- This will be the second page where the value is passed. move_uploaded_file($_FILES["file"]["tmp_name"], "doc/" . $_FILES["file"]["name"]); the above code, "doc" represents the name of the folder. the "file" represent the value from the form, in which the file that you are uploading. the "tmp_name" represents the temporary file name stored in the server. the "name" is the attributes of the file you uploaded. This is the simplest. I did not include any database connection, presume you already know how to, and youtube have lots of tutorials for this. You can take a look at this.
  5. Real database is a place where data is stored in your localhost or on a domain. The information is kept inside a SQL file. You should export to SQL file, and import into the database localhost or onto your domain. Followed by creating a php script to search or view the information. (It is way much easier and simpler this way.)
  6. I do not understand what u mean by browse your document in your registration form. if you want to upload something up to your database, that can be done in a minute.
  7. If the user didn't logs in, even if you are able to save the additional details, you won't be able to know that additional details is for which person. in which this case, i called it as (SESSION id) This is not possible to force the login between point 1 and 2. You do not want them to access the site if they have not complete the registration. Another way you can do is to add an additional field called status maybe? For e.g (once they registered,their status by default is 0. Once they login, you redirect them to the additional details page, once they updated that, their status changes to 1. using insert & update query) followed on, on your home page, or any page that you said you do not want them to access, you can come up with a condition, if ($status == 0) { echo "Please update your additional information before carry on"; } else { paste the whole code here } This way they will be only able to view the page ONCE they have updated their additional information. Which that page also is the page that changes their 'status'. I hope you understand. ------------------- Point 4, you are correct. Point 5, In your login success script, you can put this at the top of your code. (it must be the first line of your code page.) header("Location: www.addAdditionalInfo.php")
  8. it is php. pre hypertext process. It won't work.
  9. Not working refers to no image displayed. There are no errors shown. I think it's something related to the echo of the image line, however i searched and tried all kinds of <img src code, it doesn't work. (Or maybe the path.. but i have no idea how to change it.) I have a folder called LN, inside LN is all my codes, inside LN also contains the folder called image. I want to display the picture inside the folder called image.
  10. Download XAMPP control panel? inside of this panel, install apache and mysql. run this 2 service after that. go to this link http://localhost/xampp/ then you can access your database.
  11. Do not really understand where you coming from. But this line seems weird to me. mysql_query("INSERT INTO `users_cv` VALUES ('$id', '$name', '$upload_Name')"); isn't it be like mysql_query("INSERT INTO `users_cv` (id,name,upload_Name) VALUES ('$id', '$name', '$upload_Name')"); ??
  12. 3rd point can only be done when they are logged in. echo SESSION id that takes the username. ----------- 4th point can be done by UPDATE in the query. for example, when they registered for an account, by default their level is 0. your register query should capture that. At the page where the UPDATE starts, you should add into the query for update for the field level. e.g UPDATE user SET level = '1' (or something like SET level = <?php $current_level + 1?>) Not sure about the punctuations. ------------ 5th point, the level 0 details should be already be saved at stage 2. Therefore, this point is unnecessary. ---------- 1st and 2nd point just leads them pages to pages. And remember, at the stage of 2nd point, they must be logged in.
  13. Firstly, i wanna say that all my codes were working perfectly fine in a localhost. After that, transfers to a domain, putting the website online. My codes do not function properly after that. What i want to achieve is to display the images i have uploaded into the database, from the folder called image. I'll show code. This is the page where the process of uploading takes place. if ((($_FILES["picture"]["type"] == "image/gif") || ($_FILES["picture"]["type"] == "image/jpeg") || ($_FILES["picture"]["type"] == "image/jpg") || ($_FILES["picture"]["type"] == "image/pjpeg") || ($_FILES["picture"]["type"] == "image/x-png") || ($_FILES["picture"]["type"] == "image/png")) ) { if ($_FILES["picture"]["error"] > 0) { echo "Return Code: " . $_FILES["picture"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["picture"]["name"] . "<br />"; echo "Type: " . $_FILES["picture"]["type"] . "<br />"; echo "Size: " . ($_FILES["picture"]["size"]) . " Kb<br />"; echo "Temp file: " . $_FILES["picture"]["tmp_name"] . "<br />"; if (file_exists("image/" . $_FILES["picture"]["name"])) { echo $_FILES["picture"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["picture"]["tmp_name"], "image/" . $_FILES["picture"]["name"]); echo "Stored in: " . "../image/" . $_FILES["picture"]["name"]; } } } else { echo "Invalid file"; } --- This is the viewing of the displayed images. while ($row = mysqli_fetch_array($result)) { $id = $row['id']; $username = $row['username']; $category = $row ['category']; $description = $row['description']; $date_found = $row['date_found']; $picture = $row['picture']; $image = "<img src='image/$picture' />"; $date_submitted = $row['date_submitted']; $outlet = $row['outlet']; $item_match = $row['item_match']; ?> <tr> <td><?php echo $category; ?></td> <td><?php echo $description; ?></td> <td><?php echo $date_found; ?></td> <td><img src=""<?php echo $picture;?> height="100" width="100"</td> <td><?php echo $date_submitted; ?></td> <td><?php echo $outlet; ?></td> <td><?php echo $username; ?></td> <td><?php echo $item_match; ?></td> It is not working for the display area. Can someone help? thanks.
  14. You should not put the bolded section into the php code. You have to differentiate php code and html code separately to prevent errors.
×
×
  • 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.