Jump to content


Photo

Retreiving information from database


  • Please log in to reply
1 reply to this topic

#1 muramura

muramura
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 16 May 2006 - 09:58 PM

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.

#2 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 16 May 2006 - 10:02 PM

what does $cv_text contain? it might have some special character that messed up the url
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users