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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.