Jump to content

Mr_CHISOL

Members
  • Posts

    404
  • Joined

  • Last visited

About Mr_CHISOL

  • Birthday 02/01/1986

Previous Fields

  • Languages
    CSS, XHTML, PHP, XML

Contact Methods

  • MSN
    mr_chisol@msn.com
  • Website URL
    http://www.kacthus.net
  • ICQ
    0

Profile Information

  • Location
    Sweden
  • Interests
    Computers<br />Programming (C/C++, PHP, Perl)<br />Music<br />Photographing<br />Choir

Mr_CHISOL's Achievements

Member

Member (2/7)

0

Reputation

  1. You took that out of context... that code is ok, but this isn't (first post)$nav = '<div id="div"><a href="#"><img src="<?php echo"$site"; ?>img/pic1.png" alt="pic1" /></a><a href="#"><img src="<?php echo"$site"; ?>img/pic2.png" alt="pic2" /></a></div>'; The code I had (in the quote) is what that the script would output on echo $nav;... well, it's easier with file_get_contents() (just one row)Oh, well with ob you get yhe output of that code, but that could be accomplished via file_get_contents to, but then you run that script seppearately..
  2. Do you want to put the contents of the file in a variable?If so, take a look at file_get_contents().
  3. Ehum, Just a note to justsomeguy... ;?)http://w3schools.invisionzone.com/index.ph...amp;#entry67870
  4. It doesn't matter, unless your planing to use it for calculating, "123" is still 123 but s a string... but I think that that's not important here as it looks as temporary "testing data".
  5. This guy is very cool, he took alot of time to help me out!

  6. It's that when we get total_pages we divide total posts with how many posts you want on a page which give you a float, and I (as stupid as I am right now, apparentely) forget about that and happily taught that you get a nice integer... :?|
  7. First, Previous and 1 shouldn't be links as you are on the first page (use the CSS-class disabled_page to make this more "visible").What is the file called (I thought it was called viewtopic.php or mmabjj_viewtopic.php) You need to have the right filename in the link (or remove the filename and just use ?id=...), make sure you have it (do you have this site live?)What bothers me is that you can't see the second page, but you can see the first, prev etc. Oh I think I know ht the problem is... (Stupid mistake...)Ok, to fix this add ceil() around $total_pages here (EDIT):$total_pages = ceil($total_count / $per_page); Again, sorry for my mistakes, I have alot to think about right now.. :?|ps Hope you look at the code I learn (from my mistakes...) ;?) ds
  8. Sorry if there was some ' missing, my browser doesn't show ' and " good together in the textarea (guess I need to change the settings...).Sorry for the total_count, I tought that we had used it before (maybe another post), but you can use the same code as in the 2nd code-block to set the total_count:$cnt_res = mysql_query( "SELECT COUNT(*) FROM $tbl_name2 WHERE question_id=$id" ); $total_count = intval(mysql_result( $cnt_res, 0 )); The first/last, next/prev links should be shown if $total_count has the right value...
  9. Ok, first:Here's how to handle previous/next, first and last (including the code I postd before...) $total_pages = $total_count / $per_page;if ($total_pages > 1) { $tags = array(); if ($page == 1) { $tags[] = array( '<span class="disabled_page">', '</span>' ); $tags[] = array( '<span class="disabled_page">', '</span>' ); } else { $tags[] = array( '<a href="viewtopic.php?id=' . $id . '&page=1">', '</a>' ); // First $tags[] = array( '<a href="viewtopic.php?id=' . $id . '&page=' . ($page - 1) . ">', '</a>' ); // Previous } echo $tags[0][0] . '<< First' . $tags[0][1] . ' '; echo $tags[1][0] . '< Previous' . $tags[1][1] . ' ';}for ($i=1; $i <= $total_pages; $i++) { if ($i == $page) echo '<span class="disabled_page">'; // changed the class else echo '<a href="viewtopic.php?id=' . $id . '&page=' . $i .'">'; echo $i; if ($i == $page) echo '</span>'; else echo '</a>'; echo ' ';}if ($total_pages > 1) { $tags = array(); if ($page >= $total_pages) { $tags[] = array( '<span class="disabled_page">', '</span>' ); $tags[] = array( '<span class="disabled_page">', '</span>' ); } else { $tags[] = array( '<a href="viewtopic.php?id=' . $id . '&page=' . $total_pages . '">', '</a>' ); // Last $tags[] = array( '<a href="viewtopic.php?id=' . $id . '&page=' . ($page + 1) . ">', '</a>' ); // Next } echo $tags[1][0] . 'Next >' . $tags[1][1] . ' '; echo $tags[0][0] . 'Last >> . $tags[0][1] . ' ';} That's not perhaps the perfect example/code (from a visitors p.o.v.), but it works fine...
  10. Well, I don't think you did like that, cause tha's not valid, but it could look like this: $total_pages = $total_count / $per_page;for ($i=1; $i <= $total_pages; $i++) { if ($i == $page) echo '<span class="bold">'; else echo '<a href="viewtopic.php?id=' . $id . '&page=' . $i .'">'; echo $i; if ($i == $page) echo '</span>'; else echo '</a>'; echo ' ';} That would work ok!ps Sorry if I misunderstood you, but you can also see how to create the link from the code... dsEDIT (as you posted a new one when I was writing this ), this is gonna be short as I'm going to bed soon, but why do you get the max id from the db and then give the post an id yourself, why don't you leave that to MySQL, its much mor esimplier, just set auto_increase on the field (and prmary key... but I guess that's already done)Good Luck and Don't Panic!
  11. Hi!Try this: if (isset($_GET['page'])) $page = intval( $_GET['page'] );else $page = 1;$per_page = 15;$start = (($page - 1) * $per_page); // The "+ 1" shouldn't be there.. And then just $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id' LIMIT $start, $per_page"; As long as all the variables is set and the values is right, then it should workThe + 1 tells MySQL to skip the first post...You wouldn't need the { } around the variables in the string.
  12. First the problem with intval:It doesn't mather where you put it, but I would put it by $id = $_GET...: $id = intval( $_GET['id'] ); To put it in the query use this: $sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id=" . intval($id); To add a value to the querystring you need to use a ampersand (&): index.php?id=1&page=2When you didn't use a ampersand nor intval yot get an error because the SQL would look like this INSERT INTO the_table(view) VALUES('view') WHERE id=1page=2 (Not sure on what you want to do with this query, it doesn't look good to me...)(Not sure what hapends if there's two q-marks in the querystring)Good Luck and Don't Panic! ;?)
  13. I know I'd by at least three ;?) It has, and now we have Ubuntu, it's very easy to use and most "standard components" (ex. most wifi-card use the same base) work.It's a realy good idea.We need to join together and make the companies do that, together we are strong. ;?)
  14. Mr_CHISOL

    Reading raw XML

    :?)The reason for that is prob. that Lynx doesn't have support for XSL, where IE, FF etc does. Then the server generates the source so it can work with lynx too..
  15. A little note: You could a link that says "Hear this text" (on CAPTCHA etc) (I've seen it on some sites). The problem would be to generate the soundfile.
×
×
  • Create New...