Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. .htaccess convert every upper case .html file to lowercase and fetch the file if the lowercase html file exists
  2. // multiple uploads are added in a numerical array as explained in the php manual // $_FILES = array // ( // 'tmp_name' => array('msdj.tmp', 'msjsd.tmp', ...), // 'name' => array('filename1', 'filename2', ...), // 'size' => array('sizeFile1', 'sizeFile2', ..), // ... // ); // // number of uploads $num_uploads = sizeof((array) $_FILES['tmp_name']); if (1 < $num_uploads) { // multiple uploads for ($i = 0; $i < $num_uploads; $i++) { if ($_FILES['error'][$i] == UPLOAD_ERR_OK) { // this upload is ok } } }// Else single upload
  3. <?php // create an .htaccess file that reads the line: // php_flag register_globals off if(!isset($_POST['load']) && !isset($_GET['job_id'])) { $byrndb->job_list(2,$job); // NOTICE: $job is undefined here } elseif(isset($_POST['load'])) { $job=$_POST['job']; $byrndb->job_list(2,$job); } elseif(isset($_GET['job_id'])) { $job=$_GET['job_id']; $byrndb->job_list(2,$job); } ?>
  4. stop writing SQL at all and use Object Relational Mapping (ORM) like Propel or the Zend_Db component from the Zend Framework
  5. <form action="googleit.php" method="post" .. <input type="text" name="keyword" ... googleit.php // assuming $_GET was filtered and validated $keyword = $_GET['keyword']; // write to db ... // refer to google search header("Location: http://www.google.com/search?q=" . $keyword);
  6. this entirely depends on your database normalization, i would use an intersection (many-to-many) table to store the ids of what the user has choosen, so for your example i would have the following fields: country_id task_id timeofday_id where task and timeofday would come in a listbox and country in a combobox because we can only perform one task during a certain point in the day, but we could do this in different countries (theoretically anyway) although i think that this was not a good example
  7. yep you are however bound to the Component Object Model (COM) to build excel files http://be.php.net/manual/en/book.com.php
  8. <?php if (isset($_POST['news_type'][1])) { // update for news_type[1] } elseif (isset($_POST['news_type'][2])) { // update for news_type[2] } else if (isset($_POST['news_type'][3])) { // update for news_type[3] }
  9. $mainkeyword ="Entrepreneurship,Entrepreneurship Success Guide";
  10. <?php $target = "images/"; list($filename, $extension) = explode('.', basename($_FILES['photo']['name'])); $filename = sha1($filename); $target = $target . $filename . $extension;
  11. $features = mysql_fetch_assoc($result); should give you someting like: array( 0 => array( 'rowfield' => 'rowvalue' ) ); another option is the Iterator class as found in the PHP Standard PHP Library (SPL): http://www.php.net/~helly/php/ext/spl/ or: http://be.php.net/spl
  12. eval(): http://be.php.net/manual/en/function.eval.php
  13. on the top you write: $start = microtime(true); and at the bottom you write: $msecs = $start - microtime(true); print "the page loaded in: " . number_format($msecs, 2) . " msecs";
  14. what is your db table type? autocommit() does not work with MyISAM or ISAM, you probably know this if you read the manual
  15. if you do not have the plugin installed, then yes you will be required to ask that they install it for you
  16. did you properly reset all values? please post some code so we can have a look at it
  17. chmod(): http://be.php.net/manual/en/function.chmod.php
  18. when they login you set a certain value in your _SESSION variable, you check on an authorized page if that value is set, if not then redirect to the login form
  19. use: <input name="56" value="4" /> where 56 is the product_id and 4 the quantity when the user then presses the update button, you take the items from the shopping cart and loop over them, when an items product_id is found in the POST variable with a different value for the quantity, you perform the update
  20. use fetch() instead of fetchRow()
  21. yeah i think its possible but you will need to use regex to achieve it http://be.php.net/manual/en/book.regex.php
  22. take a look at: http://mediumexposure.com/techblog/smart-image-resizing-while-preserving-transparency-php-and-gd-library also make sure your memory_limit is high enough to resize big images
  23. using GET or POST GET: you can pass it in the url or through a form url: <a href="page.php?argument=value"> .. form: <form action="page.php" method="get"><input type="hidden" name="argument" value="value" /> POST: only through a form <form method="post"><input type="hidden" name="argument" value="value" /> type="hidden" does not necessarily be hidden, it also can be text, password, .. download a html reference XHTML 1.0 by preference
  24. no it is not possible to retrieve information (due to privacy reasons) unless using ActiveX, but even then they must allow you to retrieve such information
  25. <?php $num_imgs = sizeof($image_rows) - 1; $current_row = (int) $_GET['image']; $has_previous = false; $has_next = false; if ($current_row >= $num_imgs) { $current_row = $num_imgs; } else { $has_next = true; } if ($current_row <= 1) { $current_row = 1; } else { $has_previous = true; } // the image echo '<img src="' . $image_rows[$current_row]['image_path'] . '" />'; // previous echo ($has_previous ? '<a href="?image=' . $current_row . '">previous</a>' : '<b>previous</b>'); // next echo ($has_next ? '<a href="?image=' . ($current_row + 1) . '">next</a>' : '<b>next</b>');
×
×
  • 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.