Displaying Content after passing value from db

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maboroshi
Forum Commoner
Posts: 25
Joined: Thu Nov 13, 2003 10:10 am

Displaying Content after passing value from db

Post by maboroshi »

Hello this question has probably been asked a million times

I am generating a link based on the id from a mysql db

Code: Select all

<A HREF="moredata.php?moredata=<? echo $myid ?>"><? echo $row&#1111;'title']; ?></A><BR>
I then display the information on the moredata.php page

Code: Select all

<?php


	$link = mysql_connect("local", "user", "pass");

	if (!$link) &#123;
	print "Error connecting to database";
	exit;
	&#125;
	
	if (!@mysql_select_db("engrooved")) &#123;
		print "Could not select Database";
		exit;
		&#125;

$id = (int) $_GET&#1111;'myid'];

$result = mysql_query("select * from knowledge where id=$id");
	if ($result && @mysql_num_rows($result) > 0 ) &#123;
		while ($row = mysql_fetch_array($result))
			&#123;


$text .= $row&#1111;'title'];
$text .= "<br><br>";
$text .= $row&#1111;'author'];
$text .= "<br><br>";
$text .= $row&#1111;'body'];

echo $text;

&#125;
&#125;
?>

But for some reason the data does not display

I don't know what I am doing wrong

any help would be appreciated

Cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_GET['moredata'] not $_GET['myid']
Post Reply