• Help
  • Search
  • Login
  • Register
  • Home

Forum: web design and graphics community

Celestial Star Forum > Web Development > Coding > New Question on preview/Download counter!!
Pages: [1]
« previous next »
  Print  
Author Topic: New Question on preview/Download counter!!  (Read 792 times)
lulusoccer
Angeling
*
Posts: 19


View Profile
New Question on preview/Download counter!!
« on: July 24, 2005, 08:31:00 PM »

Okay, I keep on getting the same problem, if I try to click on the links it gives me this error
"Could not execute query : SELECT * from  where id='3'.Query was empty"

Here is the page that has the counter on it:
http://www.eternal-dreamz.net/guildlayouts.php?category=full

If anybody could figure out why it's doing that, I would greatly appreciate it!.. Here are my codes if you want to see them:

View.php
Code:
<?php
include &#40;'connection.php'&#41;;

$query="SELECT * from guildlayouts order by name";
$result= mysql_query&#40;$q&#41; or die 
&#40;"Could not execute query &#58; $query." . mysql_error&#40;&#41;&#41;;

echo "<p align=center><b>Files Download</b></p>";
echo 
"<ol>";

while &
#40;$row=mysql_fetch_array&#40;$result&#41;&#41;
&#123;
$id=$row["id"&#93;;
$preview=$row["preview"&#93;;
$counter =$row["counter"&#93;;


echo "<li><a href=download.php?id=$id>$name</a></li>";
&
#125; 
?>



download.php:
Code:
<?php

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

$q="SELECT * from guildlayouts where id='$id'";
$result= mysql_query&#40;$query&#41; or die 
&#40;"Could not execute query &#58; $q." . mysql_error&#40;&#41;&#41;;

while &#40;$row=mysql_fetch_array&#40;$result&#41;&#41;
&#123;
$id=$row["id"&#93;;
$preview=$row["preview"&#93;;
$counter =$row["counter"&#93;;

header&#40;'Location&#58; '.$preview&#41;;

$q="update counter set counter=counter+1 where id='$id'";
$result= mysql_query&#40;$q&#41; or die 
&#40;"Could not execute query &#58; $q." . mysql_error&#40;&#41;&#41;;

&#125;

?>


guildlayouts.php:
Code:
<?php

include&#40;'header.php'&#41;;?>

<p class="head">|.:Neopet Guild Layouts:.|</p>
<div align="center">
<?php
include &#40;'database/connection.php'&#41;;

$category = $_GET['category'&#93;;
$query = "select * from `guildlayouts` where category='$category' order by id desc ";
$result= mysql_query&#40;$query, $connection&#41; or die
&#40;"Could not execute query &#58; $query." . mysql_error&#40;&#41;&#41;;

// Start  paging variables 
$screen = $_GET['screen'&#93;; 
$PHP_SELF = $_SERVER['PHP_SELF'&#93;; 
$rows_per_page=10;         // number of records per page 
$total_records=mysql_num_rows&#40;$result&#41;; 
$pages = ceil&#40;$total_records / $rows_per_page&#41;;        // calculate number of pages required 

if &#40;!isset&#40;$screen&#41;&#41; 
$screen=0; 
$start = $screen * $rows_per_page;        // determine start record 
$query .= " LIMIT $start, $rows_per_page";
$result= mysql_query&#40;$query&#41; or die
&#40;"Could not execute query &#58; $query." . mysql_error&#40;&#41;&#41;; 

while &#40;$row=mysql_fetch_array&#40;$result&#41;&#41;
&#123;
$id=$row['id'&#93;;
$name=$row['name'&#93;;
$artist=$row['artist'&#93;;
$category=$row['category'&#93;;
$date=$row['date'&#93;;
$preview=$row['preview'&#93;;
$previewimage=$row['previewimage'&#93;;
$code=$row['code'&#93;; 
$counter=$row['counter'&#93;; 
?>



<table id="tablelayouts">
<tr><td colspan="2" id="tablelayoutname"><?php echo "$name"; ?></td></tr>
<tr>
<td colspan="1" id="tablelayoutimage">
<img src="<?php echo "$previewimage"; ?>"></img></td>
<td colspan="1" width="170" valign="top"></img><b>Artist:</b> <?php echo "$artist"; ?><br><b>Category:</b> <?php echo "$category"; ?><br><b>Date:</b> <?php echo "$date"; ?><br><b>Preview:</b> <a href="<?php echo "database/download.php?id=$id"; ?>">Download</a> (<?php echo "$counter"; ?>) <br><b>Code:</b><br><div align="center"><textarea><?php echo "$code"; ?></textarea></div>
</tr></td></table><br>

<?php

&#125;

// create the dynamic links 
if &#40;$screen > 0&#41; &#123; 
$j = $screen - 1; 
$url = "guildlayouts.php?category=full&screen=$j"; 
echo 
"<a href=\"$url\">Prev</a>";        // generate the prev text link so long as page is not first page 
&#125; 

// page numbering links now 

for &#40;$i = 0; $i < $pages; $i++&#41; &#123;            // here we go thru a loop to get the page numbers 
$url = "guildlayouts.php?category=full&screen=" . $i;         
$j = $i + 1; 
echo 
" | <a href=\"$url\">$j</a> | "; 
&
#125; 

if &#40;$screen < $pages-1&#41; &#123;                // here we generate the next text link so long as page is not last page. 
$j = $screen + 1; 
$url = "guildlayouts.php?category=full&screen=$j"; 
echo 
"<a href=\"$url\">Next</a>"; 
&
#125; ?>


<?php include&#40;'footer.php'&#41;; ?>
</div>



Thanks!
Logged
Ryan
Angeling
*
Posts: 20



View Profile WWW
New Question on preview/Download counter!!
« Reply #1 on: July 31, 2005, 08:08:19 AM »

It seems ok here, did you fix the problem?
Logged

url=http://moonlit-magick.net]Moonlit-Magick.net[/url]
Melfina
Administrator
Valkyrie Randgris
*****
Posts: 1289



View Profile WWW
New Question on preview/Download counter!!
« Reply #2 on: July 31, 2005, 08:18:03 AM »

They're working for me now, so I guess she did fix it Smiley
Logged


MySpace  ~ MySpace Codex ~ Rune Nifelheim
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
  • Ententainment

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...