Jump to content

edawg

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by edawg

  1. Dont know if this will help any, but here is the function that displays the categories. function renderCustomCategories(){ $out = ''; if (sizeOf($this->categories) > 0) { $out .= '<h3>Popular categories</h3>'; $out .= '<ul>'; foreach ($this->categories as $category) { $out .= '<li>'.$this->customCategoryLink($category).'</li>'; } $out .= '</ul>'; } return $out; }
  2. Thanks! BaseURL function. function baseURL($paramNamesToStrip) { $url = $this->requestURI(); foreach ($_REQUEST as $key => $value) { foreach ($paramNamesToStrip as $paramName) { $url = $this->stripParameter($url,$paramName,$key,$value); } } return $url; } AddParameter Function. function addParameter($url,$paramName,$paramValue) { if (strlen($paramValue) > 0) { $delimiter = (strpos($url,'?') > -1) ? '&' : '?'; $url = $url.$delimiter.$this->nameSpace.$paramName.'='.urlencode($paramValue); } return $url; }
  3. I use Popshops Datafeed API and cant figure out an issue im having with an array. I'm trying to retrieve a category name from an array for the current page. Here is the array code which is in the index.php file. $categories = array(); $categories[] = array( 'name' => 'page name', 'search_options' => array( 'keywords' => 'page keyword' ) ); $categories[] = array( 'name' => 'page name', 'search_options' => array( 'keywords' => 'page keyword' ) ); $categories[] = array( 'name' => 'page name', 'search_options' => array( 'keywords' => 'page keyword' ) ); This is how the script calls the current page keyword. <?php echo ucwords($_REQUEST[$popshops->nameSpace.'keywords']) ?> The code above works fine, so I thought all I had to do was change the 'keywords' to 'name' to get what I was looking for. But that does not seem to work? <?php echo ucwords($_REQUEST[$popshops->nameSpace.'name']) ?> I've tried as much as my limited php knowledge can take me, so now I need some advice. Here is the function in the popshops.php file they use to pull the page name out for the links in the navigation, but I just want to know how to retrieve just the category name for the current page, nothing else. function customCategoryLink($category) { $url = $this->baseURL($this->params); if (isset($category['search_options']) && sizeOf($category['search_options']) > 0) { foreach($category['search_options'] as $key => $value) { $url = $this->addParameter($url,$key,$value); } } else { $url = $this->addParameter($url,'keywords',$category['name']); } $url = str_replace('?&','?',$url); return '<a href="'.$url.'">'.$category['name'].'</a>'; } Thanks in advanced!
  4. WILDBUG YOU ARE THE MAN!!!!!!!!!!!!!!!!!!!!. thanks a million mate!.
  5. hi, how can I clear rows from a table field?. I have a table set up, and what I want to do is count some votes, but once a week I want to clear all the votes to have them return to zero, so that way I can count fresh results for the new week?.
  6. Ive seen tutorials on this subjet, but just cant get them to work on my site?.
  7. I have a limit line there tho?.
  8. Im trying to paginate some db results, the problem is, I have categories of pictures with 56 pics in total, now when I try to paginate these results in there own category, rather than get the category pics only to display over a few pages, I get the entire picture db displayed instead. What happens is when I click category "Animals", instead of the 11 pics in that table, I get 6 pics, which is fine as its my Max_Results_Per_Page, but the next page links at the bottom will display all the pictures in the db rather than the ones i need. $display = 6; // rows of results per page if (isset($_GET['np'])) { // if num of pages isset then assign the VAR $num_pages = $_GET['np']; // here its assigned from above. } // Determine where in the database to start returnind results. if (isset($_GET['s'])) { $start = $_GET['s']; } else { $start = 0; } // Get the users input choice $varCategory = $_GET['cpCategory']; $signs = array("-", "_"); $varCriteria = str_replace($signs, " ", safe_output($_GET['txtSearch'])); // Make the QUERY`s mysql_select_db($database, $connDB); $query_rsResults = "SELECT site_categories.sc_id, site_categories.sc_title, site_categories.sc_keywords, site_categories.sc_description, site_categories.sc_url, site_pictures.sp_id, site_pictures.sc_id, site_pictures.sp_title, site_pictures.sp_description, site_pictures.sp_location, site_pictures.sp_filename_TN, site_pictures.sp_filename, site_pictures.sp_sender, site_pictures.sp_votes FROM site_categories, site_pictures WHERE site_categories.sc_id = site_pictures.sc_id"; // IF Category Search if ($varCategory!="") { $query_rsResults.= " AND (site_categories.sc_url = '$varCategory')"; } // IF Critera Search if ($varCriteria!="") { $query_rsResults.= " AND (site_pictures.sp_description LIKE '%" . $varCriteria . "%' OR site_pictures.sp_title LIKE '%" . $varCriteria . "%' OR site_pictures.sp_ALT LIKE '%" . $varCriteria . "%' OR site_pictures.sp_location LIKE '%" . $varCriteria . "%' OR site_pictures.sp_category LIKE '%" . $varCriteria . "%' OR site_pictures.sp_filename LIKE '%" . $varCriteria . "%' OR site_pictures.sp_filename_TN LIKE '%" . $varCriteria . "%')"; } $query_limit_rsResults = sprintf("%s LIMIT %d, %d", $query_rsResults, $start, $display); $rsResults = mysql_query($query_limit_rsResults, $connDB) or die (mysql_error()); // run the above query $row_rsResults = mysql_fetch_assoc($rsResults); // fetch back as an array of results. $num = mysql_num_rows($rsResults); if ($num > $display) { // more than one page $num_pages = ceil($num_pag/$display); } else { $num_pages = 1; } What am I doing wrong???.
  9. Is it possilbe to update more than one table at a time using the same UPDATE command???, or do I have to use 2 seperate UPDATE queries?.
  10. Hello, Ive been using cakephp for 2 days now, and am having problems with tutorials, the manual is ok, but is there another really good tutorial to get me started the right way??. What are your views on cakePHP, should I bother with it???, is there anything else, apart from ruby?. Thanks
  11. Hi All! If my site is using cookies and sessions for the logged in users, should I also use them for any users that do not sign up, or log-in?, ive noticed php freaks uses guest if you are not a member, is this common practice?, is it more secure?. Thanks to anyone that replies...
  12. So you would setcookie() and start session with the same user info variables when they log-in??. And for any regular un-registered user, is it a good idea to set them a cookie or session too??.
  13. Hi, What I want to do is make a website im working on more user friendly, so ive completed the registration and login side to the site, but i need advice on what to use from here?, im using sessions at the moment while the user is logged in, but some people say there not to secure?, then I see things about HTTP authorization?, and also cookies?, im confused........ My question is, what is the most secure and reliable thing to use as users login, and go about the website?, what do most of you use?. Thanks for all your help!.
  14. thanks for all your help, will work on it over the next few days!!
  15. What I want to do is have a chunk of my code for my website only be accessed once a week on a set day. its basically a poll, that I want to find the highest rating for, but not all the time, I want for it to be once a week..... Any ideas??. thanks
  16. it may be because your line--> elseif (strlen($_POST)) is also false??, ive had this happen to me, but cant quite remember how I got around it?, maybe try else insted of elseif`s???.
  17. This is what ive used.. if (!empty($_POST['picemail'])) { $emails() = $_POST['picemail']; foreach ($emails as $value) { echo $value; } ive also tried... if (!empty($_POST['picemail[]'])) { $emails = $_POST['picemail[]']; foreach ($emails as $value) { echo $value; } Also, is there a way I can use a function on an array???.
  18. Im trying to build a form using php and mysql, the thing i want to do is have people refer my site to others via email, ive made 6 text boxs like so.. <div class="registration_line">Friends Email: <input type="text" name="picemail1" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail2" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail3" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail4" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail5" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail6" size="30" maxlength="25" /></div><br /> What i want to do is be able to cut down on the code and make name="picemail1" into an array somehow, this is my problem, im not to sure how to implement this, and then call it up in the handle page, ive been using... <div class="registration_line">Friends Email: <input type="text" name="picemail[]" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail[]" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail[]" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail[]" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail[]" size="30" maxlength="25" /></div><br /> <div class="registration_line">Friends Email: <input type="text" name="picemail[]" size="30" maxlength="25" /></div><br /> name="picemail[]" , but when using a foreach loop, i do not get a return??. what can I use??.
  19. Im working on a php and mysql voting script, I would like to be able to let people vote on items only one time for each single item, but then still be able to vote on the other items once if they want to?. What would be the best way to make this possible?.
  20. Try this.... $sql_titles = "SELECT * FROM `wp_posts` LIMIT 0, 3"; $titles = mysql_query($sql_titles); $realtitles = mysql_fetch_object($titles); echo $realtitles;
  21. Hi, Relatively new to PHP, and have a question in regard to a new site im working on.... Q). Is it possible to pass a variable, or a string into another site from my own?. What I have is a database of locations of places and other things, so what I would like to do is enable a visitor to click on the location, and be taken to that location say in Google Maps, or a similar map site, but rather than get there and have to paste the location in the search bar, can I do this for them, so when they get to the map, they will be greeted with the location right on that map?? Can this be done?. Thanks!!
  22. Still the same kind of problem, even when I use the joins??
  23. Hi, I have 2 databases that I want to select from, the first database is the categories one which holds 29 results, and contains an id, title, url, text field ect ect....... the other database is pictures, which contains its own id, an associated id for the categories database, and it holds is own title, picture filename, and description field, my problem is, when I SELECT * FROM categories, pictures , it gives me all the results in order from 1 - 29 of the categories database, but the pictures database seems to only list the first row of that database repeated until the category database gets to 29, then the pictures database list result number 2, 29 times then 3, 29 times and so on?. what can I do to get them to list each result separately without repeating??. I'm trying to build my own php site search, so the problem is when I get a enter a search term, I get 29 results of the same term!!! . Ive tried to use SELECT database.table FROM database to limit the results too, but the same problem arises?. please help:). thanks!
×
×
  • 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.