Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,207,696 members, 7,999,987 topics. Date: Monday, 11 November 2024 at 06:20 PM |
Nairaland Forum / Science/Technology / Programming / PHP Help: Problem With Database Output Display (1260 Views)
Help!!! Problem Installing Netbeans Ide / [Help Request] Help With Database Connectivity Error / Help With Database Development. (2) (3) (4)
PHP Help: Problem With Database Output Display by kok(m): 9:49am On Oct 03, 2012 |
Hello pals,I need some help on the codes below. I am trying to display a user db data upon signed-in,but it keep showing blank. Kindly help me check what I might av done wrong. Regards. <?php session_start(); include_once "images/connect_to_mysql.php"; if (isset($_SESSION['id'])) { $sql = mysql_query("SELECT * FROM vault WHERE id='$id' LIMIT 1" while($row = mysql_fetch_array($sql)){ $username = $row["username"]; $email = $row["email"]; $desc = $row["desc"]; $dep_type = $row["dep_type"]; $consg_code = $row["consg_code"]; $depositor = $row["depositor"]; $officer = $row["officer"]; $contact = $row["contact"]; $delivery = $row["delivery"]; $destination = $row["destination"]; } } ?> |
Re: PHP Help: Problem With Database Output Display by spikesC(m): 10:09am On Oct 03, 2012 |
where did the variable, $id, come from? If it is a development server, pls turn on all your error reporting and display. Also, run your mysql queries with a mysql administrative application to test it if it doesn't work as intended. |
Re: PHP Help: Problem With Database Output Display by kok(m): 10:20am On Oct 03, 2012 |
I av a column on the db named 'id' ,and i used it to save the session on the login page. |
Re: PHP Help: Problem With Database Output Display by Nobody: 10:26am On Oct 03, 2012 |
kok: I av a column on the db named 'id' ,and i used it to save the session on the login page. What do you really want to do? |
Re: PHP Help: Problem With Database Output Display by spikesC(m): 10:59am On Oct 03, 2012 |
kok: I av a column on the db named 'id' ,and i used it to save the session on the login page. From what i saw in your code, you're getting information from your database based on the $_SESSION['id']. Therefore, the variable $id should be declared with the value of $_SESSION['id']. Pls, turn your error reporting and display ON. You'll get the info am talking about. |
Re: PHP Help: Problem With Database Output Display by Nobody: 11:06am On Oct 03, 2012 |
<?php session_start(); include_once "images/connect_to_mysql.php"; if (isset($_SESSION['id'])) { $id = $_SESSION['id']; $sql = mysql_query("SELECT * FROM vault WHERE id='$id' LIMIT 1"; while($row = mysql_fetch_array($sql)){ $username = $row["username"]; $email = $row["email"]; $desc = $row["desc"]; $dep_type = $row["dep_type"]; $consg_code = $row["consg_code"]; $depositor = $row["depositor"]; $officer = $row["officer"]; $contact = $row["contact"]; $delivery = $row["delivery"]; $destination = $row["destination"]; } } ?> |
Re: PHP Help: Problem With Database Output Display by kok(m): 10:43am On Oct 04, 2012 |
Thanks to u guys. Much apology for reporting late. I found my way thru it using if (isset($_GET['id'])) { $sql = mysql_query("SELECT * FROM vault WHERE id='$id' LIMIT 1" ; But it still does not display output. I realize that wen I run a num row count to check user existence on db if (existCount = mysql_num_rows($sql); if ($existCount == 0) { header("location: index.php?msg=user_doesnt_exist" exit(); } it keep affirming "user_doesnt_exist",even when i manually enter data to the db. Any idea plz? |
(1) (Reply)
Iiht Free Boot Camp Training On Comptia A+ / My App Just Got Reviewed / Any Good Webdeveloper In Enugu?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |