I have a database and want to display data in rows then create a link to show the whole data when selected. Kindly guide me how to get the right php script for creating the link to display the whole row from database.

Member Avatar for LastMitch

@safgom

I have a database and want to display data in rows then create a link to show the whole data when selected. Kindly guide me how to get the right php script for creating the link to display the whole row from database.

Here is a link about Display database content as links it's very base idea about creating links:

http://www.yourwebskills.com/mysqllinks.php

This link is a lttle more advance:

http://www.ehow.com/how_5162276_create-dynamic-pages-php.html

Both links show you how to display data and create a link.

commented: To Rectify what some retard did to LastMitch +0

Thank you for sharing information about this, i really enjoy reading discussion on it. Hope to see more amazing post on you forum.

The links have really helped me create paginations. Again i need help on another issue such that once you create and save an entire form in the database, the display is by like first name of which is displayed as a link. when you select it, it shows all the information regarding that page. Any assistance will be highly appreciated. Thank you.

Member Avatar for LastMitch

@safgom

Again i need help on another issue such that once you create and save an entire form in the database, the display is by like first name of which is displayed as a link.

Then you should used a query to select that row and echo out the first name

The query is in here it's in 7 & 8:

http://www.ehow.com/how_5162276_create-dynamic-pages-php.html

Help me understand this last paragraph. <<<To create a dynamic link, add a "?" mark at the end of the file extension, followed by "page=" and set it equal to the column in the database called "id". As long as the "select" query is "ORDERED BY" "id", then the links will connect to each record in the order that they were entered into the database table.>>>
I need to have database items appear as single rows but when you click on it, it opens the whole form data. Thanks for your support.

Help me understand this last paragraph. <<<To create a dynamic link, add a "?" mark at the end of the file extension, followed by "page=" and set it equal to the column in the database called "id". As long as the "select" query is "ORDERED BY" "id", then the links will connect to each record in the order that they were entered into the database table.>>>
I need to have database items appear as single rows but when you click on it, it opens the whole form data. Thanks for your support.

Member Avatar for LastMitch

@safgom

Help me understand this last paragraph. <<<To create a dynamic link, add a "?" mark at the end of the file extension, followed by "page=" and set it equal to the column in the database called "id". As long as the "select" query is "ORDERED BY" "id", then the links will connect to each record in the order that they were entered into the database table.>>>

Something like this:

<a href="safgom.php?saf_id=<?php echo $gom['saf_id'];?>">

I need to have database items appear as single rows but when you click on it, it opens the whole form data.

You need do this:

$saf_id=$_GET['saf_id];

$query="SELECT * FROM table WHERE $saf_id = $saf_id";

$gom=mysql_fetch_assoc($query);

I am very grateful for the help you are giving me. I am missing out on sth while creating the links. Below is my code for displaying database content in rows, and i want to create a link to Textbox. Kindly show me how to do the coding. I want the textboz highlighted as a link and when you select it, it shows the contnt for the entire form.

<?
$rowsPerPage = 20;
$pageNum = 1;
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
$offset = ($pageNum - 1) * $rowsPerPage;

$query = mysql_query("SELECT * FROM FoyuuTourGuide ORDER BY id LIMIT $offset, $rowsPerPage");

while($r=mysql_fetch_array($query)) {
extract($r);
echo "$Textbox; $Textbox1; $Textbox2 <br/>";
echo "----------------------------------------------------<br/>";

}

// how many rows we have in database
$query = "SELECT COUNT(Textbox) AS numrows FROM FoyuuTourGuide ORDER BY id ";
$result = mysql_query($query) or die('Error, query failed Part 2');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);

// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page "; // no need to create a link to current page
}
else
{
$nav .= " <a href=\"$self?page=$page\">$page</a> ";
}
}

if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"$self?page=$page\">[Prev]</a> ";

$first = " <a href=\"$self?page=1\">[First Page]</a> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"$self?page=$page\">[Next]</a> ";
$last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// Print the navigation links
echo $nav . "<br />";
echo $next . "  " . $prev . "<br />";
echo $first . "  " . $last;
// Close the connection to the database
mysql_close();
?>
Member Avatar for LastMitch

@safgom

Below is my code for displaying database content in rows, and i want to create a link to Textbox. Kindly show me how to do the coding. I want the textboz highlighted as a link and when you select it, it shows the contnt for the entire form.

This is wrong:

echo "$Textbox; $Textbox1; $Textbox2 <br/>";

that's not how you echo the textbox

Read this so you have a better idea how you echo out a textbox:

http://www.w3cyberlearning.com/php/php_form_textbox.php

So far base on the current you are almost done unless you are making more changes

Sorry to trouble you, textbox in my case is just the DESCRIPTION OF AN ARTICLE, textbox1 is THE NAME OF COUNTRY THE AUTHOR RECIDES IN. textbox2 is THE TOWN WHERE THE AUTHOR RECIDES IN. so as you can see, textbox is the name of one column. textbox1 name of column 2..... i need the content for the form displayed on the webpage just one row with NAME OF AN ARTICLE. when you select the name of an artcile, it will populate the entire form which has name of author, contry of residence and contents of the article which includes the photos uploaded. The form for uploading is quite okay though. Thanks for your support.

Member Avatar for LastMitch

@safgom

Sorry to trouble you, textbox in my case is just the DESCRIPTION OF AN ARTICLE, textbox1 is THE NAME OF COUNTRY THE AUTHOR RECIDES IN. textbox2 is THE TOWN WHERE THE AUTHOR RECIDES IN. so as you can see, textbox is the name of one column. textbox1 name of column 2..... i need the content for the form displayed on the webpage just one row with NAME OF AN ARTICLE. when you select the name of an artcile, it will populate the entire form which has name of author, contry of residence and contents of the article which includes the photos uploaded. The form for uploading is quite okay though. Thanks for your support.

I got no idea what you just said? You want echo out a form right? The link I provide show how you echo out a form. Regarding about echo out a row then you need a query like I mention from the preivous post that you need a query to select that row and echo it out.

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.