eyeore Posted August 7, 2014 Share Posted August 7, 2014 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'); Quote Link to comment https://forums.phpfreaks.com/topic/290329-cant-view-mysql-data-into-php/ Share on other sites More sharing options...
Ch0cu3r Posted August 7, 2014 Share Posted August 7, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/290329-cant-view-mysql-data-into-php/#findComment-1487113 Share on other sites More sharing options...
jazzman1 Posted August 7, 2014 Share Posted August 7, 2014 (edited) 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 August 7, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/290329-cant-view-mysql-data-into-php/#findComment-1487116 Share on other sites More sharing options...
borrowed Posted August 8, 2014 Share Posted August 8, 2014 Thanks i got it working it was the damn $_SESSION['SESS_FIRST_NAME'] forget to put it on my login.php thanks and sorry to bother you guys Quote Link to comment https://forums.phpfreaks.com/topic/290329-cant-view-mysql-data-into-php/#findComment-1487176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.