Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Need code. Did you write the program or is it an off the shelf script?
  2. Read the file into a variable. Add your lines to another variable. Concatenate the two variables into a third variable. Write the third variable back to the file.
  3. Add the following to your httpd.conf file and restart your apache server: AddType application/x-httpd-php .php .phtml
  4. Add a database field to store the image filename in your articles table. Add a file upload field into the form that creates the article: <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="image" id="image" size="70" maxlength="255"> </form> You can then upload the file from: $_FILES['image']['name'] Checkout some image uploading tutorials. To resize your image you can use php's GD library functions (must have these available in your php setup) or download and install imagemagick
  5. You are trying to use the SHOW command in the manor of the SELECT command. This is not what it is designed for.
  6. This is not the kind of processing that should be initiated through a web browser application. PHP, MySQL are fine to use however the script should be a shell operation. You web app admin system could be used to upload the CSV file and flag something in the database. The shell script could run using a cron job. When you upload the CSV the flag could be set to 1, this will let the shell script know that a new csv has been uploaded and it should be processed, when the script has finished it could reset the flag to 0, send you an email, etc....
  7. Not the way to do it. Try this: <?php include "db.php"; $id = $_GET['id']; $select = mysql_query("SELECT * FROM table WHERE ID = '$id'"); $data = mysql_fetch_array($select); ?> <form method="post" > <input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="checkbox" name="publish" value="1"<?php if($data['publish'] == 'yes') echo " checked"; ?>/><input type="submit" ></form> Then your update part: <?php $publish = ($_POST['publish'] == 1) ? "yes" : "no"; $query = mysql_query("UPDATE table SET publish = '$publish' WHERE ID = '".$_POST['id']."'"); ?>
  8. I would have just used a Javascript button to go back to your search results from the detail screen. <a href="#" onClick="history.go(-1)">Back to results</a> or <input type=button value="Back to results" onClick="history.go(-1)">
  9. Not going to work if your script is in an iframe on site B. The script needs to run directly from site B.
  10. Do you have the following options set: curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookie.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookie.txt');
  11. This is obviously the incorrect username and password to connect to your database. Are you sure you are not using a website user's username and password in the connection string rather than the database username/password?
  12. That it would
  13. Whats the error please.
  14. Who can type the quickest eh?
  15. Yep you get this because column is reserved syntax. Bad choice naming your fields row & column
  16. $query = "UPDATE lotto SET state='1', winner='".mysql_real_escape_string($user)."' WHERE row='".mysql_real_escape_string($row)."' AND column = '".mysql_real_escape_string($col)."' LIMIT 1"; Check your variables contain the correct data.
  17. Do it however you feel is best for you. I use a login check function on all pages that require the user to be logged in. If they try to access the page by typing the filename in through their web browser then they will be redirected to the login page.
  18. Good job. I would redirect the user to the login page using a header() if not logged in. You could write a function and call on all your secure pages: function checkUserLogin() { // user not logged in header("Location:login.php"); exit(); }
  19. You should use a file upload field in your product update form for the images. You can then store the image filename from the $_FILES array after upload.
  20. You are not passing in strings to the constructor $db = &new MySQL(localhost, root, root, testing); Ammend to $db = &new MySQL("localhost", "root", "root", "testing");
  21. Good advice. Dreamweaver generates code that is utter garbage when you use its GUI interface. Stick to the code view and learn it yourself.
  22. Using a database query on the primary key. You can sent the key as a URL parameter i.e <a href="user.php?id=23">Joe Bloggs</a> You really need to get a book if you are this new to PHP
  23. Mysqli is the improved mysql extension to make use of the new features of 4.1.3 and above. Part of php5. Whats the issue?
  24. Looks clean enough. Does it work?
  25. Use PEAR Mail_Mime to send the email with the PDF attachment http://pear.php.net/package/Mail_Mime The user will enter their email address into your form. Validate the email address and then send the email with the PDF attachment.
×
×
  • 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.