Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 4th, 2007, 01:44 PM
Authorized User
 
Join Date: Sep 2007
Location: Cincinnati, Ohio, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying Information Php/mysql

I am trying to create a user profile system, and I need to make it so users can choose whether or not to display information on their profiles.

How would I use PHP to retrieve information from a MySQL table, and if the table says display="yes", display the user's name.
__________________
Visit my website at GladiatorStudios.com!
Reply With Quote
  #2 (permalink)  
Old November 12th, 2007, 04:14 PM
Authorized User
 
Join Date: Dec 2006
Location: Burla, Orissa, India.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to paagle
Default

Simple:
make an enum field 'display' wid 'y' and 'n'

in the form give an option field

then in php code
<?php
$connect = mysql_connect($host,$user,$pass);
$db = mysql_select_db($dbname,$connect);
$sql = "SELECT `display` FROM `table` WHERE `user` = '".$some_user_variable."'";
$query = mysql_query($sql,$a);
$fetch = mysql_fetch_rows($query);
if($fetch[0] = 'y')
{ //Code to display username}
else
{//some other code}
?>

---
Paagle
TEAM LEADER-Team Xuberance(http://www.xuberance.com)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying images and information cherniin J2EE 0 April 23rd, 2007 01:12 AM
Displaying images stored in MySQL through in PHP trufla PHP Databases 3 May 2nd, 2006 04:55 AM
How to write files information to mysql db using p method PHP Databases 4 February 14th, 2006 09:18 PM
getting information from php into a iframe robertjshillito Beginning PHP 1 February 25th, 2005 04:05 PM
PHP ( Cannot modify header information) squared_ring Beginning PHP 6 August 14th, 2004 05:29 AM



All times are GMT -4. The time now is 07:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.