Jump to content

simcoweb

Members
  • Posts

    1,104
  • Joined

  • Last visited

Everything posted by simcoweb

  1. The code you posted.. that's not from emails.php as it references 'line 40'. There's not 40 lines there.
  2. Well, here's my guess. It's trying to validate that those tables were created. However, it's using mysql_num_rows which would count the number of entries or records (rows) in the table. Since there's no data then there's no rows. Therefore the query is failing since it's asking if the >= (greater than) 0 which it's not because there's no one in there yet. Just my guess
  3. To display it as a link just change your while loop output: <?php while ($line = mysql_fetch_array($result){ echo "<a href='ifyouhaveascript.php?link=" . $line['Download'] . "'>Download File</a>"; } ?>
  4. You need an HTML form like the following: <html> <head> <title>Upload form</title> </head> <body> <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> </body> </html>
  5. You could display them like this. Set the column variable to whatever you want: <?php // display results $totalColumns = 3; $i = 1; echo "<table border='0' cellpadding='2'>"; while ($row = mysql_fetch_array($results)){ if ($i == 1) echo "<tr>"; echo "<td>"; echo "your_image_reference_here"; echo "</td>"; if ($i == $totalColumns) { echo "</tr>"; $i = 0; } $i++; } echo "</table>"; ?>
  6. In most cases those downloaded scripts would have instructions on setting it up to work with your Mysql database. Post the code of the login form/file and let's see what we can do.
  7. Personally I think that code is a bit off. For example, I don't see where $image variable's value is even set. Basically a file upload consists of using the $_FILES array that PHP creates when a file is uploaded. It consists of a couple of important things: $_FILES['uploadfile']['tmp_name']; which is the temporary name that is assigned to the uploaded file. As a default, the image is uploaded to a temporary folder and assigned the temporary name. and $_FILES['uploadedfile']['name']; which is the actual name of the file. There's also $_FILES['uploadedfile']['size']; and $_FILES['uploadedfile']['type']; as well so you can check against size restrictions and file types. Here's an image upload snippet I use that also validates the extension and the size that you can use as a model: <?php // Upload File $eg_success_File1 = false; if(!empty($_FILES['photo']['name'])) { // Check file is not larger than specified maximum size $eg_allowUpload = $_FILES['photo']['size'] <= 100000 ? true : false; // Check file is of the specified type if($eg_allowUpload) $eg_allowUpload = preg_match('/\\.(gif|jpg|jpeg|png)$/i', $_FILES['photo']['name']) ? true : false; if($eg_allowUpload) { if(is_uploaded_file($_FILES['photo']['tmp_name'])) { $eg_uploaddir = $_SERVER['DOCUMENT_ROOT']."/images/photo/"; $eg_uploadFile1 = $eg_uploaddir.rawurlencode($_FILES['photo']['name']); // Create a unique filename for the uploaded file $eg_i = 1; while (file_exists($eg_uploadFile1)) { $eg_separated_filename = explode(".",$eg_uploadFile1); if (substr($eg_separated_filename[0],-1) == $eg_i) { $eg_separated_filename[0] = substr($eg_separated_filename[0], 0, (strlen($eg_separated_filename[0])-1)); $eg_i++; } $eg_separated_filename[0] = $eg_separated_filename[0] . "$eg_i"; $eg_uploadFile1 = implode(".",$eg_separated_filename); } $eg_success_File1 = move_uploaded_file($_FILES['photo']['tmp_name'], $eg_uploadFile1); } } } ?> For the mysql insert i'd add the value like this:
  8. Are you writing a script? Or looking for help with this utility program?
  9. You didn't answer the question about the 'id' field being auto-incremented.
  10. Yeah, that first set of empty quotes isn't always necessary in your values.
  11. Is the 'id' field set to auto-increment? If so, you don't need to include it in your query as a field name. Should be:
  12. Ok, so what you're saying is I really don't need the expiration date?
  13. Barand, thanks for the clarification on that. I 'assumed' that was the case but thanks for validating it.
  14. Try changing to this: <?php include 'dbconnect.php'; $query = mysql_query("SELECT type FROM mytable WHERE color = 'blue' "); while ($row = mysql_fetch_array($query)) { echo "" . $row['type'] . "<br\ >\n"; } ?>
  15. Will that pull the ads from both date created and date expired as well as the in between?
  16. I have a classified ads system under development. Two of the fields in the database are: date_created date_expired I want to populate both of these at the time the ad is posted. The date created value is derived from: $date_created=now(); For the date expired I have this: $date_expired = mktime(0, 0, 0, date("m"), date("d")+7, date("y")); Which takes today's date plus 7 days (ads expire in 7 days) and inserts this date into the database. Now, in the query, i'm fuzzy on how I would pull all ads the aren't expired.
  17. In your image attributes set this: align="left" And the text should wrap around it.
  18. Try swapping your quotes around. Like this: <?php $message="<a href='http://www.usadarts.com'><i>USADarts Website</i></a>"; ?>
  19. That would be CAPTCHA. There's several tutorials if you google it.
  20. Simply put, this is not a place to ask general questions like: Why is there air? How does a plane fly? When will the sun burn out? What's the meaning of life? You're expected to write your own code and when you get stuck come here with a specific question regarding why the code doesn't work.
×
×
  • 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.