Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Mysql Error...i'm Getting Upset !, i tried 4 times but nothing..help plz!!!
Danieluchis
post 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
Go to the top of the page
 
+Quote Post
NuHoaXuLa
post 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 !
Go to the top of the page
 
+Quote Post
Danieluchis
post 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)
Go to the top of the page
 
+Quote Post
Danieluchis
post 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'
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Problem On Mysql "order By"(5)
  2. Php News Script(19)
  3. Trouble With Emailer.php(6)
  4. Increment A Mysql Column(7)
  5. Parse: Error Unexpected T_lnumber(4)
  6. Can You Add Images Into A Mysql Database?(21)
  7. Subquery In Mysql(5)
  8. Creating Profiles In Php/mysql ?(7)
  9. Php Search Engine Script For Mysql Database(11)
  10. Some Mysql Basics(4)
  11. Problem With A Mysql Join(2)
  12. The Artists Tutorials :mysql Basic Commands(0)
  13. T_string Error Please Assist(5)
  14. [mysql]get Id Of Loged In User?(7)
  15. [mysql/php]need Som Basic Help(13)
  1. [php/mysql]id Trouble [resolved](3)
  2. Mysql Won't Update(5)
  3. Php + Mysql Question!(4)
  4. Php Objects: Catchable Fatal Error(4)
  5. Tools Needed!(9)
  6. Best Sites For Learning Php-mysql(4)
  7. Php And Mysql Programming(2)
  8. Best Php And Mysql Editor For Noobs(6)
  9. Html Form!(4)
  10. Mysql Error(3)
  11. Create Table - Mysql Code - Help(1)
  12. Linux/ Apache /mod_rewrite Issue(4)
  13. Getting Php Error On Oscommerce(3)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 03:54 PM