0

Hi, all!

It's me again. And i'm idiot.
I have in my table many-many articles. Their titles and anonses showed on page article.php

<?php
mysql_connect($host, $username, $password) or die(mysql_error());
	mysql_select_db($database) or die(mysql_error());
	mysql_query("SET NAMES utf8");


	$sql = "SELECT*FROM advicer ORDER BY id DESC LIMIT 4";
	$result= mysql_query($sql) or die(mysql_error());
	while ($row = mysql_fetch_array($result)){
		$id = $row['id'];
	echo '<a href="view.php?&id='.$id.'">' . '<h5>' . $row['title'] . '</h5>' . '</a>';
	echo '<p>' . $row['anons'] . '</p>';
	}
?>

It's work.
And user can to see one article if clicks on title

<?php
mysql_connect($host, $username, $password) or die(mysql_error());
	mysql_select_db($database) or die(mysql_error());
	mysql_query("SET NAMES utf8");
	
	$sql = "SELECT*FROM advicer WHERE id='$id'";
	$result= mysql_query($sql) or die(mysql_error());
	$row = mysql_fetch_array($result){
	echo '<h5>' . $row['title'] . '</h5>';
	echo '<p>' . $row['text'] . '</p>';
	}
?>

But it's not work. I see white page with url /view.php?&id=208
What is to be done? What is wrongly? Variable, syntaxis, method or my brain?

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by Stefano Mtangoo
0

Solved. Not close string

<?php
mysql_connect($host, $username, $password) or die(mysql_error());
	mysql_select_db($database) or die(mysql_error());
	mysql_query("SET NAMES utf8");
	$id = $_GET['id'];
	$sql = "SELECT*FROM advicer WHERE id='$id'";
	$result= mysql_query($sql) or die(mysql_error());
	$row = mysql_fetch_array($result) ; {
	echo '<h5>' . $row['title'] . '</h5>';
	echo '<p>' . $row['text'] . '</p>';
	}
?>

Thanx and sorry

0

Hi, all!

It's me again. And i'm idiot.

I disagree!
No idiot can write that much code :)
it is unfortunate that thread is closed but YOU CANNOT BE IDIOT

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.