Jump to content

Retreiving information from database


muramura

Recommended Posts

I have used this code to connect and retrieve data from the database

<?php

//address error handling.

ini_set('display_errors',1);
error_reporting(E_ALL & ~E_NOTICE);

//connect and select.
if( $dbc = mysqli_connect ('localhost', 'traineework', 'password', 'traineework'))
//define the query

$query = 'SELECT * FROM cvs order by created desc';
IF ($r = mysqli_query ($dbc, $query))
{
while ($row = mysqli_fetch_array ($r))
{
echo "<p><h3>{$row['profession']}</h3> <a href=\"cv_text.php?cv_text = $cv_text \">{$row['headline']}</a> </p>\n";
}


}
else{

die ('<p>could not select the database because:<b>' .mysqli_error($dbc). '</b></p>');
}

mysqli_close($dbc);


?>

My problem now is to provide a link to a page that will display the corresponding full text. For examlpe from the above code I would like the headline link to take one to the cv_text.php page that will have the rest of the text/article, the text/article is under column cv-text in my database.

This is the code in cv_text.php

<?php



ini_set('display_errors',1);
error_reporting(E_ALL & ~E_NOTICE);


$cv_text = $_GET['cv_text'];

print '<p>$cv_text</p>';

?>

But is gives me a blank page.

I hope this explains my problem.
Link to comment
https://forums.phpfreaks.com/topic/9814-retreiving-information-from-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.