Jump to content

Cant View Mysql Data into php


eyeore

Recommended Posts

Hello im new to php and i cant seems to view my database in my php 

	<?php
										include('../connect.php');
										$sds=$_SESSION['SESS_FIRST_NAME'];
										$result = mysql_query("SELECT * FROM paymentdetails WHERE idnumber='$sds'");
										while($row = mysql_fetch_array($result))
											{
												echo '<tr class="record">';
												echo '<td style="border-left: 1px solid #C1DAD7"><div align="left">'.$row['date'].'</div></td>';
												echo '<td><div align="left">'.$row['amount'].'</div></td>';
												echo '</tr>';
											}
										?> 
									</tbody>
								</table>

Here my database  im really confuse on what to do

 

CREATE TABLE IF NOT EXISTS `paymentdetails` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idnumber` varchar(30) NOT NULL,
  `date` varchar(30) NOT NULL,
  `amount` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `paymentdetails`
--

INSERT INTO `paymentdetails` (`id`, `idnumber`, `date`, `amount`) VALUES
(1, 'SID-YWU49JU', '2014-08-07', '50000');
Link to comment
Share on other sites

 

 

m really confuse on what to do

You need to debug your script.

 

Have you checked to make sure the $_SESSION['SESS_FIRST_NAME']; variable contains the expected value to be used in your query? Checked that your query has not returned any errors? Have you enabled PHP error reporting?

Link to comment
Share on other sites

Try,

<?php
ini_set('display_startup_errors', 1);

ini_set('display_errors', 1);

error_reporting(-1);

include('../connect.php');
$id = $_SESSION['SESS_MEMBER_ID'];
$result = mysql_query("SELECT * FROM student WHERE id='$id'") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
    echo '<tr class="record">';
    echo '<td style="border-left: 1px solid #C1DAD7"><div align="left">' . $row['date'] . '</div></td>';
    echo '<td><div align="left">' . $row['amount'] . '</div></td>';
    echo '</tr>';
}
?>

Why the columns idnumber, date and amount are varchar's type? Where do you start a session in your application?

Edited by jazzman1
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.