Brain going mushy, please help!
My code:

$reguser = $_COOKIE['ID_my_site'];
function curPageName() {
 return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
$currentpage = curPageName();
echo "$currentpage";

Connect to the db then:

$query = ("SELECT rstextresume FROM scuserspro WHERE profilemng = '$currentpage'")or die(mysql_error());
$result = mysql_query($query);
if($result == false)
{
   user_error("Query failed: " . mysql_error() . "<br />\n$query");
}
elseif(mysql_num_rows($result) == 0)
{
   echo "<p>Sorry, no rows were returned by your query.</p>\n";
}
else
{
   while($query_row = mysql_fetch_assoc($result))
   {
      foreach($query_row as $key => $string)
      {
         echo "$key: $string<br />\n";

Finally:

$filename = $result;
$file = fopen($filename, 'r');
$contents = fread($file, filesize($filename));
fclose($file);
echo nl2br($contents);

In a nutshell:
1. Get name of current page.
2. Look up name in DB and get file name.
3. Open/read file into page.

It's not working. I am sure it is a very stupid thing or multiple thereof.
I bow and pray to you Gods on the Mount of Good Coding to answer this neophyte's call for help and offer thanks and sacrafice's on the alter of Linux.

Recommended Answers

All 2 Replies

what do you mean by not working, what exact problem you are facing?
what is there in db, because i dont see any relation between your db code and final code.

Solved, forgot string to result. Dumb.

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.