Jump to content

PHP HELP Urgent

- - - - -

  • Please log in to reply
2 replies to this topic

#1
MaD-DoC

MaD-DoC

    Newbie

  • Members
  • Pip
  • 3 posts
I want Dispaly Order Details Order Table TO logged User..
I Have user_id feld in both order and user table ..
This Coding Is Not Working it will not show any values ..
please help me ...
thank you ..
<?php

require_once 'inc/connect.php';

//require_once 'library/database.php';



//checkUser();

if($_SESSION['signed_in'])

		{

	require_once 'inc/header.php';

echo 'Hello <b>' . htmlentities($_SESSION['user_id']) . ' </b>Welcome Back<br>';

	$sql = "SELECT od_id, od_date, od_status, od_shipping_first_name, SUM(pd_price * od_qty) + od_shipping_cost AS od_amount FROM tbl_order WHERE user_id = '".$_SESSION['user_id']."'";

	$result = mysql_query($sql);

	?>

    <p> </p>

 <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="text">

  <tr align="center" id="listTableHeader"> 

   <td width="411">Order ID</td>

   <td width="225">Order Date</td>

   <td width="120">Order Status</td>

   <td width="120">Name</td>

   <td width="120">Amount</td>

   <td width="70">Delete</td>

  </tr>

<?php

while($row = mysql_fetch_assoc($result)) {

	extract($row);

	

	if ($i%2) {

		$class = 'row1';

	} else {

		$class = 'row2';

	}

	

	$i += 1;

?>

  <tr class="<?php echo $class; ?>"> 

   <td><?php echo $od_id; ?></td>

   <td><?php echo $od_date; ?></td>

   <td width="120" align="center"><?php echo $od_status; ?></td>

   <td width="120" align="center"><?php echo $od_shipping_first_name 	; ?></td>

   <td width="120" align="center"><?php echo $od_amount; ?></td>

   <td width="70" align="center"><a href="javascript:deleteOrder(<?php echo $od_id; ?>);">Delete</a></td>

  </tr>

<?php

} // end while


?>

  <tr> 

   <td colspan="6"> </td>

  </tr>

  <tr> 

   <td colspan="6" align="right"> </td>

  </tr>

 </table>

 <p> </p>


<?php

	require_once 'inc/footer.php';

}

else

{

require_once 'inc/header.php';

?>

<table width="200" border="0" align="center">

  <tr class="entryTableHeader">

    <td align="center">Login In To Admin Panel</td>

  </tr>

  <tr class="content">

    <td align="center"a><a href="admin/index.php">Admin Panel</a></td>

  </tr>

</table>


<?PHP


   header( 'Location: admin/index.php' ) ;


require_once 'inc/footer.php';

}

?>



And I want to Know How Pass session Id to database when Submitting Form .. as hidden feld ..

How add php report ..

Thank You ... :)

#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,722 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript

<?php

while($row = mysql_fetch_assoc($result)) { 

    extract($row); 


    if ($i%2) { 

        $class = 'row1'; 

    } else { 

        $class = 'row2'; 

    } 

     

    $i += 1; 

[B][COLOR="RED"]?> [/COLOR][/B]

  <tr class="<?php echo $class; ?>">  

   <td><?php echo $od_id; ?></td> 

   <td><?php echo $od_date; ?></td> 

   <td width="120" align="center"><?php echo $od_status; ?></td> 

   <td width="120" align="center"><?php echo $od_shipping_first_name     ; ?></td> 

   <td width="120" align="center"><?php echo $od_amount; ?></td> 

   <td width="70" align="center"><a href="javascript:deleteOrder(<?php echo $od_id; ?>);">Delete</a></td> 

  </tr> 

[B][COLOR="RED"]<?php [/COLOR][/B]

} // end while 

?> 


Try getting rid of those.
sudo rm -rf /

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
You appear to not explicitly placing session_start() at the top of your script, you cannot access session variables.

Dargueta said:

Try getting rid of those.
Those PHP tags are needed, as he closes it to display HTML (utilizing inline PHP in the HTML instead)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users