Jump to content

maxudaskin

Members
  • Posts

    628
  • Joined

  • Last visited

Everything posted by maxudaskin

  1. Well, That helped a lot (no sarcasm)... It is now giving a detailed error: Error (QUERY): 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 ''0', '30'' at line 1 With Query: SELECT * FROM forum_posts WHERE topicid = '1' LIMIT '0', '30'
  2. Well... the script is 4 characters shorter, but not working any better. I didn't know I didn't need the curly brackets.
  3. Theoretically it should echo the results as there is an EXIT function: <?php if (mysql_num_rows($result) == 0) { exit("Nothing to Display!"); } ?>
  4. I changed it to: <?php $query = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}' LIMIT '{$offset}', '{$limit}'"); $result = mysql_query($query) or die("Error (QUERY): " . mysql_error()); ?> and it gives the error: Error (QUERY): Query was empty
  5. $query = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}' LIMIT $offset, $limit"); $result = mysql_query($query) or die("Error (QUERY): " . mysql_error()); Error (QUERY): 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 'Resource id #6' at line 1
  6. http://www.virtualzoom.net/comm/forum.php?f=3
  7. Change ASC to DESC. I am probably wrong, but it won't hurt to try.
  8. I get the following error... 1Error: 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 'Resource id #6' at line 1 <table style="border-top:1px #FFFFFF solid" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="3%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26"></span></td> <td width="54%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Subject</span></td> <td width="7%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Posts</span></td> <td width="16%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Author</span></td> <td width="20%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Last Post By </span></td> </tr> <?php $forumid = $_GET['f']; $topicssql = mysql_query("SELECT * FROM forum_posts WHERE topic = '0' && forumid = '{$forumid}'"); while($topics = mysql_fetch_array($topicssql)){ $topicid = $topics['topicid']; $type = $topics['type']; $type_img = constant($type); $query_count = "SELECT count(*) FROM forum_posts WHERE topic = '0'"; $result_count = mysql_query($query_count) or die("Error: " . mysql_error()); $totalrows = mysql_result($result_count, 0, 0); $numofpages = ceil($totalrows/$limit); echo $numofpages; if (isset($_GET['page'])){ $page = $_GET['page'];} else{ $page = 1;} $offset = ($page - 1) * $limit; $query = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}' LIMIT $offset, $limit"); $result = mysql_query($query) or die("Error: " . mysql_error()); if (mysql_num_rows($result) == 0) { exit("Nothing to Display!"); } $postssql = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}'"); $posts = mysql_num_rows($query); echo "<tr onClick=\"MM_goToURL('parent','forum.php?t=".$topicid."');return document.MM_returnValue\" style=\"background-color:#EFF4FB;\" onMouseOver=\"this.style.backgroundColor='#E5EEF9';\" onMouseOut=\"this.style.backgroundColor='#EFF4FB';\">"; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px">'.$type_img.'</td>'; echo '<td class="cursor_link" align="left" valign="middle" style="border-bottom:1px #333355 solid" height="50px">'.$topics['title'].'</td>'; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px">'.$posts.'</td>'; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px">OOM'.$topics['pid'].' '.$topics['name'].'</td>'; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px"> </td>'; echo '</tr>'; } if ($page > 1) { echo("<a href=\"forum.php?page=".($page-1)."\">PREV</a> "); } else { echo("PREV "); } for ($i=1; $i<=$numofpages; $i++) { if ($i == $page) { echo "$i "; } else { echo "<a href=\"forum.php?page=$i\">$i</a> "; } } if ($page < $numofpages) { echo("<a href=\"forum.php?page=".($page+1)."\">NEXT</a>"); } else { echo("NEXT"); } ?> <tr> <td height="45" colspan="2" align="left"><a href="forum.php?a=post" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('post','','../images/posthv.jpg',1)"></a><a href="forum.php?a=post"></a> <table width="156" border="0" cellspacing="0" cellpadding="2"> <tr> <td align="center"><a href="forum.php?a=post"><div class="status_message status_blue">Post New Thread</div></a></td> </tr> </table></td> <td align="left" colspan="4"> </td> </tr> </table>
  9. I am working on implementing it now...
  10. Ok, I wrote it fast, I missed two semicolons, but, the reason I said do everything in PHP is so that he can practise the PHP more.
  11. When I tested out the first part, it was waaaaaay off... <?php $query_count = "SELECT count(*) FROM forum_posts WHERE topic = '0'"; $result_count = mysql_query($query_count) or die("Error: " . mysql_error()); $totalrows = mysql_result($result_count, 0, 0); $numofpages = ceil($totalrows/$limit); echo $numofpages; ?> And it echoed 11, when the limit is 30 and there are 2 threads.
  12. Kind of funny, the first result was PHP Freaks: http://www.phpfreaks.com/tutorials/43/0.php
  13. I say, make a page where people can add, edit and delete comments that can be put in either MySQL or just a TXT file, your choice. Oh, and do not use bare HTML, so do this: <?php echo '<html>'; echo '<body>' echo 'Hello World'; echo '</html>'; echo '</body>' ?> Instead of: <html> <body> <?php echo 'Hello World'; ?> </html> </body>
  14. How would I change the following to show only 30 topics then if there are more than thirty, add as many pages as needed? <table style="border-top:1px #FFFFFF solid" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="3%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26"></span></td> <td width="54%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Subject</span></td> <td width="7%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Posts</span></td> <td width="16%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Author</span></td> <td width="20%" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Last Post By </span></td> </tr> <?php $forumid = $_GET['f']; $topicssql = mysql_query("SELECT * FROM forum_posts WHERE topic = '0' && forumid = '{$forumid}'"); while($topics = mysql_fetch_array($topicssql)){ $topicid = $topics['topicid']; $type = $topics['type']; $type_img = constant($type); $postssql = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}'"); $posts = mysql_num_rows($postssql); echo "<tr onClick=\"MM_goToURL('parent','forum.php?t=".$topicid."');return document.MM_returnValue\" style=\"background-color:#EFF4FB;\" onMouseOver=\"this.style.backgroundColor='#E5EEF9';\" onMouseOut=\"this.style.backgroundColor='#EFF4FB';\">"; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px">'.$type_img.'</td>'; echo '<td class="cursor_link" align="left" valign="middle" style="border-bottom:1px #333355 solid" height="50px">'.$topics['title'].'</td>'; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px">'.$posts.'</td>'; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px">OOM'.$topics['pid'].' '.$topics['name'].'</td>'; echo '<td class="cursor_link" align="center" valign="middle" style="border-bottom:1px #333355 solid" height="50px"> </td>'; echo '</tr>'; } ?> <tr> <td height="45" colspan="2" align="left"><a href="forum.php?a=post" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('post','','../images/posthv.jpg',1)"></a><a href="forum.php?a=post"></a> <table width="156" border="0" cellspacing="0" cellpadding="2"> <tr> <td align="center"><a href="forum.php?a=post"><div class="status_message status_blue">Post New Thread</div></a></td> </tr> </table></td> <td align="left" colspan="4"> </td> </tr> </table>
  15. I am trying to make it more complicated than it needs to be... <?php //From $postssql = mysql_query("SELECT forumid, postid, pid, name, date, time, topicid, type, title, text FROM forum_posts GROUP BY forumid WHERE forumid = '{$forumid}'"); //To $postssql = mysql_query("SELECT * FROM forum_posts WHERE forumid = '{$forumid}'"); ?>
  16. That was an issue, but it still isn't working... <table style="border-top:1px #FFFFFF solid" width="774" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="21" height="20" align="center" valign="middle" bgcolor="#333355"> </td> <td width="279" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Subject</span></td> <td width="58" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Posts</span></td> <td width="213" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Last Post </span></td> </tr> <?php $forumsql = mysql_query("SELECT * FROM `forum_catagories` ORDER BY `forum_catagories`.`sort` ASC"); while($forum_row = mysql_fetch_array($forumsql)){ $forumid = $forum_row['cid']; $postssql = mysql_query("SELECT forumid, postid, pid, name, date, time, topicid, type, title, text FROM forum_posts GROUP BY forumid WHERE forumid = '{$forumid}'"); $posts = mysql_num_rows($postssql); echo "<tr style=\"background-color:#EFF4FB;\" onMouseOver=\"this.style.backgroundColor='#E5EEF9';\" onMouseOut=\"this.style.backgroundColor='#EFF4FB';\">"; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid" height="30px">'.$forum_row1.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row['name'].'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$posts.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row1.'</td>'; echo '</tr>'; } ?> </table>
  17. <table style="border-top:1px #FFFFFF solid" width="774" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="21" height="20" align="center" valign="middle" bgcolor="#333355"> </td> <td width="279" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Subject</span></td> <td width="58" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Posts</span></td> <td width="213" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Last Post </span></td> </tr> <?php $forumsql = mysql_query("SELECT * FROM `forum_catagories` ORDER BY `forum_catagories`.`sort` ASC"); while($forum_row = mysql_fetch_array($forumsql)){ $forumid = $forum_row['cid']; $postssql = mysql_query("SELECT forumid, postid, pid, name, date, time, topicid, type, title, text FROM forum_posts GROUP BY forumid WHERE forumid = '{$forumid}'"); while($posts = mysql_num_rows($post)){ // Line 269 echo "<tr style=\"background-color:#EFF4FB;\" onMouseOver=\"this.style.backgroundColor='#E5EEF9';\" onMouseOut=\"this.style.backgroundColor='#EFF4FB';\">"; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid" height="30px">'.$forum_row1.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row['name'].'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row1.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row1.'</td>'; echo '</tr>'; }} ?> </table> Keeps giving me the error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/.grable/vzoom/virtualzoom.net/comm/forum.php on line 269
  18. This is the very first part of the page. <?php session_start(); include("../include/loginscript.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" --><head> <link href="../styles.css" rel="stylesheet" type="text/css" /> ...
  19. Can you call <?php define("GREETING","Hello you! How are you today?"); echo $GREETING; ?>
  20. The session_start(); is called waaaaaaaayyyyy before this part, the rest it template HTML.
  21. <?php if($_SESSION['type'] != 1){ $action = $_GET['action']; $pirep = $_GET['pirep']; $user = 'OOM'.$_SESSION['username'].' '.$_SESSION['name']; $date = ''; if(!empty($action) && !empty($pirep)){ if($action = 'accept'){ $acceptsql = mysql_query("UPDATE `zoomdb`.`pireps` SET `type` = '0' WHERE `pireps`.`pirepid` ='{$pirep}' LIMIT 1"); if($acceptsql){ echo 'Application Accepted'; }else{ die('ERROR: Application not accepted due to internal error.'); } }elseif($action = 'deny'){ $denysql = mysql_query("UPDATE `zoomdb`.`pireps` SET `type` = '2' WHERE `pireps`.`pirepid` ='{$pirep}' LIMIT 1"); }else{ echo 'You have specified an unknown action.'; } }else{ echo 'You do not have either an action or a pirep specified or both.'; }} ?> I finished the accept part, but when I call it, it echo's nothing.
  22. If a constant is retrieved the same way as a variable what is the difference between the two?
  23. Sorry.. I meaned to put: <?php /* en.php */ $string1 = 'Hello Earth'; $string2 = 'I love you'; ?> <?php /* fr.php */ $string1 = 'Bonjour terre'; $string2 = "J'aime tu."; ?> <?php /* index.php */ $lang = $_GET['lang']; if($lang = 'en'){ include("langs/en.php"); }elseif($lang = 'fr'){ include("langs/fr.php") }else{ die("Language Not Found"); } echo $string1; echo '<br /><br />'; echo $string2; ?>
  24. I think the best thing to do would be something like this... <?php /* en.php */ $string1 = 'Hello Earth'; $string2 = 'I love you'; ?> <?php /* fr.php */ $string1 = 'Bonjour terre'; $string2 = 'J'aime tu.'; ?> <?php echo $string1; echo '<br /><br />'; echo $string2; ?>
  25. What is the difference between ___? echo & print while & do die & exit define(blah,blah) & $blah = blah And any others that may be confusing...
×
×
  • 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.