Jump to content

Perad

Members
  • Posts

    287
  • Joined

  • Last visited

    Never

Everything posted by Perad

  1. The meta refresh tag would best suit your needs here. http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm
  2. I am trying to make a function far more useful by allowing more input variables. However i am having some difficulty finishing it off. Here is the original function. public function Find($id = '') { if ($id != '') { $sql = "SELECT * FROM x_pages WHERE id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $this->data[] = array('id' => $row['id'], 'nav_image' => $row['nav_image'], 'name' => $row['name'], 'online' => $row['online'], 'order' => $row['p_order']); } else { $sql = "SELECT * FROM x_pages"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $this->data[] = array('id' => $row['id'], 'nav_image' => $row['nav_image'], 'name' => $row['name'], 'online' => $row['online'], 'order' => $row['p_order']); } } } This is the new one so far $value = 'name|online|p_order' public function Find($type, $table, $value, $id = NULL) { $values = explode('|', $value); for ($i = 0; $i < count($values); $i++) { } if ($type == 'single') { $sql = "SELECT * FROM $table WHERE id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $this->data[] = $values; } if ($type == 'all') { $sql = "SELECT * FROM $table"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $this->data[] = $values); } } } How do I convert the value into the data array I used in my original function?
  3. Thank you, that fits the bill perfectly.
  4. How do I shorten a string by 1 character?
  5. There is a flash button on my website. When the button is pressed the person is redirected to a language page. The language page then changes their languages and returns them to the previous page. I thought that what I did was awesome and so simple. <?php session_start(); $_SESSION['language'] = 'Eng'; $back = $_SERVER['HTTP_REFERER']; header("Location: $back"); ?> In Firefox it works, in Internet Explorer it redirects the user to the flash header, not the webpage which they came from. Check it out. http://www.jasonstanleydesign.co.uk/showcase/site/
  6. Could you tell me what the '.' and '..' that are returned in the array?
  7. I am looking for a short explanation or perhaps a link to a good place to begin. Many CMS are using a module system where you upload a folder and these modules automatically display on a file. What do I need to use to find folders and files in another folder? To read the files would I need to include them in my script or is there some way to read the file another way?
  8. Thanks a lot, i'll give this a go.
  9. How can I list the tables in a database and store them in a $key -> tablename array?
  10. Perad

    paypal

    And the question is what?
  11. This is X <products_description> <products_id>1537</products_id> <language_id>2</language_id> <products_name></products_name> <products_description></products_description> <products_category></products_category> <products_material>Shell</products_material> <products_region>Papua New Guinea, PNG</products_region> <products_dimensions>C. 5 x 2 1/2 inches</products_dimensions> <products_tribal_group></products_tribal_group> <products_url></products_url> <products_viewed>6</products_viewed> </products_description> This is y ('<products_id> Value', 3, '<products_region> Value'), I have to do this several times so understanding how to do this will be very helpful indeed
  12. $this->str = preg_replace('watch?v=', 'v/', $this->str); I want to replace any instance of 'watch?v=' with 'v/'. I have tinkered with various slashes but I cannot get this to work. Can someone help me get this working please.
  13. Sorry for being unclear, I mean, later on in the script how would I add another value?
  14. $blah = array ('blah' => 'blah'); How do I add another entry to this array?
  15. What I want to do is allow users on my website to upload images. The problem is that large images will break my website and look terrible. As a result I want to limit the the size of the images. I already know how to do this. The problem I am having is working out how I can actually insert this code. Currently I am using an array which is then shipped off into a preg_match statement as follows. $this->MatchReplace = array ( '/\[img\](.*?)\[\/img\]/is' => '<img src="$1" />', // Image ); foreach($this->MatchReplace as $key => $val) { $this->str = preg_replace ($key, $val, $this->str); } I need to change this to allow me to run the following fuction. public function imageResize($url, $maxwidth, $maxheight) { $fetch = getimagesize($url); $width = $fetch[0]; $height = $fetch[1]; if ($width > $maxwidth || $height > $maxheight) { if ($width > $height) { $percentage = ($maxwidth / $width); } else { $percentage = ($maxheight / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); //returns the new sizes in html image tag format...this is so you $this->imageDimensions = "width=\"$width\" height=\"$height\""; } } Would I need to use preg_match to do this? If so could someone demonstrate how this would be done?
  16. Thanks a lot I will give it a go.
  17. How do you detect a new line in an input box and wrap the content in paragraph tags?
  18. It is helpful to find where one file is in relation to another.
  19. That doesn't do anything. I can view the php.ini file. Can I override this? display_errors = Off
  20. My client has error checking off and no access to the logs. He doesn't have permission to change the php.ini. I need to work out what is going on with a script I am trying to upload. Is there some function in php that can switch full error checking on for this script only?
  21. Is there anyway I can make this loop stop searching for something once it has found its value? for($i=0; $i < count($validpages); $i++) { if ($_GET['page'] == $validpages[$i]) { $page = $validpages[$i]; } }
  22. Thanks for the help. In the end I uninstalled XAMPP and restarted and reinstalled it.
  23. How would I resolve this problem. I just updated my OS
  24. Warning: session_start() [function.session-start]: open(/var/folders/mH/mHXoxuzxE0yqfx22D7YRD++++TI/-Tmp-//sess_090eb824927d276bf53153f40d2aeb90, O_RDWR) failed: Permission denied (13) in /Applications/xampp/xamppfiles/htdocs/JasonHome/index.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /Applications/xampp/xamppfiles/htdocs/JasonHome/index.php:2) in /Applications/xampp/xamppfiles/htdocs/JasonHome/index.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Applications/xampp/xamppfiles/htdocs/JasonHome/index.php:2) in /Applications/xampp/xamppfiles/htdocs/JasonHome/index.php on line 2
×
×
  • 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.