PHP/MySQL - Geting a row from a DB

jose22

New Member
Can someone help me with my script? It's supposed to read the user's session's \[code\]member_id\[/code\], find the corresponding row and echo it out. But when it runs, it outputs nothing.\[code\]<?php//Start sessionsession_start();//Make sure user is logged inrequire_once('auth.php');//Include database connection detailsrequire_once('config.php');//Connect to DB$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);if(!$link) {die('Failed to connect to server: ' . mysql_error());}//Select database$db = mysql_select_db(DB_DATABASE);if(!$db) {die("Unable to select database");}//Create Querys$query = "SELECT * FROM stats WHERE member_id='" . $_SESSION['SESS_MEMBER_ID'] . "' "; $result = mysql_query($query);//Gather the whole row into an arraywhile($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $row; } ?>\[/code\]
 
Back
Top