Jump to content

Adastra

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by Adastra

  1. I want something like this: [code=php:0] elseif ($_GET['p'] == "name_all") { content of ($_GET['p'] == "name2") and ($_GET['p'] == "name3") } [/code] I don't know how to explain it better.
  2. I have a document structured like this: [code=php:0]<? if ($_GET['p'] == "name1") { my contents } elseif ($_GET['p'] == "name2") { my contents } elseif ($_GET['p'] == "name3") { my contents } ?>[/code] and so on. But now I need a string which gives me the contents of two of those strings, which somewhat includes the content of two of the strings in a new one together. [code=php:0]elseif ($_GET['p'] == "name_all") { content of name2 and name3 }[/code] How can I do that? include() doesn't work, and I've tried various other stuff with echo, $_GET and print, but nothing works! I'm sure you can easily do this with some function I don't know about. Thanks in advance :)
  3. The only good looking one I found with google is one that's NOT for free. I'd like some suggestions from people who have good experiences with some script they use and stuff like that, that's why I asked here ;)
  4. I need a very easy to costumize, well and clean-coded free calendar script. It's [b]only[/b] for multi-day events. It should be no problem to have two or three events per day. It should also be no problem to add a lot of additional fields to the database because I'll need all of those for my purposes. It should have a view per year and a view per months, with the possiblity to navigate between years and months.  Monday should also be the first day of the week. So, I'd be grateful if anyone good suggest a good calendar script :)
  5. [quote author=GingerRobot link=topic=100024.msg394309#msg394309 date=1152525187] Another way would be to store all the emails in an array,  then use the array_unique() function to remove duplicate entries. You could then send an email to each of those. [/quote] How exactly does that work? Do you have a code sample? Sry, I'm such a noob... ^^
  6. I've written a new small function to send someone an email when a follow-up comment is made on a bloglike thing, but I would like to send them only ONE e-mail per entry, or per e-mail address, in case they signed up for a follow-up more than once. How exactly can I do that? I can't think of any function in PHP (I'm still a noob), and I also don't know how to approach this in SQL. I thought something like "SELECT * FROM blog_comments WHERE entry=$entry AND followup='yes' and COUNT(email) >= 1" might work, but I get an error with that statement. Anyone got any better ideas? :)
  7. Hi Freaks, is it possible with PHP to print the date of the recent last Sunday, which automatically updates itself on that said Sunday (or on another day of the week, like every Tuesday)? Would be very good to know! But if it's way to complicated, just forget about it ;)
  8. [!--quoteo(post=380527:date=Jun 6 2006, 03:55 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Jun 6 2006, 03:55 AM) [snapback]380527[/snapback][/div][div class=\'quotemain\'][!--quotec--] First up, on your HTML form all of your checkboxes need the same name, but referenced as an array, this can be done by adding [] onto the end of the name, like so: [code] <input type="checkbox" name="colour[]" value="red"/> Red<br/> <input type="checkbox" name="colour[]" value="green"/> Green<br/> <input type="checkbox" name="colour[]" value="blue"/> Blue<br/> [/code] They can then be received as an array when fetching with $_POST[], and as you mentioned, looped through with a foreach(). You can do it like so... [code]foreach($_POST['colour'] as $c) {     echo $c."<br/>"; }[/code] [/quote] Yay, that's it, thank you very much! :) I didn't know about the $_POST part and I mixed up stuff in the foreach() { }, that's why it didn't work til now :)
  9. I can't figure out the how to post the checkbox data for multiple categories on a small blog script to a database. I have three tables, the blog table, the blog_cat table with the id's & names of the categories and the blog_catjoin table with the id's of the entry and of the catID. Can someone help me out? My PHP knowledge is still very basic and PHP.net just confuses me. I know it's gotta be something with arrays and for or foreach, but I don't understand how to use them. Relevant parts of the script (with some weird testing-stuff and some stuff commented out): Currently, this version posts both an entry to the blog table, but it only posts one category into the catjoin table (always the one with the highest ID), however, it should of course make seperate entries for each checked category checkbox. [code] ... # select the categories from the cat table to create a list of checkboxes include('connect.php'); $result = mysql_query("SELECT blog_cat.catID, catname FROM blog_cat LEFT JOIN blog_catjoin ON blog_cat.catID=blog_catjoin.catID GROUP BY blog_cat.catID ORDER BY catname ASC") or print ("Can't select categories. " . $result . " " . mysql_error()); while($row = mysql_fetch_array($result)) { $catID = $row["catID"]; $catname = $row["catname"]; echo "<.input type=\"checkbox\" name=\"$cat_array\" value=\"$catID\""; echo " /> $catname   "; } .... <./form> .... # insert all the stuff into the database $sql = "INSERT INTO $table (...) VALUES (....)"; $result = mysql_query($sql) or print ("Unable to post data. " . $sql . " " . mysql_error()); if ($result != false) { print "Entry has been posted! ($title)"; } $idresult = mysql_query("SELECT id from $table ORDER by id DESC LIMIT 1") or print ("Can't select categories. " . $result . " " . mysql_error()); while($idrow = mysql_fetch_array($idresult)) { $id = $idrow["id"]; } /*foreach ($cat_array as $cat) {*/ $query_cat = "INSERT INTO blog_catjoin VALUES ('','$id','$catID')"; $result_cat = mysql_query($query_cat); if ($result_cat != false) { echo "All categories successfully added."; } /*}*/ } [/code] Thanks in advance :)
  10. Anyone? [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] I know posting checkbox data to a db isn't THAT difficult. I just have no clue how to 'make it work' in my script here. [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
  11. I'm currently trying to wrap my mind around multiple categories. So far the whole selecting works perfectly fine, but I can't figure out the how to post everything to the catjoin table. I have three tables, the blog table, the blog_cat table with the id's & names of the categories and the blog_catjoin table with the id's of the entry and of the catID. I don't understand how to use the cat_array and foreach elements. Can someone help me out? My PHP knowledge is still very basic and PHP.net just confuses me. Thank you :) Relevant parts of the script (with some weird testing-stuff and some stuff commented out): Currently, this version posts both an entry to the blog table, but it only posts one category into the catjoin table (always the one with the highest ID), however, it should of course make seperate entries for each checked category checkbox. It would be terrific if someone could just show me what I have to do by editing this. I won't understand a thing if you try to explain it with theoretical stuff, I need to see it in use. [code] ... # select the categories from the cat table to create a list of checkboxes include('connect.php'); $result = mysql_query("SELECT blog_cat.catID, catname FROM blog_cat LEFT JOIN blog_catjoin ON blog_cat.catID=blog_catjoin.catID GROUP BY blog_cat.catID ORDER BY catname ASC") or print ("Can't select categories. " . $result . " " . mysql_error()); while($row = mysql_fetch_array($result)) { $catID = $row["catID"]; $catname = $row["catname"]; echo "<.input type=\"checkbox\" name=\"$cat_array\" value=\"$catID\""; echo " /> $catname   "; } .... <./form> .... # insert all the stuff into the database $sql = "INSERT INTO $table (...) VALUES (....)"; $result = mysql_query($sql) or print ("Unable to post data. " . $sql . " " . mysql_error()); if ($result != false) { print "Entry has been posted! ($title)"; } $idresult = mysql_query("SELECT id from $table ORDER by id DESC LIMIT 1") or print ("Can't select categories. " . $result . " " . mysql_error()); while($idrow = mysql_fetch_array($idresult)) { $id = $idrow["id"]; } /*foreach ($cat_array as $cat) {*/ $query_cat = "INSERT INTO blog_catjoin VALUES ('','$id','$catID')"; $result_cat = mysql_query($query_cat); if ($result_cat != false) { echo "All categories successfully added."; } /*}*/ } [/code]
×
×
  • 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.