Jump to content

seojunkie

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

seojunkie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Great. That seems to have done it. I appreciate everyone's help.
  2. No, that won't work. The types will vary with products. So product A might have one of the types, product B two of the types and so on. Besides, there would be no way to reference back to the product name using that method. I did try replacing my while loop with a foreach statement but it didn't work right. All of the products were not displayed. But that may have been due to me using the code incorrectly. Here is what I tried:[code]foreach (($arr = tep_db_fetch_array($products_query)) as $value) {         if (strpos($value , $type[$i]) === FALSE)         {           echo 'Add '.$type[$i] . ' to ' .$value .'<br>';         } } [/code]
  3. I tried making the change[code]for($i = 0; $i < count($type)-1; $i++)[/code]but it didn't fix it. Unless I'm missing something, that change would only limit how many types are checked. But since it never reaches the end anyway, it has no effect on the code.
  4. I tried adding reset($products); at the end of the for loop and the message it gives is[quote]Warning: reset(): Passed variable is not an array or object in[/quote]
  5. My database has a table of products with similar names except for the numeric end. So the products might look like: prod1-30 prod1-36 prod2-24 prod2-30 I need to have all of the products have all of the proper endings. If one doesn't exist, I need to add it to the database so that it ends up looking like this: prod1-24 prod1-30 prod1-36 prod2-24 prod2-30 prod2-36 To do this, I came up with this code to find the missing products: [code] $products_query = mysql_query("SELECT ..."         $type = array();     $type[] = "-20";     $type[] = "-20";     $type[] = "-36";          for ($i = 0; $i < count($type); ++$i)     {       while ($products = mysql_fetch_array($products_query))        {         if (strpos($products['products_model'], $type[$i]) === FALSE)         {           echo 'Add '.$type[$i] . ' to ' .$products['products_model'].'<br>';         }        }      } [/code] This will work on the first pass but when it goes back to check the next "type," the code gets skipped. I thought it has something to do with the array pointer but using reset($products_query) results in an invalid argument error. Would someone please point out my mistake? Is there a better way to code what I need to do?
  6. The following is the relevant code, I think. $conditions = sprintf("<li class=\"first\">%s(.*)</li>", $tmpurl); $file = fopen($filename, "r"); if ($file) { while (!feof($file)) {   $var = fgets($file, 1024);     if (eregi($conditions,$var,$out)) After the above, $out should contain the found entries but doesn't.
  7. I'm trying to write a script that will read in a search page from msn and find the index position of a given site. The code works except for one condition of the search. MSN lists the results in two ways: - If the searched for phase is in the domain name, then the parts of the url containing the search phase is enclosed in <strong> tags.  So if I did a search for the word cars and my url was www.bestcars.com, the code on MSN would appear as <li class="first">www.best<strong>cars</strong>.com</li> - if the searched for phase is not in the url, say ties, then the result appears as <li class="first">www.bestcars.com</li> The problem is with the second type. Sometimes the found url will contain something after the .com, like: <li class="first">www.bestcars.com/index.php?cPath=35</li> I have tried an expresion like this to find that but I can't get it to work: <li class="first">www.bestcars.com(.*)</li> I also tried <li class="first">www.bestcars.com^(.*)$</li> Does anyone have any idea on what is needed to get this to work. I would appreciate any suggestions.
×
×
  • 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.