Jump to content
xisto Community
Sign in to follow this  
Danieluchis

Mysql Error...i'm Getting Upset ! i tried 4 times but nothing..help plz

Recommended Posts

hi if u open my page http://forums.xisto.com/no_longer_exists/ 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

<?php [br]// Put database connection variables here[/br]$hostname='localhost';[br]$user='xxxxx';	//'user name to access database';[/br]$pass= 'xxxxx';	//'password';	[br]$dbase='xxxxx;	//'database name';[br][/br]$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL");[/br]$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");[br][/br]$q = "SELECT * from blog order by date desc ";[br]$result= mysql_query($q, $connection) or die [/br]("Could not execute query : $q." . mysql_error());[br][/br][br]// dynamic navigation variables[/br]$rows_per_page= [B]10[/B]; 	 // adjust the number here to display number of entries per page [br]$total_records=mysql_num_rows($result);[/br]$pages = ceil($total_records / $rows_per_page);[br][/br]$screen = $_GET["screen"];[br]if (!isset($screen))[/br]$screen=0;[br]$start = $screen * $rows_per_page;[/br]$q .= "LIMIT $start, $rows_per_page";[br]$result= mysql_query($q, $connection) or die [/br]("Could not execute query : $q." . mysql_error());[br][/br][br]while ($row=mysql_fetch_array($result))[/br]{[br]	$id=$row["id"];[/br]	$name=$row["name"];[br]	$email=$row["email"];[/br]	$entry=$row["entry"];[br]	$date=$row["date"];[/br]	$icon=$row["icon"]; [br]	$title=$row["$title"];[br][/br]?>[br][/br]	<table width="80%" border="0" cellspacing="1" cellpadding="0">[/br]	<tr>[br]	<td><b><?php echo "$title"; ?></b></td>[/br]	</tr>[br]	<tr>[/br]	<td>[br]	<p><img src="<?php echo "$icon"; ?>" alt="icon" align="left"><?php echo "$entry"; ?></p>[/br]	<p><a href="mailto:<?php echo "$email"; ?>"><?php echo "$name"; ?></a> Cried at <?php echo "[br][/br]$date"; ?>.</p>[br]	</td>[/br]	</tr>[br]	</table>[/br]	<p align="right">[br]	[/br]	<?php[br]	[/br]	$query = "select id from blog_comments where blog_id=`$id` ";[br]	$ret = mysql_query($query) or die (mysql_error());[/br]	$comment_num = mysql_num_rows($ret);[br]	[/br]	// display number of comments[br]	echo "<a href=\"readcomments.php?id=$id\">$comment_num</a>";[br]	[/br]	?>[br]	[/br]	</p>[/br]	<?php[br]} #while[br]?>[/br]<div align=center>[br][/br]<?php[br][/br]// Display dynamic navigation here[br][/br]// create the dynamic links[/br]if ($screen > 0) {[br]$j = $screen - 1;[/br]$url = "display.php?screen=$j";[br]echo "<a href=\"$url\">Prev</a>";[/br]}[br][/br]// page numbering links now[br][/br]for ($i = 0; $i < $pages; $i++) {[br]$url = "display.php?screen=" . $i;[/br]$j = $i + 1;[br]echo " | <a href=\"$url\">$j</a> | ";[/br]}[br][/br]if ($screen < $pages-1) {[br]$j = $screen + 1;[/br]$url = "display.php?screen=$j";[br]echo "<a href=\"$url\">Next</a>";[/br]}[br][/br]?>[br][/br]</div>[br]
[/br]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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.