Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. gosh I feel retarted, once I posted the code I saw my else statement was in the wrong spot. here is the fix: <?php $q = mysql_query("SELECT * FROM `site_status`"); $row = mysql_fetch_array($q); $query = mysql_query("SELECT * FROM `marquee`"); $marquee = mysql_fetch_array($query); $num_rows = mysql_num_rows($query); if($num_rows < 1){ $status = "This is the default marquee message, if you are the admin please login and change it."; }else{ if ($marquee['num'] == (2)){ $status = $marquee['mar_custom']; } $stat = $row['status']; if ($stat == ('0')){ $status = $marquee['mar_nu']; } if ($stat == ('1')){ $status = $marquee['mar_basket']; } if ($stat == ('2')){ $status = $marquee['mar_foot'];; } } ?> <script type="text/javascript"> //<![CDATA[ document.write("<marquee> <?php echo $status; ?></marquee>"); //]]> </script> since the else statement was in the wrong spot, it was setting $status to a empty variable. That is why I got nothing echoed out.
  2. Thanks for the replys guys. I did do the mysql_error after I posted this topic, and I am connect, and no errors. I did do the var_dump($num_rows); and I got this: int(0) You guys where asking about $status, here is the rest of the code: <?php $q = mysql_query("SELECT * FROM `site_status`"); $row = mysql_fetch_array($q); $query = mysql_query("SELECT * FROM `marquee`"); $marquee = mysql_fetch_array($query); $num_rows = mysql_num_rows($query); if($num_rows < 1){ $status = "This is the default marquee message, if you are the admin please login and change it."; } if ($marquee['num'] == (2)){ $status = $marquee['mar_custom']; }else{ $stat = $row['status']; if ($stat == ('0')){ $status = $marquee['mar_nu']; } if ($stat == ('1')){ $status = $marquee['mar_basket']; } if ($stat == ('2')){ $status = $marquee['mar_foot'];; } } ?> <script type="text/javascript"> //<![CDATA[ document.write("<marquee> <?php echo $status; ?></marquee>"); //]]> </script> this is a included file in my head.php
  3. well that did not work either.
  4. I am having a problem with my marquee, it is suppose to check to see if there is anything in the database. Well it is not echoing anything out, because there is nothing in the database, but I setup a default message in case something like this happens. But my default message is not working. Here is my code: <?php $query = mysql_query("SELECT * FROM `marquee`"); $marquee = mysql_fetch_array($query); $num_rows = mysql_num_rows($query); if($num_rows < '1'){ $status = "This is the default marquee message, if you are the admin please login and change it."; } ?>
  5. I am not sure how to do this, but to clear this up for the other members. You want a PHP script to open up a text file and find terms that match what the user inputted? Then you want a link to the directory it was in?
  6. use SmartFTP to upload the files, and make sure you check the permissions, I think you said you did. I am having a similar problem then I got over worked, and I will fix my problem later.
  7. I guess so. I do not understand your code there. How would that work. And my bbcode is a function I made: <?php function BBCode($Text) { // Replace any html brackets with HTML Entities to prevent executing HTML or script // Don't use strip_tags here because it breaks [url] search by replacing & with amp $Text = str_replace("<", "<", $Text); $Text = str_replace(">", ">", $Text); // Convert new line chars to html <br /> tags $Text = nl2br($Text); // Set up the parameters for a URL search string $URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'"; // Set up the parameters for a MAIL search string $MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@"; // Perform URL Search $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" target="_blank">$1</a>', $Text); $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text); //$Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text); // Perform MAIL Search $Text = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '<a href="mailto:$1">$1</a>', $Text); $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.+?)\[\/mail\]/", '<a href="mailto:$1">$2</a>', $Text); // Check for bold text $Text = preg_replace("(\[b\](.+?)\[\/b])is",'<b>$1</b>',$Text); // Check for Italics text $Text = preg_replace("(\[i\](.+?)\[\/i\])is",'<i>$1</i>',$Text); // Check for Underline text $Text = preg_replace("(\[u\](.+?)\[\/u\])is",'<u>$1</u>',$Text); // Check for strike-through text $Text = preg_replace("(\[s\](.+?)\[\/s\])is",'<s>$1</s>',$Text); // Check for over-line text $Text = preg_replace("(\[o\](.+?)\[\/o\])is",'<o>$1</o>',$Text); // Check for colored text $Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1\">$2</span>",$Text); // Check for sized text $Text = preg_replace("(\[size=(.+?)\](.+?)\[\/size\])is","<span style=\"font-size: $1px\">$2</span>",$Text); // Check for img text $Text = preg_replace("(\[img\](.+?)\[\/img\])is",'<img src="$1">',$Text); //Emoteicons $epath = $path."main/style/img/bb/"; $Text = preg_replace("()is",'<img src="'.$epath.'cheesy.gif">',$Text); $Text = preg_replace("()is",'<img src="'.$epath.'cheesy.gif">',$Text); $Text = preg_replace("()is",'<img src="'.$epath.'tongue.gif">',$Text); $Text = preg_replace("()is",'<img src="'.$epath.'tongue.gif">',$Text); $Text = preg_replace("(:\))is",'<img src="'.$epath.'smiley.gif">',$Text); $Text = preg_replace("(:\(\()is",'<img src="'.$epath.'cry.gif">',$Text); $Text = preg_replace("(\>:\()is",'<img src="'.$epath.'embarrassed.gif">',$Text); $Text = preg_replace("(\>:\()is",'<img src="'.$epath.'angry.gif">',$Text); $Text = preg_replace("(:\()is",'<img src="'.$epath.'sad.gif">',$Text); $Text = preg_replace("(;\))is",'<img src="'.$epath.'wink.gif">',$Text); $Text = preg_replace("(:\)\))is",'<img src="'.$epath.'grin.gif">',$Text); $Text = preg_replace("(>:\()is",'<img src="'.$epath.'angry.gif">',$Text); $Text = preg_replace("(8\))is",'<img src="'.$epath.'cool.gif">',$Text); $Text = preg_replace("(\?\?\?)is",'<img src="'.$epath.'huh.gif">',$Text); $Text = preg_replace("(::\))is",'<img src="'.$epath.'rolleyes.gif">',$Text); $Text = preg_replace("(:\/)is",'<img src="'.$epath.'undecided.gif">',$Text); $Text = preg_replace("(:X)is",'<img src="'.$epath.'lipsrsealed.gif">',$Text); $Text = preg_replace("(:x)is",'<img src="'.$epath.'lipsrsealed.gif">',$Text); $Text = preg_replace("()is",'<img src="'.$epath.'shocked.gif">',$Text); $Text = preg_replace("(:0)is",'<img src="'.$epath.'shocked.gif">',$Text); $Text = preg_replace("()is",'<img src="'.$epath.'shocked.gif">',$Text); $Text = preg_replace("(:K)is",'<img src="'.$epath.'kiss.gif">',$Text); $Text = preg_replace("(:k)is",'<img src="'.$epath.'kiss.gif">',$Text); // Check for list text $Text = preg_replace("/\[list\](.+?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text); $Text = preg_replace("/\[list=1\](.+?)\[\/list\]/is", '<ul class="listdecimal">$1</ul>' ,$Text); $Text = preg_replace("/\[list=i\](.+?)\[\/list\]/s", '<ul class="listlowerroman">$1</ul>' ,$Text); $Text = preg_replace("/\[list=I\](.+?)\[\/list\]/s", '<ul class="listupperroman">$1</ul>' ,$Text); $Text = preg_replace("/\[list=a\](.+?)\[\/list\]/s", '<ul class="listloweralpha">$1</ul>' ,$Text); $Text = preg_replace("/\[list=A\](.+?)\[\/list\]/s", '<ul class="listupperalpha">$1</ul>' ,$Text); $Text = str_replace("[*]", "<li>", $Text); // Check for font change text $Text = preg_replace("(\[font=(.+?)\](.+?)\[\/font\])","<span style=\"font-family: $1;\">$2</span>",$Text); // Declare the format for [code] layout $CodeLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="quotecodeheader"> Code:</td> </tr> <tr> <td class="codebody">$1</td> </tr> </table>'; // Check for [code] text $Text = preg_replace("/\[code\](.+?)\[\/code\]/is","$CodeLayout", $Text); // Declare the format for [code=php:0] layout $phpLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="quotecodeheader"> Code:</td> </tr> <tr> <td class="codebody">$1</td> </tr> </table>'; // Check for [code=php:0] text $Text = preg_replace("/\[php\](.+?)\[\/php\]/is",$phpLayout, $Text); // Declare the format for [quote] layout $QuoteLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="quotecodeheader"> Quote:</td> </tr> <tr> <td class="quotebody">$1</td> </tr> </table>'; // Check for [quote] text $Text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","$QuoteLayout", $Text); // Images // [img=pathtoimage] $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text); // [img=widthxheight]image source[/img] $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" height="$2" width="$1">', $Text); //Name //:name: $user = $session->username; $Text = preg_replace("-:name:-" , $user, $Text); return $Text; } ?> [/code][/code]
  8. ya pull the data from the database, then check it and if the new number equals one of the other one, run it again.
  9. I am working on my BB code script, and my angry smily and my embarrassed smily are not working. when you type "< and ") they are suppose to look like , but they come out as < and > <?php $Text = preg_replace("(\<:\()is",'<img src="'.$epath.'embarrassed.gif">',$Text); $Text = preg_replace("(\>:\()is",'<img src="'.$epath.'angry.gif">',$Text); ?> -Thanks
  10. please put your code in the code tags, and it is very unsafe to link to your admin page. I suggest you use a pre built login system to help secure your website. Here use this one: http://www.evolt.org/PHP-Login-System-with-Admin-Features
  11. oh yea some code: bb_code.php: <?php function BBCode($Text) { // Replace any html brackets with HTML Entities to prevent executing HTML or script // Don't use strip_tags here because it breaks [url] search by replacing & with amp $Text = str_replace("<", "<", $Text); $Text = str_replace(">", ">", $Text); // Convert new line chars to html <br /> tags $Text = nl2br($Text); // Set up the parameters for a URL search string $URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'"; // Set up the parameters for a MAIL search string $MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@"; // Perform URL Search $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" target="_blank">$1</a>', $Text); $Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text); //$Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text); // Perform MAIL Search $Text = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '<a href="mailto:$1">$1</a>', $Text); $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.+?)\[\/mail\]/", '<a href="mailto:$1">$2</a>', $Text); // Check for bold text $Text = preg_replace("(\[b\](.+?)\[\/b])is",'<b>$1</b>',$Text); // Check for Italics text $Text = preg_replace("(\[i\](.+?)\[\/i\])is",'<i>$1</i>',$Text); // Check for Underline text $Text = preg_replace("(\[u\](.+?)\[\/u\])is",'<u>$1</u>',$Text); // Check for strike-through text $Text = preg_replace("(\[s\](.+?)\[\/s\])is",'<s>$1</s>',$Text); // Check for over-line text $Text = preg_replace("(\[o\](.+?)\[\/o\])is",'<o>$1</o>',$Text); // Check for colored text $Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1\">$2</span>",$Text); // Check for sized text $Text = preg_replace("(\[size=(.+?)\](.+?)\[\/size\])is","<span style=\"font-size: $1px\">$2</span>",$Text); // Check for img text $Text = preg_replace("(\[img\](.+?)\[\/img\])is",'<img src="$1">',$Text); //Emoteicons $epath = $path."main/style/img/bb/"; $Text = preg_replace("()is",'<img src="'.$epath.'icon_biggrin.gif">',$Text); $Text = preg_replace("()is",'<img src="'.$epath.'icon_biggrin.gif">',$Text); $Text = preg_replace("(:\))is",'<img src="'.$epath.'icon_smile.gif">',$Text); // Check for list text $Text = preg_replace("/\[list\](.+?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text); $Text = preg_replace("/\[list=1\](.+?)\[\/list\]/is", '<ul class="listdecimal">$1</ul>' ,$Text); $Text = preg_replace("/\[list=i\](.+?)\[\/list\]/s", '<ul class="listlowerroman">$1</ul>' ,$Text); $Text = preg_replace("/\[list=I\](.+?)\[\/list\]/s", '<ul class="listupperroman">$1</ul>' ,$Text); $Text = preg_replace("/\[list=a\](.+?)\[\/list\]/s", '<ul class="listloweralpha">$1</ul>' ,$Text); $Text = preg_replace("/\[list=A\](.+?)\[\/list\]/s", '<ul class="listupperalpha">$1</ul>' ,$Text); $Text = str_replace("[*]", "<li>", $Text); // Check for font change text $Text = preg_replace("(\[font=(.+?)\](.+?)\[\/font\])","<span style=\"font-family: $1;\">$2</span>",$Text); // Declare the format for [code] layout $CodeLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="quotecodeheader"> Code:</td> </tr> <tr> <td class="codebody">$1</td> </tr> </table>'; // Check for [code] text $Text = preg_replace("/\[code\](.+?)\[\/code\]/is","$CodeLayout", $Text); // Declare the format for [code=php:0] layout $phpLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="quotecodeheader"> Code:</td> </tr> <tr> <td class="codebody">$1</td> </tr> </table>'; // Check for [code=php:0] text $Text = preg_replace("/\[php\](.+?)\[\/php\]/is",$phpLayout, $Text); // Declare the format for [quote] layout $QuoteLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="quotecodeheader"> Quote:</td> </tr> <tr> <td class="quotebody">$1</td> </tr> </table>'; // Check for [quote] text $Text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","$QuoteLayout", $Text); // Images // [img=pathtoimage] $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text); // [img=widthxheight]image source[/img] $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" height="$2" width="$1">', $Text); return $Text; } ?> up_in_act.php <?php ob_start(); $path = "../../"; $title = "Update Home"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $content = $_POST['update_text']; $title = $_POST['title']; if (empty($title)){ echo '<p class="header">Error</p>'; echo '<p class="maintext">'; echo "Please insert a title."; echo '<br><a href="up_ind.php"><--Back</a>'; echo '</p>'; include ($path."main/include/cons/foot.php"); exit; } if (empty($content)){ echo '<p class="header">Error</p>'; echo '<p class="maintext">'; echo "Please insert some content."; echo '<br><a href="up_ind.php"><--Back</a>'; echo '</p>'; include ($path."main/include/cons/foot.php"); exit; } include ($path."main/include/bb_code.php"); $content = BBCode($content); $q = "INSERT INTO `home` (content, title) VALUES ('$content', '$title')"; mysql_query($q); echo '<p class="header">Update Seccessful</p>'; echo '<p class="maintext">'; echo "Update Successful<br><br>"; echo '<a href="'.$path.'index.php">Home</a><br><a href="../index.php">Admin Center</a>'; echo "</p>"; }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> [/code][/code]
  12. I am working on my BBCODE, and I got most of it working, but my smiles are not like this ones on here, that are on the same line. My Smiles are way above the line, here is what I mean: www.krazypicks.com/index.php it is on the index page Is this php? Thanks
  13. ya I think that is it, let me try it out.
  14. WAMP is good, but my PHP files on my local machine look weird, so I used XAMPP
  15. I forgot the name of the function. What it does is when you enter text in a textfield, it adds the spaces. (I put this in the textfield) "Welcome to my page. Login Please" it comes out as: "Welcome to my page. Login Please" how can I make it look like what I put in the textfield?
  16. ha, I fixed it <?php $path = ""; $title = "Home"; $ban = "no"; $rank = "yes"; $num = 4; include ($path."main/include/cons/head.php"); $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1; $per_page = $num; $count_q = mysql_query("SELECT COUNT(id) FROM home ORDER BY id DESC"); $count_r = mysql_fetch_row($count_q); $count = $count_r[0]; if($page > ceil($count/$per_page)) $page = 1; $limit_min = ($page-1)*$per_page; $query = mysql_query("SELECT * FROM home ORDER BY id DESC LIMIT {$limit_min}, {$per_page}"); $sql = mysql_query("SELECT * FROM home ORDER BY id DESC"); $num_rows = mysql_num_rows($sql); if($num_rows < '1'){ echo '<p class="header">Welcome</p><p class="maintext">This is the default entry, if you are the admin, please login and add an entry.</p>'; } //while($row = mysql_fetch_array($sql)){ while($row = mysql_fetch_assoc($query)) { echo "<p class=\"header\">".$row['title']; if($session->logged_in){ if($session->isAdmin()){ echo " <font size='2'><a href=".$path."main/include/dele_top.php?cmd=delete&id=".$row['id'].">Delete Topic(".$row['id'].")</a></font>"; } } echo "</p><p class=\"maintext\">"; echo $row['content']; echo "</p>"; } $limit2 = $per_page; $q = "SELECT id FROM home"; $r = mysql_query($q); $num = ceil(mysql_num_rows($r) / $limit2); if($num != 1) { for($i = 1; $i <= $num; $i++) { /*if($page / $limit2 != $i)*/ echo "[<a href='?p=list&page=".$i."'>".$i."</a>] "; //else echo "[<b>".$i."</b>] "; } } include ($path."main/include/cons/foot.php"); ?>
  17. here is my paid system, it will kinda help you out with check boxs and what not: paid.php <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); $num = 0; if($session->isAdmin()){ print '<div class="box"><h2>Select Paid</h2>'; ?> <form action="pay_do.php" method="post"> <table width="87%" border="0"> <tr> <td width="42"><strong>#</strong></td> <td width="127"><strong>First Name </strong></td> <td width="148"><strong>Last Name </strong></td> <td width="203"><strong>Status (username) </strong></td> </tr> <?php $paid = "select * from users order by paid"; $q = mysql_query($paid) or die('Error: ' . mysql_error()); while ($rs=mysql_fetch_array($q)) { $id = $rs['username']; ?> <tr> <td><?php echo $num+=1; ?></td> <td><? echo $rs['first'];?> </td> <td><? echo $rs['last'];?></td> <td> <?php If($rs['paid'] == 0 ){ echo '<input type="checkbox" name="checkbox[]" value="'.$rs['username'].'" />'; } elseif($rs['paid'] == 1 ){ echo "<a href='pay_dele.php?cmd=delete&id=$id'>Paid</a>"; } echo " (".$rs['username'].")"; } ?> </td> </tr> </table> <br /> <input name="Submit" type="Submit" value="Update" /> </form> <?php }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?> pay_do.php <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); print '<div class="box">'; if($session->isAdmin()){ if(isset($_POST['Submit'])){ $boxes = $_POST['checkbox']; foreach($boxes as &$value){ if($value!=='') { $q = "UPDATE `users` SET `paid`=1 WHERE `username`='$value'"; echo $q.'<br />'; mysql_query($q); } } echo "<h2>Processed</h2>"; echo 'Selected users have been processed<br><a href="paid.php">Select Paid/Non-Paid</a>'; }else{ echo "<h2>Error!</h2>"; echo 'No data to process<br><a href="paid.php">Select Paid/Non-Paid</a>'; } }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?> pay_dele.php <?php include ("../../style/include/session.php"); include ("../../style/include/cons/head_2.php"); if($session->isAdmin()){ if(!isset($cmd)) { $result = mysql_query("select * from users order by paid"); while($r=mysql_fetch_array($result)) { $id=$r["username"];//take out the id //make the title a link echo "<a href='?cmd=delete&id=$id'>$id - Delete</a>"; echo "<br>"; } } if($_GET["cmd"]=="delete") { print '<div class="box"><h2>'.$id.' marked as not paid</h2>'; $q = "UPDATE `users` SET `paid`=0 WHERE `username`='$id'"; echo $q.'<br />'; mysql_query($q); print '<br><a href="paid.php">Back to paid</a>'; } }else{ header("Location: ../../index.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?> play around with those, they will help
  18. ok, I am still working on my index page, but now I am adding a pagination script I have had, and it worked well, but now I am running into problems. Here is what is happening, I set it to show 4 entrys per page, well it shows no links to any other pages when there are only 4 entys, but when I add another enrty, it shows all 5 on one page, but it shows how many page numbers there are suppose to be. And it does not add the fifth entry to the second page. I have no idea how to fix this one. here is the code: <?php $path = ""; $title = "Home"; $ban = "no"; $rank = "yes"; $num = 4; include ($path."main/include/cons/head.php"); $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1; $per_page = $num; $count_q = mysql_query("SELECT COUNT(id) FROM home ORDER BY id DESC"); $count_r = mysql_fetch_row($count_q); $count = $count_r[0]; if($page > ceil($count/$per_page)) $page = 1; $limit_min = ($page-1)*$per_page; $query = mysql_query("SELECT * FROM home ORDER BY id DESC LIMIT {$limit_min}, {$per_page}"); $sql = mysql_query("SELECT * FROM `home` ORDER BY `id` DESC"); $num_rows = mysql_num_rows($sql); if($num_rows < '1'){ echo '<p class="header">Welcome</p><p class="maintext">This is the default entry, if you are the admin, please login and add an entry.</p>'; } while($row = mysql_fetch_array($sql)){ echo "<p class=\"header\">".$row['title']; if($session->logged_in){ if($session->isAdmin()){ echo " <font size='2'><a href=".$path."main/include/dele_top.php?cmd=delete&id=".$row['id'].">Delete Topic(".$row['id'].")</a></font>"; } } echo "</p><p class=\"maintext\">"; echo $row['content']; echo "</p>"; } $limit2 = $per_page; $q = "SELECT id FROM home"; $r = mysql_query($q); $num = ceil(mysql_num_rows($r) / $limit2); if($num != 1) { for($i = 1; $i <= $num; $i++) { /*if($page / $limit2 != $i)*/ echo "[<a href='?p=list&page=".$i."'>".$i."</a>] "; //else echo "[<b>".$i."</b>] "; } } include ($path."main/include/cons/foot.php"); ?>
  19. lol I see my dumb mistake, there. Thanks
  20. On my homepage you can delete the entrys, but I want it to display a default message when you delete them all, in other words how can I tell if the database is empty? The database is structured like this: ID TITLE CONTENT and here is my whole code so far <?php $path = ""; $title = "Home"; $ban = "no"; $rank = "yes"; include ($path."main/include/cons/head.php"); $sql = mysql_query("SELECT * FROM `home` ORDER BY `id` DESC"); if($row['id'] < 1){ echo "nothing here"; } while($row = mysql_fetch_array($sql)){ echo "<p class=\"header\">".$row['title']; if($session->logged_in){ echo " <font size='2'><a href=".$path."main/include/dele_top.php?cmd=delete&id=".$row['id'].">Delete Topic(".$row['id'].")</a></font>"; } echo "</p><p class=\"maintext\">"; echo $row['content']; echo "</p>"; } include ($path."main/include/cons/foot.php"); ?> it displays nothing here, even when there is something there. Any Fixes?
×
×
  • 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.