• Help
  • Search
  • Login
  • Register
  • Home

Forum: web design and graphics community

Celestial Star Forum > Web Development > Coding > Comments in db
Pages: [1]
« previous next »
  Print  
Author Topic: Comments in db  (Read 918 times)
silentstorm
Angeling
*
Posts: 2


View Profile WWW
Comments in db
« on: October 15, 2005, 03:41:52 PM »

I want to know if their is a way to let people leave comments on my graphics and layouts, I have been everywhere but their is no tutorial or downloadable thing for it. This is my layouts.php coding if you know how can you please help.


Code:

<? include("header.php"); ?>
<td valign="top" align="center">&nbsp;&nbsp;
<?php

include &#40;'connection.php'&#41;;

$displayGroup = 5;
if &
#40;$_GET['group'&#93;&#41; &#123;
$displayGroup = $_GET['group'&#93;;
&#125;

$page=0;
if &
#40;$_GET['screen'&#93;&#41; &#123;
$page = $_GET['screen'&#93;;
&#125;

$firstRow = $page * $displayGroup;
$lastRow = $firstRow + $displayGroup;
$currentRow = 0;
$totalRows = 0;
$numberDisplayed = 0;

$result = mysql_query
&#40;"select * from layouts where type='$type' order by added desc"&#41;;
if &#40;!$result&#41; &#123;
echo "<p>There is no data available!</p>";
return;
&
#125;
while&#40; $r=mysql_fetch_array &#40;$result&#41;&#41;
&#123;

$totalRows++;

if &
#40; &#40;$numberDisplayed <= $displayGroup&#41; &&
&#40;$currentRow >= $firstRow&#41; &&
&#40;$currentRow < $lastRow&#41;&#41;
&#123;
$numberDisplayed++;

$id=$r["id"&#93;;
$title=$r["title"&#93;;
$artist=$r["artist"&#93;;
$added=$r["added"&#93;;
$type=$r["type"&#93;;
$img=$r["img"&#93;;
$preview=$r["preview"&#93;;
$download=$r["download"&#93;;
$dcounter=$r["dcounter"&#93;;
$pcounter=$r["pcounter"&#93;;

echo "
<table width=\"260\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\">
<tr>
<td class=\"head\" width=\"260\" height=\"10\">>> $title <<</td><p>
</tr>
<td style=\"border&#58; #744C7D; border-style&#58; dotted; border-width&#58; 1px;\" width=\"260\" bgcolor=\"#21BEDF\" bordercolor=\"#744C7D\">
<img src=\"$img\" align=\"left\">

ID&#58; $id<BR>
Title&#58; $title<BR>
Artist&#58; $artist<BR>
Added&#58; $added<BR>
Type&#58; $type<BR>
Previewed&#58; $pcounter<BR>
Downloaded&#58; $dcounter<BR>
</td>
<p>
</tr>

<tr>
<td class=\"head\" width=\"260\" height=\"10\">
<a href=\"design.php?do=preview&id=$id\">Preview</a> |
<a href=\"design.php?do=download&id=$id\">Download</a>
</td>
</tr>
</table>
<br>"
;

&
#125;
$currentRow++;
&
#125;

echo "<div align=\"center\">";

$separator = "";

if &
#40;$page > 0&#41; &#123;
$prev = $page-1;
$url = "index.php?link=layouts&type=$type&screen=$prev";
echo 
"<a href=\"$url\">Previous</a>";
$separator = " | ";
&
#125;

$pageNum = 1;
$row = 0;
while &
#40;$row < $totalRows&#41; &#123;
$screenNum = $pageNum - 1;
$url = "index.php?link=layouts&type=$type&screen=$screenNum";
echo 
"$separator";
if &
#40;$screenNum == $page&#41;
echo "<b>$pageNum</b>";
else
echo 
"<a href=\"$url\">$pageNum</a>";
$separator = " | ";
$row = $row + $displayGroup;
$pageNum++;
&
#125;
$next = $page+1;
if &
#40;&#40;$next * $displayGroup&#41; < $totalRows&#41; &#123;
$url = "$PHP_SELF?screen=$next";
echo 
"$separator<a href=\"$url\">Next</a>";
&
#125;

echo "</div>";
?>

</td>
<? include("footer.php"); ?>
[/code]
Logged
puretaurus21
Guest
Comments in db
« Reply #1 on: October 20, 2005, 06:57:24 AM »

Well its very easy. Just get the DDG code for the blog and incorporate it to your system. Its as easy as pie. I even have it in my site. Go try it first and if you get stuck come to us. =)
Logged
silentstorm
Angeling
*
Posts: 2


View Profile WWW
Comments in db
« Reply #2 on: October 23, 2005, 02:48:24 PM »

I can't figure it out at all, is their any way you can help me get started.
Logged
puretaurus21
Guest
Comments in db
« Reply #3 on: November 21, 2005, 09:34:39 PM »

Well first of all, you just need a single database for your comments only.

http://www.daydreamgraphics.com/d/tutorial/list/81/2

Like what it is seen on this page, just convert everything like the name of the files into designcomments.php something like that. Then put it on your code, like so:

 

Code:
echo "
<table width=\"260\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\">
<tr>
<td class=\"head\" width=\"260\" height=\"10\">>> $title <<</td><p>
</tr>
<td style=\"border: #744C7D; border-style: dotted; border-width: 1px;\" width=\"260\" bgcolor=\"#21BEDF\" bordercolor=\"#744C7D\">
<img src=\"$img\" align=\"left\">

ID: $id<BR>
Title: $title<BR>
Artist: $artist<BR>
Added: $added<BR>
Type: $type<BR>
Previewed: $pcounter<BR>
Downloaded: $dcounter<BR>
<a href=\"designcomments.php?id=$id\">Comment?</a>.
</td>
<p>
</tr>

<tr>
<td class=\"head\" width=\"260\" height=\"10\">
<a href=\"design.php?do=preview&id=$id\">Preview</a> |
<a href=\"design.php?do=download&id=$id\">Download</a>
</td>
</tr>
</table>
<br>";


Just try that and if you get stuck post it here and I'll help you. I'll help you show how many people commented after you have done that task.
Logged
Pages: [1]
  Print  
« previous next »
 
Jump to:  

  • Welcome, Guest
  • Members login
  • Register for free

General

  • General
  • New members
  • Announcements
  • Support / Suggestions

Art boards

  • Creative mediums
  • Requests and offers
  • Tutorials
  • Celestial Star tutorials

Web development

  • Coding
  • Web design
  • Advertisements / affiliation

Off-topic

  • The non-sense
  • Ertentainment

Go up
eXTReMe Tracker
  • Valid XHTML
  • Valid CSS
Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC | Seo4Smf v0.2 © Webmaster's Talks
Loading...