Jump to content

OldWest

Members
  • Posts

    296
  • Joined

  • Last visited

    Never

Everything posted by OldWest

  1. And php is plentiful with zip tools: http://www.php.net/manual/en/function.ziparchive-open.php
  2. You can use preg_match() to read the file names in the dir to look for .zip.
  3. There is a system control for WAMP in your task bar, click on that and you can edit the .ini direct.. You will need to restart your services when done.
  4. PFMaBiSmAd, I'm sorry for wasting your time. You're right. I've been on the pc for 10 hours straight like mud mind right now.. But that's for the refresher. It's working now. All I needed to do was remove the foreach(). $queryCats = "SELECT id, cateName FROM ads_cate"; $resultCats = mysql_query($queryCats); while ($category = mysql_fetch_array($resultCats, MYSQL_ASSOC)) { echo '<a href="'."/search_list.php?type=items&keyword=&cate=".$category['id'].'">' . $category['cateName'] . '</a><br />';
  5. I only want to echo the category name. not the added id number links.. But the id needs to be in the url as I have it.. The links work fine, i just need to get rid of the extra id link loop
  6. My code IS working, but there is a problem. I am only trying to echo the link and category name, but I am getting two urls which I cannot resolve. Some hours into this now and frustrated, so any tips are welcome: For some reason the id is also echoing a full url why? Current code: <?php $queryCats = "select id, cateName from ads_cate"; $resultCats = mysql_query($queryCats); while ($category = mysql_fetch_array($resultCats, MYSQL_ASSOC)) { foreach ($category as $cat_name) { echo '<a href=' . "search_list.php?type=items&keyword=&cate=" . $category['id'] . ">" . $cat_name . '</a><br />'; } } ?> Current Output????? <a href=search_list.php?type=items&keyword=&cate=1>1</a> <a href=search_list.php?type=items&keyword=&cate=1>Appliances</a> <a href=search_list.php?type=items&keyword=&cate=2>2</a> <a href=search_list.php?type=items&keyword=&cate=2>Automobiles / Trucks</a> .... WHy is the id also echoing? I am not printing it to the url???
  7. I think I might have misunderstood your original post! Sorry about that if so.. Hope my code was helpful in any way.
  8. what doctype are you defining your page as? And you should really decide if you want to use HTML or xhtml because right now your code is mixed up.. That's where I would start. Good luck!
  9. You're welcome ; ) <html> <head> </head> </body> <form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>"> <table> <tr><td>Name:<input type="text" name="name" size="10"></td></tr> <tr><td>Say what you want: <input type="text" name="you_typed" size="50"></td></tr> <tr><td><input type="submit" name="submit" value="Give me the data!"></td></tr> </table> </form> </body> </html> <?php class echoIt { var $name; var $you_typed; function passed($arg1, $arg2) { $this->name = $arg1; $this->you_typed = $arg2; } } $your_name = $_POST['name']; $what_you_typed = $_POST['you_typed']; $output = new echoIt(); $output->passed($your_name, $what_you_typed); echo "Your name is " . $output->name . " and you typed: " . $output->you_typed . "."; ?>
  10. Why do you need to do it this way? Just curious?
  11. Is your database connection working OK? Yeah you really need to post the error message up here.
  12. if i understand what you are trying to do correct, php has several function shat can get the ip address like $_SERVER['REMOTE_ADDR']; .. and you can just bypass the login credentials and start your session for the user with their ip address as the credentials... hope this helps
  13. construct was spelled wrong and you only had one underscore on __construct (needs two)
  14. My bad!! Ignore my earlier post.. is this what you are trying to do? RUN my code to see the output.. <?php $string=' de s pres div de d an Agt '; //DEFINE PATTERN $patterns = array(); $patterns[0] = '/ s /'; $patterns[1] = '/ b /'; $patterns[2] = '/ pres /'; $patterns[3] = '/ Ind /'; $patterns[4] = '/ Mar /'; $patterns[5] = '/ Agt /'; $patterns[6] = '/ Agy /'; $patterns[7] = '/ Indpls /'; $patterns[8] = '/ Chgo /'; $patterns[9] = '/ Corp /'; $patterns[10] = '/ U /'; $patterns[11] = '/ Fin /'; $patterns[12] = '/ ls /'; $patterns[13] = '/ Pres /'; $patterns[14] = '/ Internat /'; $patterns[15] = '/ m /'; $patterns[16] = '/ N Y C /'; $patterns[17] = '/ div /'; $patterns[18] = '/ de /'; $patterns[19] = '/ d /'; //DEFINE PATTERN REPLACE $replacements = array(); $replacements[0] = ' son of '; $replacements[1] = ' born in '; $replacements[2] = ' president '; $replacements[3] = ' Indiana '; $replacements[4] = ' March '; $replacements[5] = ' Agent '; $replacements[6] = ' Agency '; $replacements[7] = ' Indianapolis '; $replacements[8] = ' Chicago '; $replacements[9] = ' Corporation '; $replacements[10] = ' U '; $replacements[11] = ' Financial '; $replacements[12] = ' Island '; $replacements[13] = ' President '; $replacements[14] = ' International '; $replacements[15] = ' married to '; $replacements[16] = ' New York City '; $replacements[17] = ' divorced '; $replacements[18] = ' de '; $replacements[19] = ' daughter of '; echo '------ Original ---------<br>'.$string.'<br>'; $data = preg_replace($patterns, $replacements, $string); echo '<br>------ Abbreviation Replace ---------<br>'.$data.'<br>'; ?>
  15. Yeah you're right. This works: <?php $string='de d s pres div de de d s'; //DEFINE PATTERN $patterns = array(); $patterns[0] = '/ s\. /'; $patterns[1] = '/ b\. /'; $patterns[2] = '/ pres\./'; $patterns[3] = '/ Ind\./'; $patterns[4] = '/ Mar\./'; $patterns[5] = '/ Agt\./'; $patterns[6] = '/ Agy\./'; $patterns[7] = '/ Indpls\./'; $patterns[8] = '/ Chgo\./'; $patterns[9] = '/ Corp\./'; $patterns[10] = '/ U\./'; $patterns[11] = '/ Fin\./'; $patterns[12] = '/ ls\./'; $patterns[13] = '/ Pres\. /'; $patterns[14] = '/ Internat\. /'; $patterns[15] = '/ m\. /'; $patterns[16] = '/ N\.Y\.C\./'; $patterns[17] = '/ div\. /'; $patterns[18] = '/ de /'; $patterns[19] = '/ d\. /'; //DEFINE PATTERN REPLACE $replacements = array(); $replacements[0] = ' son of '; $replacements[1] = ' born in '; $replacements[2] = ' president'; $replacements[3] = ' Indiana '; $replacements[4] = ' March '; $replacements[5] = ' Agent '; $replacements[6] = ' Agency '; $replacements[7] = ' Indianapolis '; $replacements[8] = ' Chicago'; $replacements[9] = ' Corporation '; $replacements[10] = ' U '; $replacements[11] = ' Financial '; $replacements[12] = ' Island'; $replacements[13] = ' President '; $replacements[14] = ' International '; $replacements[15] = ' married to '; $replacements[16] = ' New York City '; $replacements[17] = ' divorced'; $replacements[18] = ' de '; $replacements[19] = ' daughter of '; echo '------ Original ---------<br>'.$string.'<br>'; $data = preg_replace($patterns, $replacements, $string); echo '<br>------ Abbreviation Replace ---------<br>'.$data.'<br>'; ?>
  16. is your table really named "table"?
  17. You might be able to use the php DOM Parser extension.. You can extract all img tags and grap the url and contents like so... Not sure if it will work with your RSS, but you might want to look into it.
  18. make sure your apache service is started when you do your testing.
  19. SOLVED: for($i=0; $i < 50; $i++) { echo date('D, F jS, Y', strtotime("+$i days")) . "<br />"; }
  20. I am doing some study on using time() and date() and i just wrote this simple for loop to add one day to each iteration with +$i and its echoing the unix timestamp as opposed to the correctly formated date as it should be based on my code. Anyone have any idea why this is not working as expected? for($i=0; $i < 50; $i++) { echo $time = time()+$i . "<br />"; // add a day on each iteration echo date('y-m-d', $time) . "<br />"; // should echo 10-12-02, 10-12-03, 10-12-04, etc.. } what am i doing wrong here? arrgggg! maybe its too late for this s$%^#!
  21. I am just curious on some recommendations for the best format to store time in a table for later date comparison. I was thinking time() is probably the best method as it store in epoch seconds I believe, and that can be formatted with date() easily, but I also heard this is not always accurate. Please tell me any recommendations on this! And suggestions or ideas on this?
  22. Ok I was able to get it to work, but I am not sure why the output is showing in negatives. I did this and it seems to work as expected now. Is there a smarter or better way to do this to ensure the time count is exact and accurate? $ad_start = time()-14 . "<br />"; echo $ad_start; $current_time = time() . "<br />"; echo $current_time; $days_past = $ad_start - $current_time; echo "<br />$days_past days have past since the ad started!<br />"; if($days_past >= -14) { echo "<br />Ad is less than 14 days. Not expired."; } else { echo "<br />Ad is over 14 days. Expired."; }
  23. I am trying to simulate an ad expiration and carry out an action if the ad is expired. And I cannot get the if/else to work properly... I've tried many variations and I cannot see what I am doing wrong here. Any tips please 3 hours and counting of no solution! $ad_start = time()-14 . "<br />"; // 14 days from today in the past (negative) echo $ad_start; $current_time = time() . "<br />"; // current epoch time echo $current_time; $days_past = $ad_start - $current_time; // days past echo "<br />$days_past days have past since the ad started!<br />"; if($days_past <= 14) { echo "<br />Ad is less than 14 days. Not expired."; } else { echo "<br />Ad is over 14 days. Expired."; }
×
×
  • 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.