Jump to content

CosminStan

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by CosminStan

  1. Hello, I have a little problem. This is what I want to achive: I have 2 mysql tables (categories, channels), the channel table has a cat_id in it. I want to update/edit a product and place it in another category but the code that I've made shows just one catedory (id=1) even if the product has a parent id of 5. try { //prepare query $query = "select channel_id, name, category_id from channels where channel_id = ? limit 0,1"; $stmt = $pdo->prepare( $query ); //this is the first question mark $stmt->bindParam(1, $_REQUEST['id']); //execute our query $stmt->execute(); //store retrieved row to a variable $row = $stmt->fetch(PDO::FETCH_ASSOC); //values to fill up our form $channel_id = $row['channel_id']; $name = $row['name']; $category_id = $row['category_id']; }catch(PDOException $exception){ //to handle error echo "Error: " . $exception->getMessage(); } $query2 = "SELECT * FROM categories"; $stmt2 = $pdo->prepare( $query2 ); $stmt2->execute(); $results = $stmt2->fetchAll(PDO::FETCH_ASSOC); ?> <!--we have our html form here where new user information will be entered--> <form action='#' method='post' border='0'> <table> <tr> <td>Channel Name</td> <td><input type='text' name='name' value='<?php echo $name; ?>' /></td> </tr> <tr> <td>Category</td> <td> <?php foreach($results as $rows) {?> <select name="fileselect"> <option name='cat_id' value=" <?php echo $rows['category_id']; ?>"> <?php echo $rows['name']; ?></option> <!-- <input type='text' name='category_id' value='<?php //echo $category_id; ?>' /> --> <?php } ?> </select> </td> </tr> <tr> <td></td> <td> <!-- so that we could identify what record is to be updated --> <input type='hidden' name='channel_id' value='<?php echo $channel_id ?>' /> <!-- we will set the action to edit --> <input type='hidden' name='action' value='update' /> <input type='submit' value='Edit' /> </td> </tr> </table> </form> The update parte is ommited as it works if there is no dropdown, just a plain text input.
  2. Hello guys, I'm building a website for tablets and i want o add the ability for the user to swipe down to another div. I've found some jquery plugins for this but only for left/right, and from some blogs that jquery doesn't support this ? Is that true and how can i overcome this ? I don't know javascript/jquery and i'd like some help.
  3. Hello guys, I have a wordpress website wich supplies download links. What i want to do: When a user clicks o a download link (external sources) i want to redirect him to the same page (iframe) but i want to put some ads on top of the window. How can i do that ?
  4. So.. i want to make and online TV Show website using wordpress but can't fugure how to do it. The shows will be embeded from various websites (youtube, vimeo). 1. In general TV Shows have multiple seasons and i want the links to be like friends/season-1/episode-2 is there a plugin for this ? 2. When you enter on a tv show (/friends/) you need to select the season (/friends/season-2/) and then the episode (/friends/season-2/episode-1) I know that i have to modify the "category.php" but i have 2 categories, right ?
  5. Forgot to put Review in the title, sorry
  6. Hello guys, just finished my website, it's not in english yet. But i want to ask you about the design.. i tried to do it with css to load faster. Should i do the header like the footer with borders or.. http://icehd.net
  7. Thanks PFMaBiSmAd, but how can i do that ? @Barand is it ok to use as UNIQUE a varchar(250) ? how would thw server react to this ? Thanks.
  8. This is your answer to my problem Thank you very much, you could let the other topic unlocked an lock this one cause this is not a solution to way for something.
  9. Hello guys, i have a problem foreach($liga1 as $item) { $titlu = $item->get_title(); $link = $item->get_permalink(); $text = $item->get_description(); $data = $item->get_date('j M Y, g:i a'); $titlu = mysql_real_escape_string($titlu); $link = mysql_real_escape_string($link); $text = mysql_real_escape_string($text); $con = mysql_connect($dbhost, $dbuser, $dbpass); if (!$con) { die(mysql_error()); } mysql_select_db($dbname, $con); $sql = "REPLACE INTO stiri (id, titlu, continut, link, categorie, data) VALUES ('','$titlu','$text','$link','Liga 1','$data')"; mysql_query($sql); mysql_close($con);} So.. every time i run this script i get duplicate items in my db.. i tried with md5 but i get a timeout error, i set the limit but the tables aren't update.
  10. I've tried insert and insert ignore with the same result
  11. the id is primary, but unique i want to put link (url) but it's big like 126-135 chars...
  12. i saw them in phpmyadmin..
  13. Heloo guys i have a problem wit a script $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'root'; $dbname = 'site'; $con = mysql_connect($dbhost, $dbuser, $dbpass); if (!$con) { die(mysql_error()); } mysql_select_db($dbname, $con); $sql = "REPLACE INTO stiri (id, titlu, continut, link, categorie, data) VALUES ('','$titlu','$text','$link','Liga 1','$data')"; mysql_query($sql); mysql_close($con); This part is in a php foreach part and every time i run the script i get duplicate entrie, how can i solve this. Thx!
  14. Thanks guys, as i said i do not know anything about cookies or sessions, so i can't explain in more details ) soryy But thanks @Christian F for this quick intro, ho to solve this problem. I don't need any out goid links, just the ones that the user click on my website to be shown in a recent activity without the user to be logged in.
  15. Hello guys, i want to make a script that can show me (the user) the 5 visited last links on my website. Not sure if php is teh correct language to do this but i do not know how coockies work.
  16. @Christian F. so in my case i have to do 2 foreach, right ? one for the feed and the other for the keyword
  17. Hi, I'm rather new to php so...I use simplepie to parse rss feed but i want to filter them by keywords i made this code : $feed = new SimplePie(); $feed->set_feed_url(http://website.name/rss); $feed->init(); $feed->set_cache_duration (3600); $feed->set_timeout(30); $feed->handle_content_type(); $countItem = 0; foreach ($feed->get_items() as $item){ $checktitle = $item->get_permalink(); //Regex keyword filter $pattern = '/keyword1|keyword2/'; //If the there is a keyword match, store in $matches array if (preg_match($pattern, $checktitle)) { $news[$countItem]= $item; $countItem++; } } This is the filtering part it does it work but, i want all the items that contains both keywords. I'm not sure that preg_match is the right way to do this but it;s the only thing i got, so please!
×
×
  • 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.