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?

$id is not set. Put the following on line 5:

$id = $_GET['id'];

Thank you, pritaeas, but it's not work :(

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.