Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by aebstract

  1. Pulling data from a database? LastName is the column you're grabbing in this case. $row is set somewhere above around your query so you can grab various columns.
  2. A copy of the actual error would help. Does commenting the ' out fix it? O\'Brien?
  3. Change "testdir" with your directory, obviously. Set a variable to the directory you want and place it in as testdir if the directory is going to be changing.
  4. Does invoice.php exist in the system directory? You should be using a print media stylesheet. <link rel="stylesheet" href="print.css" type="text/css" media="print" />
  5. $ssn is an array? When you do print_r($ssn) do you get something like Array (0=>001, 1=>002, 2=003) ?
  6. I'm not too sure about rules, but I know that I don't have the time to code something for you for free. If you're working on a project, run in to an issue, error, etc.. we will be more than happy to help you out. Good luck (you can ask for help on how to do things as well, but it needs to be more specific and not just "can someone code this for me") if that makes sense.
  7. I just tested this: $test = file_get_contents('test.txt'); echo $test; With a test.txt in the same directory with the word test inside it. The word was echoed without a problem. I did the test cause I never work with txt files so I wanted to be sure. Either it's not in the same directory, your file name is wrong, or there isn't anything in the txt file.
  8. Is text.txt in the same directory as this php file? Why do you close your php tag and reopen it on next line?
  9. No one will code it for you, no. If you want someone to do that, there is a freelance section. If you need specific help with a problem you are having then okay. We can help you with getting you on track, maybe helping with a little bit of a "guideline" of what you need to do. Once you run in to issues (if you do) we can help solve those, but we won't just code it for you, sorry.
  10. http://www.tizag.com/phpT/fileread.php
  11. Can you just not add however many days the break period is on to the end of your work days? Figure out how many days the vacation time is, then when you figure your work days just add the vacation time on to it? That or use some sort of if statement and a loop, skip the days that are for vacations.
  12. May seem sketchy, but what if you add 2 // instead of just 1, then it deletes the other and you are left with 1?
  13. I'm not sure if that's the way it works. As far as I know, you basically take what you have and turn it in to www.domain.com/videos/j8_pP0-L/ or that's the only way I've ever done it before. Then basically your j8... is watch=j8... I don't think this section is for rewrites though.
  14. if(isset($_POST['submit'])) { if (!$_POST['name'] || !$_POST['state'] || !$_POST['city'] || !_POST['email'] || !$_POST['username'] || !$_POST['password'] || !$_POST['confirm_password'] ) { die('You did not complete all of the required fields'); } } Missing { on line 1. Added extra } to end also.. not sure if you have it closed somewhere or not?
  15. You start by laying your site out for the latest browsers and "fixing" them for the older. IE 5 / 6 sucks. This is also NOT a php question, this is all within your stylesheets.
  16. http://php.about.com/od/advancedphp/p/html_php.htm
  17. This will give you your three values by themselves: $date = '1998:03:20 00:10:00'; $date = explode(" ", $date); $date = explode(":", $date[0]); echo "$date[0] $date[1] $date[2]"
  18. Are you able to alter your sql query? Best way to do it would be to convert it from datetime to date when you retrieve your database information. If this isn't an option, we could easily take it and run a little code to pull the values out of the string. Just let me know which way you would rather do it.
  19. This seems to work: $query = mysql_query(" SELECT * FROM posts JOIN forums ON ( forums.forum_id = posts.forum_id ) JOIN users ON ( users.user_id = posts.poster_id ) ORDER BY post_time DESC "); if (mysql_num_rows($query)!=0){ $recent_posts = ''; $count = '1'; $used_ids = array(0); while($r=mysql_fetch_array($query)) { if (!isset($used_ids[4])) { if ($used_ids[4] != $r[topic_id]) { if ($used_ids[3] != $r[topic_id]) { if ($used_ids[2] != $r[topic_id]) { if ($used_ids[1] != $r[topic_id]) { $query2 = mysql_query("SELECT post_subject FROM posts WHERE post_id = $r[topic_id]"); if (mysql_num_rows($query)!=0){ while($s=mysql_fetch_array($query2)) { $topic_subject = $s[post_subject]; } } if ($count != 4) { $recent_posts .= "<table class=\"recent_posts_table\">"; } else { $recent_posts .= "<table class=\"recent_posts_table_2\">"; } $recent_posts .= "<tr><td class=\"r_p_icon\"> <img src=\"images/recent_post.png\" /> </td><td class=\"r_p_subject\"> <span class=\"r_p_link\"><a href=\"forums/viewtopic.php?f=$r[forum_id]&t=$r[topic_id]\">$topic_subject</a></span> </td><td class=\"r_p_spacer\"> </td><td> <table><tr><td> <span>by <a href=\"forums/memberlist.php?mode=viewprofile&u=$r[user_id]\">$r[username]</a>: about fourty minutes ago</span> </tr><tr> In <span class=\"r_p_link\"><a href=\"forums/viewforum.php?f=$r[forum_id]\">$r[forum_name]</a></span> >> <span class=\"r_p_link\"><a href=\"forums/viewtopic.php?f=$r[forum_id]&t=$r[topic_id]#p$r[post_id]\">$r[post_subject]</a></span> </tr></td></table> </td></tr> </table> "; $count++; array_push($used_ids, $r[topic_id]); } } } } } } } Not sure if it's the neatest or best way to do it, if anyone has a suggestion I'm more than willing to give it a try. If not, at least this should be working now.
  20. I dunno, I can do this: echo "$r[topic_id]"; and it doesn't have a problem echoing the correct number. Also, like I said.. If I don't use the || in my if statement, it will work in blocking out any from the first grabbed row. When I throw the || in to try and check against those values as well, it doesn't block anything anymore. I hope I'm explaining this well enough.
  21. This doesn't work: if ($r[topic_id] != $used_ids[1] || $r[topic_id] != $used_ids[2] || $r[topic_id] != $used_ids[3] || $r[topic_id] != $used_ids[4]){ If I just put: if ($r[topic_id] != $used_ids[1]){ The '||' is allowed to be used like this, right? I'm probably doing this a lot harder of a way than what is needed. Here is everything that is going on: $query = mysql_query(" SELECT * FROM posts JOIN forums ON ( forums.forum_id = posts.forum_id ) JOIN users ON ( users.user_id = posts.poster_id ) ORDER BY post_time DESC "); if (mysql_num_rows($query)!=0){ $recent_posts = ''; $count = '1'; $used_ids = ''; while($r=mysql_fetch_array($query)) { $used_ids .= " $r[topic_id]"; $used_ids = explode(" ", $used_ids); if ($r[topic_id] != $used_ids[1] || $r[topic_id] != $used_ids[2] || $r[topic_id] != $used_ids[3] || $r[topic_id] != $used_ids[4]){ $query2 = mysql_query("SELECT post_subject FROM posts WHERE post_id = $r[topic_id]"); if (mysql_num_rows($query)!=0){ while($s=mysql_fetch_array($query2)) { $topic_subject = $s[post_subject]; } } if ($count != 4) { $recent_posts .= "<table class=\"recent_posts_table\">"; } else { $recent_posts .= "<table class=\"recent_posts_table_2\">"; } $recent_posts .= "<tr><td class=\"r_p_icon\"> <img src=\"images/recent_post.png\" /> </td><td class=\"r_p_subject\"> <span class=\"r_p_link\"><a href=\"forums/viewtopic.php?f=$r[forum_id]&t=$r[topic_id]\">$topic_subject</a></span> </td><td class=\"r_p_spacer\"> </td><td> <table><tr><td> <span>by <a href=\"forums/memberlist.php?mode=viewprofile&u=$r[user_id]\">$r[username]</a>: about fourty minutes ago</span> </tr><tr> In <span class=\"r_p_link\"><a href=\"forums/viewforum.php?f=$r[forum_id]\">$r[forum_name]</a></span> >> <span class=\"r_p_link\"><a href=\"forums/viewtopic.php?f=$r[forum_id]&t=$r[topic_id]#p$r[post_id]\">$r[post_subject]</a></span> </tr></td></table> </td></tr> </table> "; $count++; } $used_ids = implode(" ", $used_ids); } } Basically the parts about $used_ids is what we're looking at. I'm trying to pull out posts from the database, but I only want to display a maximum of 4 results, and those results need to have unique topic_id's. So I was trying to store them as I go through them, check if it is stored and if it is.. don't display the line, go to the next. Check it's topic_id and so on.
  22. It grabbed 3 rows with the same topic_id, I might do some sort of loop, just end the loop once I accept 4 rows of unique post_id? Thanks for the help
  23. On the second one: #1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' I am needing to pull all of the information, or if not all.. there is a quite a bit I will have to type out to get all I need. Either way, I think IN isn't supported. Also, it's topic_id not post_id.. not a big deal though I can just change that
×
×
  • 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.