Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsZymic Free Web HostingDatabases & MySQL right
  Closed Topic Start new topic
left right
Noobkiller
post Nov 8 2008, 01:25 AM
Post #1


Newbie
*

Group: Members
Posts: 14
Joined: 28-July 08
Member No.: 50,260



Hi! I'm trying to display something from my database, but no luck! Here's the code

CODE
<?php
require "header.php";
?>
<body>
<?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "password") or die (mysql_error());
mysql_select_db("booo_db") or die (mysql_error());

$query="SELECT user_password FROM users WHERE user_name='Herb'";
$result=mysql_query($query) or die (mysql_error() );
$row=mysql_fetch_assoc($result);
// Print out the contents of each row into a table
print $row['user_password'];
?>
<?php
require "footer.php";
?>
Go to the top of the page 
 
  + Quote Post
Noobkiller
post Nov 9 2008, 08:15 PM
Post #2


Newbie
*

Group: Members
Posts: 14
Joined: 28-July 08
Member No.: 50,260



^ bump
Go to the top of the page 
 
  + Quote Post
swordz
post Nov 9 2008, 09:16 PM
Post #3


Outrageously Uber Ninja
*******

Group: Moderators
Posts: 1,805
Joined: 10-July 08
From: UK
Member No.: 44,994



QUOTE(Noobkiller @ Nov 8 2008, 01:25 AM) *
Hi! I'm trying to display something from my database, but no luck! Here's the code

CODE
<?php
require "header.php";
?>
<body>
<?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "password") or die (mysql_error());
mysql_select_db("booo_db") or die (mysql_error());

$query="SELECT * FROM users WHERE user_name='Herb'";
$result=mysql_query($query) or die (mysql_error() );
$row=mysql_fetch_assoc($result);
// Print out the contents of each row into a table
print_r($row);
?>
<?php
require "footer.php";
?>


Try that. It won't look good, but I'm printing all of $row, just to see what it returns.

Obviously change your user name and password back first.

swordz
Go to the top of the page 
 
  + Quote Post
 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 23rd May 2013 - 11:13 AM