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