|
|
|
|
![]() ![]() |
Oct 23 2004, 11:33 PM
Post
#1
|
|
|
Yami no Hime ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 296 Joined: 20-October 04 From: Lalaland Member No.: 1,849 |
hi if u open my page http://danieluchis.trap17.com/blog/display.php it just opens one post of my blog..and i add it comments but it doesn't seem to function!!!
the error is: Unknown column '4' in 'where clause' (which can be seen at the bottom right part of the page) here is ALL the display.php code CODE <?php // Put database connection variables here $hostname='localhost'; $user='xxxxx'; //'user name to access database'; $pass= 'xxxxx'; //'password'; $dbase='xxxxx; //'database name'; $connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL"); $db = mysql_select_db($dbase , $connection) or die ("Can't select database."); $q = "SELECT * from blog order by date desc "; $result= mysql_query($q, $connection) or die ("Could not execute query : $q." . mysql_error()); // dynamic navigation variables $rows_per_page= [B]10[/B]; // adjust the number here to display number of entries per page $total_records=mysql_num_rows($result); $pages = ceil($total_records / $rows_per_page); $screen = $_GET["screen"]; if (!isset($screen)) $screen=0; $start = $screen * $rows_per_page; $q .= "LIMIT $start, $rows_per_page"; $result= mysql_query($q, $connection) or die ("Could not execute query : $q." . mysql_error()); while ($row=mysql_fetch_array($result)) { $id=$row["id"]; $name=$row["name"]; $email=$row["email"]; $entry=$row["entry"]; $date=$row["date"]; $icon=$row["icon"]; $title=$row["$title"]; ?> <table width="80%" border="0" cellspacing="1" cellpadding="0"> <tr> <td><b><?php echo "$title"; ?></b></td> </tr> <tr> <td> <p><img src="<?php echo "$icon"; ?>" alt="icon" align="left"><?php echo "$entry"; ?></p> <p><a href="mailto:<?php echo "$email"; ?>"><?php echo "$name"; ?></a> Cried at <?php echo " $date"; ?>.</p> </td> </tr> </table> <p align="right"> <?php $query = "select id from blog_comments where blog_id=`$id` "; $ret = mysql_query($query) or die (mysql_error()); $comment_num = mysql_num_rows($ret); // display number of comments echo "<a href=\"readcomments.php?id=$id\">$comment_num</a>"; ?> </p> <?php } #while ?> <div align=center> <?php // Display dynamic navigation here // create the dynamic links if ($screen > 0) { $j = $screen - 1; $url = "display.php?screen=$j"; echo "<a href=\"$url\">Prev</a>"; } // page numbering links now for ($i = 0; $i < $pages; $i++) { $url = "display.php?screen=" . $i; $j = $i + 1; echo " | <a href=\"$url\">$j</a> | "; } if ($screen < $pages-1) { $j = $screen + 1; $url = "display.php?screen=$j"; echo "<a href=\"$url\">Next</a>"; } ?> </div> and that's all also.. i have 4 posts till now with TITLE that doesnt seems to appear too u_u..buuhhhh T__T can someone help me? im kinda n00b at php & mysql |
|
|
|
Oct 24 2004, 12:56 AM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 148 Joined: 23-August 04 Member No.: 883 |
This here , you using two tables , can you only have fully data in first table !
I don't found any errors in your code ! |
|
|
|
Oct 24 2004, 02:19 AM
Post
#3
|
|
|
Yami no Hime ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 296 Joined: 20-October 04 From: Lalaland Member No.: 1,849 |
hmmm i see.. thx.. ill try to fix it (still not working properly)
|
|
|
|
Oct 24 2004, 07:15 PM
Post
#4
|
|
|
Yami no Hime ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 296 Joined: 20-October 04 From: Lalaland Member No.: 1,849 |
well, thx anyway i already made it function.. it was an error of ' ' n__nU they where `id` instead of 'id'
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 03:54 PM |