Click to See Complete Forum and Search --> : sql->>php


lukezweb
12-13-2003, 06:18 AM
This is my sql table


CREATE TABLE `members` (
`username` TEXT NOT NULL ,
`password` TEXT NOT NULL ,
`email` TEXT NOT NULL ,
`posts` TEXT NOT NULL ,
`avatarurl` TEXT NOT NULL ,
`dateregistered` TEXT NOT NULL ,
`age` TEXT NOT NULL ,
`rank` TEXT NOT NULL ,
`sig` TEXT NOT NULL ,
`ipaddress` TEXT NOT NULL
);

i know how i can make this into a register form i was wondering thou how can you select a certain field say ip address belonging to the user 'jake' and then display it in a php page?

pyro
12-13-2003, 08:57 AM
# connect to the database
$sql = "SELECT `ipaddress` FROM `members` WHERE `username` = 'jake;";
$results = mysql_query($sql);
$data = mysql_fetch_array($results);
# $data['ipaddress'] OR $data[0] will equal the IP address - I prefer the former, as it is easier to read later on