Page 1 of 1

Displaying Content after passing value from db

Posted: Thu Mar 03, 2005 1:09 pm
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

Posted: Thu Mar 03, 2005 1:22 pm
by feyd
$_GET['moredata'] not $_GET['myid']