Jump to content

Need Help


Joshua F

Recommended Posts

Why doesn't the code below show what should be shown?

 

<?php echo $list_b['username']; ?>

 

My Full PHP Code to Select The Items From Database

<?

if($_GET['t'] == '') {

$id="{$_GET['id']}";



ini_set('display_errors', '1');

error_reporting(E_ALL);



if ($list_q = mysql_query("SELECT * FROM main WHERE id='$id'")) {

  if (mysql_num_rows($list_q)) {

    while($list_b=mysql_fetch_array($list_q)) 

    {

?>

 

Note: This will be getting the id from the url(user.php?t=&id=#)

Link to comment
https://forums.phpfreaks.com/topic/203256-need-help/
Share on other sites

Okay, I am wanting it to display the username of the account you are viewing. But in XAMPP, you have to have "<?php code ?>" instead of "<? ?>", and the code I started out with started with "<? ?>" therefor, I couldnt use that because It wont display anything, so I am trying to make it echo it out with "<?php echo ?>".

Link to comment
https://forums.phpfreaks.com/topic/203256-need-help/#findComment-1064926
Share on other sites

This is my whole user.php code

 

<?php 

session_start();

include "includes/connect.php";

include "includes/stat_conf.php";

echo '<center>'

?>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="style.css" rel="stylesheet" type="text/css" />

</head>

<?

 

if($_GET['t'] == '') {

 

$id="{$_GET['id']}";

 

 

 

ini_set('display_errors', '1');

 

error_reporting(E_ALL);

 

 

 

if ($list_q = mysql_query("SELECT * FROM main WHERE id='$id'")) {

 

  if (mysql_num_rows($list_q)) {

 

    while($list_b=mysql_fetch_array($list_q))

 

    {

 

?>

<body>

<div id="container">

<div id="header">

<?php require 'includes/links.php'?>

</div>

<div id="content">

<?php require 'includes/menus.php'?>

 

<div id="middle">

<div class="post">

<div class="postheader"><h1><?php echo $list_b['id'];?></h1></div>

<div class="postcontent">

 

 

<?

}

}

}

}?>

</div>

<div class="postfooter"></div>

</div>

</div>

</div>

<div id="footer">

<?php require 'includes/links.php'?>

<?php require 'includes/footer.php'?> </div>

</div>

</body>

</html>[/php

Link to comment
https://forums.phpfreaks.com/topic/203256-need-help/#findComment-1064936
Share on other sites

If you view the source does the html content show up? I would say your query isn't finding any result.

 

Also, if your only expecting 1 record to be returned don't use a loop. If you did have more than record returned in this case your html would be broken because you would have multiple <body> tags.

Link to comment
https://forums.phpfreaks.com/topic/203256-need-help/#findComment-1064942
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.