Jump to content

GamerGun

Members
  • Posts

    151
  • Joined

  • Last visited

Everything posted by GamerGun

  1. No, this is just the index.php which only includes a menu / footer and some config files.
  2. Well, thanks for noticing but what does it change to the fact that it really outputs 1 with the code i posted above?
  3. <?php $find = mysql_real_escape_string($_GET['find']); $search = mysql_real_escape_string($_GET['search']); $pieces = explode(" ", $find); define('ITEMS_PER_PAGE', 10); $start = (isset($_GET['start']) && is_numeric($_GET['start'])) ? $_GET['start'] : 0; if(!empty($search)) { $result = mysql_query("SELECT * FROM berichten WHERE onderwerp LIKE '$search' ORDER BY id DESC") or die(mysql_error()); } elseif(!empty($pieces[0]) && !empty($pieces[1])) { $result = mysql_query("SELECT * FROM berichten WHERE bericht LIKE '%$pieces[0]%' OR bericht LIKE '%$pieces[1]%' ORDER BY id DESC") or die(mysql_error()); } elseif(!empty($pieces[0]) && empty($pieces[1])) { $result = mysql_query("SELECT * FROM berichten WHERE bericht LIKE '%$pieces[0]%' ORDER BY id DESC") or die(mysql_error()); } else { $sql = "SELECT * FROM berichten ORDER BY id DESC LIMIT $start, " . ITEMS_PER_PAGE + 1; echo $sql; $result = mysql_query($sql); } include("includes/rating_functions.php"); $numofrows = @mysql_num_rows($result); for($i = 0; $i < $numofrows; $i++) { $row = mysql_fetch_array( $result ); $id = $row['id']; $message = $row['bericht']; $onderwerp = $row['onderwerp']; $titel = $row['titel']; $titel2 = eregi_replace(' ', '-', $titel); $titel2 = strtolower($titel2); $onderwerp2 = strtolower($onderwerp); $opvragen = "SELECT COUNT(*) AS aantal FROM antwoorden WHERE postid = $id"; $aantal2 = (mysql_query($opvragen)); $getal = mysql_result($aantal2, 'aantal'); if($i % 2) { $color = "brown"; $hexcolor = "#e8d6b6"; } else { $color = "gray"; $hexcolor = "#f4f4f4"; } echo "<table border=\"0\" bordercolor=\"#FF0000\" cellpadding=\"0\" cellspacing=\"0\" width=\"578\">"; echo "<tr class=\"contentbox_top_".$color."\">"; echo "<td height=\"54\"><b><a href=\"../".$titel2."-".$id.".html\">$titel</a></b> door Anoniem".$id." in <a href=\"../onderwerp-".$onderwerp2.".html\">".$onderwerp."</a> op ".$row['datum']."</td>"; echo "</tr>"; echo "<tr BGCOLOR=\"".$hexcolor."\">"; echo "<td>"; echo $message; echo "<br><br>"; echo "<a href=\"javascript:popup('$id')\">Vertel een vriend(in) hierover</a> - "; echo "<a href=\"../".$titel2."-".$id.".html\">Geef commentaar ($getal)</a><br><br>"; echo pullRating($id,true,true,true,NULL); echo "</td>"; echo "</tr>"; echo "<tr class=\"contentbox_bottom_".$color."\">"; echo "<td height=\"17\"></td>"; echo "</tr>"; echo "</table>"; } echo "<script type=\"text/javascript\">"; echo "function popup(id){"; echo "window.open('tell_a_friend.php?nummer=' + id +'','tellafriend_script','scrollbars=1,statusbar=1,resizable=1,width=400,height=510');}"; echo "</script>"; ?>
  4. Well, all it gives now is: 1 Thx for helping me
  5. No problems. But it says; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1
  6. Why would you use the define('ITEMS_PER_PAGE', 10); then?
  7. Bump. $result = mysql_query("SELECT * FROM berichten ORDER BY id DESC LIMIT $start, " . ITEMS_PER_PAGE + 1) Does not work either...
  8. Thanks, Although im having problems with the query; define('ITEMS_PER_PAGE', 10); $start = (isset($_GET['start']) && is_numeric($_GET['start'])) ? $_GET['start'] : 0; $result = mysql_query("SELECT * FROM berichten ORDER BY id DESC LIMIT $start,.ITEMS_PER_PAGE; + 1") This prints; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.ITEMS_PER_PAGE; + 1' at line 1 I also tried ".ITEMS_PER_PAGE; + 1 and \".ITEMS_PER_PAGE; + 1 and '.ITEMS_PER_PAGE; + 1 but cant get it to work. Edit; Leaving the ; away gives the same. Thanks!
  9. Dear, How can i turn this while loop into page navigation? So say that after 10 posts, page 2 is being created which shows posts 20 to 30 (and so on). <?php $result = mysql_query("SELECT * FROM berichten ORDER BY id DESC") or die(mysql_error()); include("includes/rating_functions.php"); $numofrows = @mysql_num_rows($result); for($i = 0; $i < $numofrows; $i++) { $row = mysql_fetch_array( $result ); $id = $row['id']; $message = $row['bericht']; $onderwerp = $row['onderwerp']; $titel = $row['titel']; $titel2 = eregi_replace(' ', '-', $titel); $titel2 = strtolower($titel2); $onderwerp2 = strtolower($onderwerp); $opvragen = "SELECT COUNT(*) AS aantal FROM antwoorden WHERE postid = $id"; $aantal2 = (mysql_query($opvragen)); $getal = mysql_result($aantal2, 'aantal'); if($i % 2) { $color = "brown"; $hexcolor = "#e8d6b6"; } else { $color = "gray"; $hexcolor = "#f4f4f4"; } echo "<table border=\"0\" bordercolor=\"#FF0000\" cellpadding=\"0\" cellspacing=\"0\" width=\"578\">"; echo "<tr class=\"contentbox_top_".$color."\">"; echo "<td height=\"54\"><b><a href=\"../".$titel2."-".$id.".html\">$titel</a></b> door Anoniem".$id." in <a href=\"../zoeken-".$onderwerp2.".html\">".$onderwerp."</a> op ".$row['datum']."</td>"; echo "</tr>"; echo "<tr BGCOLOR=\"".$hexcolor."\">"; echo "<td>"; echo $message; echo "<br><br>"; echo "<a href=\"javascript:popup('$id')\">Vertel een vriend(in) hierover</a> - "; echo "<a href=\"../".$titel2."-".$id.".html\">Geef commentaar ($getal)</a><br><br>"; echo pullRating($id,true,true,true,NULL); echo "</td>"; echo "</tr>"; echo "<tr class=\"contentbox_bottom_".$color."\">"; echo "<td height=\"17\"></td>"; echo "</tr>"; echo "</table>"; } echo "<script type=\"text/javascript\">"; echo "function popup(id){"; echo "window.open('tell_a_friend.php?nummer=' + id +'','tellafriend_script','scrollbars=1,statusbar=1,resizable=1,width=400,height=510');}"; echo "</script>"; ?> Thanks in advance. Pz -T
  10. It's possible of course... :-\ I tried contacting him by e-mail and via CodeLobster, but without success. Thx anyway.
  11. ...what happend to bobbinsbro? http://www.phpfreaks.com/forums/index.php?action=profile;u=71111 I've been working together with this great guy, early 2009. I had last contact with him around april 2009, but havent heard a thing of him since... Maybe some one at here is in some way related to him, 'cause i'm really wondering... Thanks in advance! Pz TommyGun
  12. Damn, i did paste the wrong code; <html> <head> <?php header('Refresh: 120'); ?> </head> <body> <b>Roept u maar</b><br><br> <?php $read = fopen("content.txt", "r"); $contents = fread($read, filesize('content.txt')); $bbcode = array( '#\[b\](.*?)\[/b\]#si' => '<b>\\1</b>', '#\[i\](.*?)\[/i\]#si' => '<i>\\1</i>', '#\[u\](.*?)\[/u\]#si' => '<u>\\1</u>', '#\[s\](.*?)\[/s\]#si' => '<strike>\\1</strike>', '#\[color=(.*?)\](.*?)\[/color\]#si' => '<font color="\\1">\\2</font>', '#\[img\](.*?)\[/img\]#si' => '<img src="\\1">', '#\[email\](.*?)\[/email\]#si' => '<a href="mailto:\\1">\\1</a>' ); $contents = preg_replace(array_keys($bbcode), array_values($bbcode), $contents); $contents = str_replace("www","http://www",$contents); $smilies = array("","","","",":shock:",":?","","",":x","",":red:","",":evil:",":twisted:",":roll:",":wink:",":!:",":q","",":arrow:"); $images = array("icon_biggrin.gif","icon_smile.gif","icon_sad.gif","icon_surprised.gif","icon_eek.gif","icon_confused.gif","icon_cool.gif","icon_lol.gif","icon_mad.gif","icon_razz.gif","icon_redface.gif","icon_cry.gif","icon_evil.gif","icon_twisted.gif","icon_rolleyes.gif","icon_wink.gif","icon_exclaim.gif","icon_question.gif","icon_idea.gif","icon_arrow.gif"); $aantal = count($smilies)-1; for ($i=0;$i<=$aantal;$i++) { $contents = str_replace($smilies[$i],"<img src=\"/shoutbox/smileys/".$images[$i]."\"WIDTH=\"15\" HEIGHT=\"15\">", $contents); } $contents = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $contents); echo $contents; ?> </body> </html> See the ereg_replace line. This is the result: [attachment deleted by admin]
  13. Hello all, I am creating a shoutbox, which goes fine. It saves all text to some .txt file, which i then read. With some ereg_replace i make all tekst links clickable (hyperlink). The only problem is that it also converts things like <img src="bla"> so all images become broken. Any idea? Short said: I dont want the ereg_replace to touch links ending with .gif or whatever! Thanks! <html> <head> <?php header('Refresh: 120'); ?> </head> <body> <b>Roept u maar</b><br><br> <?php $read = fopen("content.txt", "r"); $contents = fread($read, filesize('content.txt')); $bbcode = array( '#\[b\](.*?)\[/b\]#si' => '<b>\\1</b>', '#\[i\](.*?)\[/i\]#si' => '<i>\\1</i>', '#\[u\](.*?)\[/u\]#si' => '<u>\\1</u>', '#\[s\](.*?)\[/s\]#si' => '<strike>\\1</strike>', '#\[color=(.*?)\](.*?)\[/color\]#si' => '<font color="\\1">\\2</font>', '#\[img\](.*?)\[/img\]#si' => '<img src="\\1">', '#\[email\](.*?)\[/email\]#si' => '<a href="mailto:\\1">\\1</a>' ); $contents = preg_replace(array_keys($bbcode), array_values($bbcode), $contents); $contents = str_replace("www","http://www",$contents); $smilies = array("","","","",":shock:",":?","","",":x","",":red:","",":evil:",":twisted:",":roll:",":wink:",":!:",":q","",":arrow:"); $images = array("icon_biggrin.gif","icon_smile.gif","icon_sad.gif","icon_surprised.gif","icon_eek.gif","icon_confused.gif","icon_cool.gif","icon_lol.gif","icon_mad.gif","icon_razz.gif","icon_redface.gif","icon_cry.gif","icon_evil.gif","icon_twisted.gif","icon_rolleyes.gif","icon_wink.gif","icon_exclaim.gif","icon_question.gif","icon_idea.gif","icon_arrow.gif"); $aantal = count($smilies)-1; for ($i=0;$i<=$aantal;$i++) { $contents = str_replace($smilies[$i],"<img src=\"/shoutbox/smileys/".$images[$i]."\"WIDTH=\"15\" HEIGHT=\"15\">", $contents); } echo $contents; ?> </body> </html>
  14. You forgot a ; after $tagging = mysql_fetch_assoc( $tagquery ) But this gives: * math, balls, lines, jet, game, games, flash, fun, awesome, win, fupa, puzzle, puzzles Thanks Pz -T
  15. You mean like this? //tagcloud proberen $tags = Array(); $tagquery = mysql_query("SELECT COUNT(tagging) AS count, tagging FROM games GROUP BY tagging ORDER BY tagging ") or die( mysql_error() ); //while( $tagging = mysql_fetch_assoc( $tagquery ) ) { //$tags[$tagging['tagging']] = $tagging['count']; $temp = implode(",",$tagging['tagging']); $temp2 = str_replace(" ",",",$temp); $final_temp = explode(",",$temp2); } print_r($tagging['tagging']); //$max = max($tags); //foreach ($tags as $tagging => $hits) //{ // $percent = round(($hits / $max) * 100); // echo "<a href='link.com/tag/".$tagging."' style='font-size: ".$percent."%'>".$tagging."</a> "; //} //einde tagcloud proberen Gives: Warning: implode() [function.implode]: Invalid arguments passed in /home/mqxfaokl/domains/domain.nl/public_html/index.php on line 165 Just once. Thx
  16. There is, since i get output with the code in the start post.
  17. No output, except for the same error message. Tried to create output like this: $tags = Array(); $tagquery = mysql_query("SELECT COUNT(tagging) AS count, tagging FROM games GROUP BY tagging ORDER BY tagging ") or die( mysql_error() ); while( $tagging = mysql_fetch_assoc( $tagquery ) ) { $tags[$tagging['tagging']] = $tagging['count']; //$temp = implode(",",$tagging['tagging']); //$temp2 = str_replace(" ",",",$temp); //$final_temp = explode(",",$temp2); } print_r($tagging['tagging']); But then it's all empty, no output.
  18. Hello mate, Thanks for your response. Now i have: $tags = Array(); $tagquery = mysql_query("SELECT COUNT(tagging) AS count, tagging FROM games GROUP BY tagging ORDER BY tagging ") or die( mysql_error() ); while( $tagging = mysql_fetch_assoc( $tagquery ) ) { $temp = implode(",",$tagging['tagging']); $temp2 = str_replace(" ",",",$temp); $final_temp = explode(",",$temp2); } print_r ($final_temp); //$max = max($tags); //foreach ($tags as $tagging => $hits) //{ // $percent = round(($hits / $max) * 100); // echo "<a href='link.com/tag/".$tagging."' style='font-size: ".$percent."%'>".$tagging."</a> "; //} Which gives (a lot): Warning: implode() [function.implode]: Invalid arguments passed in index.php on line 162 I think the reason is because of the [ ] inside the implode function. I don't know a way around it tho. I tried this but that doesn't work of course hehe. $bla = $tagging['tagging']; $temp = implode(",",$bla); Thanks! Pz -T
  19. Testing a bit, while waiting for an solution. With this code; $tags = Array(); $tagquery = mysql_query("SELECT COUNT(tagging) AS count, tagging FROM games GROUP BY tagging ORDER BY tagging ") or die( mysql_error() ); while( $tagging = mysql_fetch_assoc( $tagquery ) ) { $temp = explode(",",$tagging['tagging']); $temp2 = explode(" ",$temp); $tags[$tagging['tagging']] = $tagging['count']; } print_r ($temp); I get this: Array ( [0] => zombies [1] => shooting [2] => ninja kiwi [3] => assault [4] => guns [5] => rifle [6] => shooting [7] => creeps [8] => walls ) With this; $tags = Array(); $tagquery = mysql_query("SELECT COUNT(tagging) AS count, tagging FROM games GROUP BY tagging ORDER BY tagging ") or die( mysql_error() ); while( $tagging = mysql_fetch_assoc( $tagquery ) ) { $temp = explode(",",$tagging['tagging']); $temp2 = explode(" ",$temp); $tags[$tagging['tagging']] = $tagging['count']; } print_r ($temp2); It outputs Array ( [0] => Array ) 1. Why is temp2 empty? 2. Why is temp only outputting one line? 3. Most important, how to combine the while part with this: //$max = max($tags); foreach ($tags as $tagging => $hits) { $percent = round(($hits / $max) * 100); echo "<a href='link.com/tag/".$tagging."' style='font-size: ".$percent."%'>".$tagging."</a> "; } Thanks. Pz -T
  20. You were right, but with using this, the count part is gone? I don't get what this is doing, seems like it's creating more lines, but still no separate words. I see what you mean, and this i think is the most logical, but i don't know how to use the data from $temp2, without loosing the $tagging['count']; Because now, it's again doing nothing with that data. Thanks all. Pz -T
  21. Hello y'all I'm having a problem which I'm not able to fix, so that's why I'm asking for your help. I have a database, which contains a table "games". In games, there is a field called "tagging". Those records (from "tagging") are being used for creating a tag cloud. The problem is that every record contains multiple words. For example: 3 foot, ninja, kickass, fight, sword, blood They are all comma separated. Now i use the following code: <?php $tags = Array(); $tagquery = mysql_query("SELECT COUNT(tagging) AS count, tagging FROM games GROUP BY tagging ORDER BY tagging ") or die( mysql_error() ); while( $tagging = mysql_fetch_assoc( $tagquery ) ) { $temp = explode(",",$tagging['tagging']); $tags[$tagging['tagging']] = $tagging['count']; } $max = max($tags); foreach ($tags as $tagging => $hits) { $percent = round(($hits / $max) * 100); echo "<a href='link.com/tag/".$tagging."' style='font-size: ".$percent."%'>".$tagging."</a> "; } ?> This creates an cloud based on all the records, but these should be exploded. If i print the array, it shows me this: echo "<pre>"; print_r ($tags); echo "</pre>"; Array ( [* math, balls, lines, jet, game, games, flash, fun, awesome, win, fupa, puzzle, puzzles] => 1 [* word, text, puzzle, action, small, casual, family, friendly, dictionary, fast, quick, time] => 1 [3 foot, ninja, kickass, fight, sword, blood] => 1 [3d, ball, drop, plate] => 1 ) But what i want is every word separate. When i have that, i can use each word for the foreach to create the cloud. So to make a long story short: the cloud is now based on each record, instead of every word from each record. Hope that I'm clear. Thanks for any help. Pz -T
×
×
  • 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.