Jump to content

brooksh

Members
  • Posts

    139
  • Joined

  • Last visited

Everything posted by brooksh

  1. Here is my code, but it misses a lot of searches just by missing a word, or it pulls too many invalid search results. Any ideas how to make it better? Here is what I have: $sql = "select * from questions where (Question LIKE '%$quest_search%' OR Answer LIKE '%$quest_search%') AND (active='yes')"; $result = mysql_query ($sql); $count = mysql_num_rows( $result ); if($count == "0"){ $sql = "SELECT * FROM questions WHERE MATCH(Question,Answer) AGAINST ('$quest_search' IN BOOLEAN MODE) AND (active='yes')"; }
  2. There are several URL's in the page that include $id in them. The one I need does not have any special tags, just a long URL that I can't seem to get because of special characters. I'm using a wildcard, but it take it. Can i get any help? URL: <a href="http://thewebsite.com/?bhtid=8774&sdop=1&amp" rel="nofollow" target="_blank"> foreach ( $page->find("a[href*=$id&amp]") as $url){ //doesn't work
  3. Is there a better way? All I need is when a visitor visits a certain page and clicks on agree, it remembers it in a cookie and they won't have to click on the link again. But I want them to click agree on multiple pages. page1.php (agree yes then display page) page2.php (not agree, don't display page)
  4. I want to show and hide all of them at once no matter which button I click on. I'm sure there is an easy way, but I don't know javascript. <script type="text/javascript"> function showDiv() { document.getElementById('welcomeDiv').style.display = "block"; } function showDiv2() { document.getElementById('welcomeDiv2').style.display = "none"; } </script> <div id="welcomeDiv" style="display:none;" class="answer_list" > WELCOME</div> <div id="welcomeDiv2" style="display:block;" class="answer_list" > <input type="button" name="answer" value="Show Div" onclick="showDiv();showDiv2();" /></div> <div id="welcomeDiv" style="display:none;" class="answer_list" > WELCOME2</div> <div id="welcomeDiv2" style="display:block;" class="answer_list" > <input type="button" name="answer" value="Show Div" onclick="showDiv();showDiv2();" /></div> <div id="welcomeDiv" style="display:none;" class="answer_list" > WELCOME3</div> <div id="welcomeDiv2" style="display:block;" class="answer_list" > <input type="button" name="answer" value="Show Div" onclick="showDiv();showDiv2();" /></div>
  5. I'm trying to set dynamic cookies. Why isn't it working? Here is my code. setcookie('mycookie[$id]',$id, time()+3600*24); Then to call it I use $_COOKIE['mycookie']['$id']
  6. <a href="redirect.php?34344" target="_blank" onClick="window.opener.location.reload();">
  7. This opens a new window and opens the url in parent page. I just want to refresh parent, and open new window at the same time. <a href="redirect.php?=34344" onclick="window.location.reload(); window.open(this.href,'popupwindow');" >
  8. I had <input type="text" value="<?=$row[description]?>" name="description"> instead of <input type="text" value="<?=$row[description]?>" name="description[]">
  9. When I submit my form, it limits the update to 1 character. For example if I put "Description" as the description, it inserts "d" in the database. What is wrong with my code? $size = count($_POST['checkbox']); // start a loop in order to update each record $i = 0; while ($i < $size) { // define each variable $title2= $_POST['title'][$i]; $description2= $description[$i]; $edit= $_POST['checkbox'][$i]; mysql_query("UPDATE `categories` SET `title`='$title2',`description`='$description2' WHERE id ='$edit'"); ++$i; }
  10. <body onload="parent.jQuery.prettyPhoto.close(); parent.location.href=parent.location.href;">
  11. I'm using pretty photo. I want to refresh the parent page when I close the modal window which is an iframe. This script closes the modal, but does not refresh the parent frame. <a href="#" onclick="window.parent.jQuery.prettyPhoto.close();">Close</a>
  12. Thanks, that solved it. For some reason my posted password had a space in it.
  13. If I set my password in the script it works, but if I submit the password in a form it doesn't. When echoing the password, both show the same thing. The login_pass2 encrypts correctly, but the login_pass does not. I've also tried doing $login_pass = "$_POST[login_password]"; but it doesn't work. Can anyone figure out why this isn't working? $login_pass = $_POST['login_password']; //posted = pass1234 $login_pass2 = "pass1234"; echo "$login_pass and $login_pass2";// shows pass1234 and pass1234 $encrypted_pass = data_encrypt($login_pass,$key); $encrypted_pass2 = data_encrypt($login_pass2,$key); echo "$encrypted_pass and $encrypted_pass2"; // shows 9lf8xG573pp+8DkhzK/Bu7GPFQQzg40mZZEGIF9Qg7c= and Ex20uB9BVZgqOqjjEu5hDXN+JQu0b4qPn15CXsKOlls=
  14. If the number 12 is found within the array, I want it to echo yes.
  15. I'm sure this is possible, but I'm not having any luck. $array = array("11:23", "12:46", "13:34", "14:34", "14:85"); if (in_array('12', $array)) { echo "yes"; } else { echo "no"; }}
  16. $data = preg_match("/data=(.*)&/", $data, $matches);
  17. $array[0] = page=1&data=1:21;2:34 How can I get rid of the page=1&data=
  18. How can I split this data and then remove it? I need to split data by ; then split each one of those. $data = "page=1&data=1:21;2:34;5:57&a=yes"; So I will get: $category[0] = 1; $sub_category[0] = 21; $category[1] = 2; $sub_category[1] = 34; $category[2] = 5; $sub_category[2] = 57;
  19. $i = "0"; foreach($xml->RelatedAttributes->Attribute as $attribute){ echo $attribute->name; //main Attribute Name foreach($xml->RelatedAttributes->Attribute[$i]->AttributeValues->AttributeValue as $attribute_values){ echo $attribute_values->name; //subtopic for main Attribute } $i++; }
  20. I'm trying to grab the data for several products, then list the attributes for each product. I'm ending up with the same attributes from Attribute id="259". Can anyone fix my problem? XML example <RelatedAttributes> <Attribute id="259"> <name>Brand</name> <AttributeValues> <AttributeValue id="258888"> <name>HON</name> </AttributeValue> <AttributeValue id="276682"> <name>Office Star</name> </AttributeValue> <Attribute id="296935"> <name>Stores</name> <AttributeValues> <AttributeValue id="18893"> <name>Test</name> </AttributeValue> </AttributeValues> </Attribute> </RelatedAttributes> php Code foreach($xml->RelatedAttributes->Attribute as $attribute){ echo $attribute->name; //main Attribute Name foreach($xml->RelatedAttributes->Attribute->AttributeValues->AttributeValue as $attribute_values){ echo $attribute_values->name; //subtopic for main Attribute }}
  21. foreach($xml->category->subcategory as $category){ $filter_categoryid[] = trim($category['categoryId']); }//end foreach $filter_categoryid = array_unique($filter_categoryid);
  22. I'm pulling data from an xml file and I'm getting a lot of duplicates. How can I remove the duplicates from the query? foreach($xml->category->subcategory as $category){ echo $category[id]; }//end foreach
  23. Could you please give me an example array instead of the random array? I don't know too much. I know this isn't correct, but I'm just trying to figure this script out. $imax = array(Category:subcategory:subcategory,Category2:subcategory:subcategory) // Generate some random data for( $i=0,$imax=rand(15,30); $i < $imax; $i++ ) { $data[$i] = array('Category '.($i+1),array()); for( $j=0,$jmax=rand(0,10); $j < $jmax; $j++ ) $data[$i][1][$j] = 'Subcategory '.($j+1); }
  24. Your script looks like it can work, I just don't know how to implement it with my query. To grab the main category: SELECT DISTINCT category_name,category_id FROM db WHERE parent_id ='0' Order By category_name Then grab the subcategory: SELECT DISTINCT category_name,category_id FROM db WHERE parent_id = '$category_id' Order By category_name
×
×
  • 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.