0

Link to the page

<a href="http://xxxx.com/u/'.$_SESSION['loginid'].'/index.php?user='.$_SESSION['loginid'].'">test</a>

index.php

<?php
if (isset($_GET['user'])){

define("HOST", "xxxx.xxxxxxx.com");

define("DBUSER", "xxxxx");
define("PASS", "xxxx");
define("DB", "xxxx");
$conn = mysql_connect(HOST, DBUSER, PASS) or  die('Could not connect !<br />Please contact the site\'s administrator.');
 
$db = mysql_select_db(DB) or  die('Could not connect to database !<br />Please contact the site\'s administrator.');
	
	
	
	
$user = $_GET['user'];
$query = "('SELECT * FROM articles WHERE loginid='$user'')";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) 
    {

		echo $row['title'];
	  	
	}
}
else
	die; "The post you are looking for is not here! It was deleted, moved or renamed by the author!";



?>

I get a blank page.
I have samples inside the database.

2
Contributors
15
Replies
16
Views
6 Years
Discussion Span
Last Post by Sorcher
0

PHP is a server side scripting language. Meaning it won't show anything client side unless you show something that isn't script....

For example:

<?php

$var

echo "<h1> Hello, ". $var. "</h1>";
?>

You know what I mean?

Put more html into your script....
0

Link to the page

<a href="http://xxxx.com/u/'.$_SESSION['loginid'].'/index.php?user='.$_SESSION['loginid'].'">test</a>

index.php

<?php
if (isset($_GET['user'])){

define("HOST", "xxxx.xxxxxxx.com");

define("DBUSER", "xxxxx");
define("PASS", "xxxx");
define("DB", "xxxx");
$conn = mysql_connect(HOST, DBUSER, PASS) or  die('Could not connect !<br />Please contact the site\'s administrator.');
 
$db = mysql_select_db(DB) or  die('Could not connect to database !<br />Please contact the site\'s administrator.');
	
	
	
	
$user = $_GET['user'];
$query = "('SELECT * FROM articles WHERE loginid='$user'')";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) 
    {

		echo $row['title'];
	  	
	}
}
else
	die; "The post you are looking for is not here! It was deleted, moved or renamed by the author!";



?>

I get a blank page.
I have samples inside the database.

View my comment
http://www.daniweb.com/forums/thread345068.html

0

Here let me show you how I coded "one" of my pages for a site I'm working on for a friend...

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> 
<title>Keldoch Computer Services Homepage</title>
<link rel="stylesheet" href="style.php" type="text/css" />
<script type="text/javascript">
<!--
function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

// -->
</script>
 </head>
<body onload="updateClock(); setInterval('updateClock()', 1000 )">


<?php   //See here
	$todaysDateM = gmdate("M");
	$todaysDateD = date("d");
	$todaysDateY = date("Y");
    echo "<h3>";
	 echo "Today's date is ". " " . $todaysDateM. " " . $todaysDateD . ", ". $todaysDateY. "</h3>";
?>

<div style="background-color:black; color:white; width: 8em">
<b>Time is:<br /><span id="clock">&nbsp;</span> </b>
</div>
<!-- banner -->

<h1 align="center">Welcome to Keldoch Computer Services</h1>
<center>
<?php include("menu.php"); ?>
</center>
<br />
<br />
<center>
<img src="service_banner.JPG" alt="Service Banner Pic" />
</center>
<!-- Banner End -->
<center>
<h1 align="center" style="font-weight:bold">What we offer...</h1> 
<table border="1" align="center" style="background-color:white">
<tr>
<th> Service</th>
<th>Price</th>
</tr>

<tr>
<td>Diagnostic/New Computer Setup/OS Install(With software)</td> <td>$40</td>
</tr>

<tr>
<td>PC Tune-up</td> <td>$20</td>
</tr>

<tr>
<td>Software Install/Removal</td><td>$10</td>
</tr>

<tr>
<td>OS Install without Software/Custom OS Install</td><td>$80</td>
</tr>

<tr>
<td>2hr Lesson/Custom Hardware install/Custom Service</td><td>$50</td>
</tr>

<tr>
<td>4hr Lesson</td><td>$100</td>
</tr>

<tr>
<th>All Computer Builds are available with Windows or Linux</th>
</tr>

<tr>
<td>Basic Build</td><td>Starting at $450</td>
</tr>

<tr>
<td>Internet Build(Wired)</td><td>Starting at $550</td>
</tr>

<tr>
<td>Internet Build(Wireless)/Entertainement Build</td><td>Starting at $650</td>
</tr>

<tr>
<td>Gaming Build</td><td>Starting at $700</td>
</tr>

</table>
</center>

<center>
 <p>
    <a href="http://validator.w3.org/check?uri=referer"><img
        src="http://www.w3.org/Icons/valid-xhtml10"
        alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
    <img style="border:0;width:88px;height:31px"
        src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
        alt="Valid CSS!" />
</a>
</p>
<?php include("foot_banner.php");  // You can embed Php into HTML that's essentially my point
?>
</center>
</body>
</html>
0

"To show the title from the loginid given by the URL"

Sorry, I didn't see this before. By the looks of your code you're coding likethe c++ syntax only PHP is a "variant of c++" What is DB, DBUSER and PASS by the way...

0

Ok i fixed the echo, now i get

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web068/b681/ipg.sorcher/uexplore/u/15/index.php on line 26['title'];
0

Check your query then.... and your "GET" syntax it's not wrong but it's going to have a run time error I think. $_GET[] or $_post[] is usually associated with forms just an FYI

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.