humbug 5 Junior Poster in Training

If you want to update the page without reloading it you will have to use client side scripts such as Javascript. (PHP is a server side language and so all the php is executed before the page is sent to the clients browser.

You will have to do some research and tutorials in Javascript.

EDIT: AJAX is used in conjunction with Javascript to make calls back to the server. (This is needed if you want to actually get more information instead of just manipulating stuff that is already on the page).

humbug 5 Junior Poster in Training

I'm assuming it's just a bad tut because of the lack of attention to detail and testing. The @ symbol was never for variables.

humbug 5 Junior Poster in Training

It seems there is an error in the tutorial you are using. the "@" symbol is actually used to suppress an error that the following function might throw: http://www.tuxradar.com/practicalphp/19/8/12

I'm assuming the author ment that to be a "$" symbol, as that indicates a variable. that line should be [b]$[/b]AcmeInventory = (178,286,387); .

EDIT: If that doesn't work, change that line to this: $AcmeInventory = [B]array[/B](178,286,387); .

humbug 5 Junior Poster in Training

I'm not that familiar with streaming video but I'm quite sure that if you want the browser to show something, you must tell it where it is. The browser then determines what to do with it, so it can show that code to the user if they want.

All you can do is make it slightly harder to find by putting the URL in a JavaScript file in some form that you link to in your HTML. EG make a function that initiates the streaming and call it onLoad.

humbug 5 Junior Poster in Training

For each user you want to check, you would do something like this:
1. Get the timestamp for this user from the database SELECT last_activity FROM user_activity WHERE id=$id 2. Compare this value with the timestamp for 5 mins ago within PHP if ($last_activity > $now-60*5) { echo "online" } I couldn't be bothered looking up the PHP code for getting timestamps, or translating to and from MySQL timestamps, but you can do that :P

humbug 5 Junior Poster in Training

Sorry for not getting back to you about my idea. What I meant was, you store the timestamp for each user's last activity in the database. Then any time you want to check if someone is "active" you grab the timestamp and make the comparison.

You can also get a list of "active" user by doing (psuedocode) "SELECT * FROM user_activity WHERE timestamp>TIME()-60*5"

All you need to do for this is update the user's "last activity" timestamp every time they request a page, and you'll be laughing.

If you want it to be more accurate you can use AJAX to send a request to the server every 4 mins to tell the server that the user still has the webpage open in his/her browser.

Hope that helped. (I'm not saying the other way won't work either..)

Toxikr3 commented: Thank you! +1
humbug 5 Junior Poster in Training

Don't worry CFROG, I still do it. You skim over your code and remember what you should be there instead of reading what is there. Another set of eye's can spot it in no time. :P

humbug 5 Junior Poster in Training

Holy Moley, you'll hate your self for this :P You forgot a crucial line: mysql_query($sql); which should go on line 16. As your code stands, it doesn't execute the new SQL command, just sets the $sql variable.

Regarding the VALUE syntax, VALUE and VALUES are interchangeable.

humbug 5 Junior Poster in Training

The easiest way to do this would be to set a column "lastactivity" to the current time every time the user loads any of your pages (just build it into your authentication script). You can then classify someone as "online" if they have been active in the past 5 mins.

Hope that's close enough to what you're after.

Toxikr3 commented: Thanks for your help +1
humbug 5 Junior Poster in Training

The problem you are having is with your double quotes.

echo "value of the constant CONSTANT: " . CONSTANT;

notice the text in blue, this is a string. You are trying to put double quotes inside a string without escaping them. If you place a backslash directly before a double quote php will take it as a part of the string instead of the string termination:

//like this:
echo "value of the constant \"CONSTANT\": " . CONSTANT;
//not this:
echo "value of the constant "CONSTANT": " . CONSTANT;

Also, I don't think it is possible to put a string over multiple lines how you are. You should put them on one line and use '\n' (no quotes) to echo a new-line character.

humbug 5 Junior Poster in Training

You can use a for loop to operate on each element of the array. I'm assuming it's a one (meaningful) columned table.

//len is length of array
for (i=0; 0<len; i++){
  //create SQL statement
  sql="INSERT INTO table (row1) VALUES " . array[i];
  //[execute sql here]
}

Alternatively, you could do it like so, if it will work with your version of SQL:

//all inserts are done in the one SQL statement

int len = //length of array
//the start of the statement. The first element is done here because
//one less comma is required then the number of elements
string sql = "INSERT INTO  table (row1) VALUES (" . array[0];
for (int i=1; 0<len; i++){
  //create SQL statement
  sql .= "), VALUES (" . array[i];
}
sql .= ");";
//[execute sql here]

http://en.wikipedia.org/wiki/Insert_(SQL)

humbug 5 Junior Poster in Training

Might also be a good idea to do

if (!mysql_query($sql)){
  die (mysql_error());
}
humbug 5 Junior Poster in Training

Your form should look like this:

<form ...>
  <input type="hidden" name="student" value="$row['student']" />
  <input type="submit" name="delete" value="Delete" />
</form>

Then you can get which student to delete on deletestudent.php via $_POST. (you can use isset($_POST['delete']) to see if they clicked "Delete" but $_POST will hold the value "Delete").

The id attribute in html is used for javascript or CSS to select that particular element.

humbug 5 Junior Poster in Training

You could even use an "INSERT ... ON DUPLICATE KEY UPDATE ..." query (if you have a primary key "id" column) but that's getting complicated.

humbug 5 Junior Poster in Training

I am not going to write your code for you - that's the sort of thing I get paid for :P - but I will help you do it yourself.

The way I would do it is as follows:
You will need

  • A place to store the data (MySQL table)
  • A form for the user to edit the data (form.php)
  • A script that will process any data that the user submits (save.php)

When you create the user, you can create an empty entry in the MySQL table.

form.php will first get the stored data and echo the html for a form using the trick above to put the data into the "value" attribute of the inputs in your form. This way, all the fields are already filled in with whatever the user entered last time.

The form should be pointed at the script that deals with the data (action="save.php"). save.php will use the data to create an UPDATE query for the database.

If you don't know how to do any of these steps, look at tutorials for each step (starting with forms, etc.) and you will soon learn how it all works, that's what I did!

humbug 5 Junior Poster in Training

Having hardly used macs in my life, I am now borrowing an old iMac 3G (OS 10.2.8 I think) to temporarily host some php files. I have downloaded the latest version of MAMP to get the job done and done the whole unzipping/moving to apps folder thing. My problem comes when I try to open the "Mamp" (Application) file, the MAMP logo jumps up and down in the doc then goes away, no error message, nuthin'.

Oh yeah, and the log file (of sorts) in the Utilities folder (system log, not MAMP log) said something about not finding a directory in "/usr/..." I can't remember exactly what it was, I'll check tomorrow.

Any pointers as to how to get the MAMP server running is greatly appreciated.

Cheers

humbug 5 Junior Poster in Training

You need to post the relevant code for anyone to know what's going on. Is the code that checks the input data and the code that displays the input boxes on the same page? Does refreshing/reloading the page allow you to retry?

humbug 5 Junior Poster in Training

How is your database set up? That will only work if
1. postid is unique to each post and parentid holds the id of the parent post and NULL if it is itself a parent post.
OR
2. parentid is set to the id of the topic for the parent post only (NULL otherwise) and postid holds the id that parentid holds but is set for child posts instead.

And of course, you pass the parent id to the script. Its hard to tell what's going wrong without knowing without knowing a bit more as the query seems ok.

(The query should only be "WHERE postid = '3' " if postid is a string, otherwise you should remove the single quotes)

humbug 5 Junior Poster in Training

a variable (such as $myusername ) must be set in the same script for it to have a value, and thus be echo'd to the page. This means the value will be lost if the user refreshes the or follows a link.

The $_SESSION is a special array that will hold it's value for a user until they close their browser. This means when they log in you must set the session variable:

$_SESSION['myusername'] = "humbug"

Only after you have done that can you retrieve the value of the variable like you did with your echo $_SESSION['myusername']; statement.

Hope that clarified things.

humbug 5 Junior Poster in Training

Sorry, way to long ago to remember or find out.

humbug 5 Junior Poster in Training

Hmm, you've got an input for the quantity. Did you add that in the hope of getting it to work? Does the cart work how it is without quantity? What do you actually mean by "add the amount of items in the shopping cart"?.

humbug 5 Junior Poster in Training

Are you using a session to store the stuff in the cart or what? I'd suggest creating a session for the user with the following variables:

array $quantity
array $product

each element of those arrays will contain the info for an item. ($quantity[0] has the quantity of the first item and $product[0] has the name or item number or id of the product).

humbug 5 Junior Poster in Training

Using any program that can use sockets you can do this. If you have php installed on your computer then that's easy. I have done it with Game Maker (using 39dll) before.

What you need to do is read the file (word doc) into your program. (You may need to convert it to HTML or something...) Lets assume your using PHP. Use the fopen() function to read the file into a variable, say $file_content .

Then you want to make a socket connection to your website server: $pointer = fsockopen("www.yourdomain.com",80); And then write a HTTP request containing the data. This is what your internet browser does when you submit a form. It should look something like this:

POST /submit.php HTTP/1.1
Host: www.yourdomain.com
Connection-length: 24
Connection: close

content=Content of file.

Each line must end in "\r\n" (PHP notation) and an empty line represents the end of the header and the start of the content.

The above would be the result of submitting the following form:

<form action="www.yourdomain.com/submit.php" method="POST">
  <input type="text" name="content" value="Content of file." />
  <!-- submit etc. -->
</form>

You then use fputs() to "write" the request to your server and fgets() to "read" the response from your server (which in this case isn't as crucial).

So, load file, connect to server, construct a correct HTTP request, send it, retrieve the reply to your request to make sure it all went ok.

humbug 5 Junior Poster in Training

There are functions for including in a script, a script held in another file. Is this what you mean? i.e. you can define the functions that you will use (and constants, variables, etc) and then include them.

Syntax:

include 'functions.php';
include "variables.inc";

See also, include_once, require and require_once.

humbug 5 Junior Poster in Training

Ok, you need to look at a few tutorials (there's millions on the net) about user logins and sessions. In a nutshell: form.html This contains the textbox.

<form action="submit.php" method="GET"> <!--or "POST"-->
  <input type="text" name="username" />
</form>

submit.php Set the session variable

<?php
session_start(); //so you can use the session variable
&username = $_GET['username']; //or $_POST depending on form method
echo "Hello $username. I have learnt your name!";
SESSION['username']=$username;
?>
<a href="/page.php">Return</a>

page.php //Content page

<?php
start_session();
if isset($_SESSION['username']){
  echo "Hey $_SESSION['username'], I remembered your name!";
}
?>
...rest of page content

Now please do some research so you understand that code and how your using it.

[code untested]

humbug 5 Junior Poster in Training

See here.

humbug 5 Junior Poster in Training

Assuming you have all the data stored in a MySQL table you sould need something like this:

<?php
//login to  MySQL db

$result=mysql_query("SELECT * FROM user_settings WHERE id='$_SESSION[user_id]'");
$settings=mysql_fetch_array($result); //now $settings has everything from the user_settings table as an array
echo '<form action=...>'.
     '  <input type="text" name="real_name" value="'.$settings['real_name'].'">'.
     '  ...'.
     '</form>';
?>

This code should output the following where "MY NAME" is the value in the "real_name" column of table "user_settings" in the row with id equal to $_SESSION[user_id].

<form action=...>
  <input type="text" name="real_name" value="MY NAME">
  ...
</form>

You can use the values in the $settings array to fill all of the inputs with the current data. (The code is untested BTW, so may contain syntax errors...)

Hope that helped.

humbug 5 Junior Poster in Training

As PHP is a server side language, PHP can't be used to modify the page once it has been sent to the browser. You need a client side language (that is executed by the viewers browser) such as Javascript to do what you are explaining. I haven't done much with javasript so I can't help you any further.

humbug 5 Junior Poster in Training

To have less of an impact on the server at runtime I'm guessing 2) would be much better as in 1) you must load the entire history of news items into memory as opposed to about 30 bytes per news item. (Have I interpreted you correctly?)

humbug 5 Junior Poster in Training

@bappaditya
Are you saying "www1" is to www1.example.com as "mail" is to mail.google.com? Does this mean that "www" a subdomain but many modern web servers are able to assume a subdomain of "www" when none is given? (because "www.mail.google.com" doesn't give a response)

Thanks for clarification.

humbug 5 Junior Poster in Training

first, after $find_ad has been set, I would split the data by $list = explode("</tr>",$find_ad) then do a replacement on each item like so:

$list=preg_replace("/([^>])(</a> \(\d{4}\))/",'\1\2 - <a href="http://www.theflickzone.com/search.php?do=process&sortby=lastpost&titleonly=true&query=\1"> Search </a>',$list);

//then to wrap it up:
$new_page = '<table border="1" cellspacing="0" cellpadding="4" style="margin-right:30px;">';
foreach ($list as $item){
  $new_page .= $item . </tr>
}
$new_page .= "</table></p>";

The regex line should replace Movie Name</a> (year) with Movie Name</a> (year) - [YOUR LINK] though it's not tested. You could quite easily put the search link at the start of the name but you would have to incorporate the <a ...> tag into the regex.

Hope you can get your head around all that.

humbug 5 Junior Poster in Training

Thanks for that last bit of info, it has actually made my requests successful. You've been a big help because HTTP headers is something I have only briefly read over.

Cheers.

humbug 5 Junior Poster in Training

Notice how line 24 of my code includes "GET" and not "POST"? That's the call I used to (successfully) send a GET request (as the English above clearly states).

I have slightly modified the code making up that function from the code I got off the net so I understand what needs to go in which parameter.

I have tried the line you suggested an a few similar (even with the original code) but none have shown me that my POST data was received.

humbug 5 Junior Poster in Training

Here's my predicament. I Have managed to send and retrieve some HTTP requests using the GET method successfully using the following code:

function send_to_host($host,$method,$path='/',$data='',$useragent=0){
    // Supply a default method of GET if the one passed was empty
    if (empty($method)) {
        $method = 'GET';
    }
    $method = strtoupper($method);
    $fp = fsockopen($host, 80) or die("Unable to open socket");
	
    fputs($fp, "$method $path HTTP/1.1\r\n");
    fputs($fp, "Host: $host\r\n");
    fputs($fp, "Content-type: application/x-www-form- urlencoded\r\n");
    if ($method == 'POST') fputs($fp, "Content-length: " . strlen($data) . "\r\n");
    if ($useragent) fputs($fp, "User-Agent: MSIE\r\n");
    fputs($fp, "Connection: close\r\n\r\n");
    if ($method == 'POST') fputs($fp, $data);

    while (!feof($fp))
		$buf .= fgets($fp,128);
	
    fclose($fp);
    return $buf;
}

send_to_host('humbot.freewebhostingpro.com','GET','/index.php?a=5','');
//sent from localhost

I have tried a few times to send some data via POST but haven't had any luck. (I haven't had any trace of the POST data getting through)

(set up a form to submit some GET and POST data to humbot.freewebhostingpro.com/index.php and the page will display that data)

Any ideas?

humbug 5 Junior Poster in Training

Ok, first off I'd direct my form to a page of my own, say "submit.php", which would store the data passed to it into the database and then (before echoing any data to the page) use header() to redirect the user to the api url.

I'm assuming you know ho to connect to a database and submit the data. If now, search the web for a tutorial, there's millions.

Use <form action="submit.php" method="post">... to submit the username to submit.php, whose code is below:

<?php
//send the info to this page via POST method.
$username = $_POST['username'];

//connect to database a run sql "INSERT INTO" query.

$loc = 'location: www.apidomain.com?username=' . $username;
header($loc);
//that last line redirects the user to the api site submitting the username.
?>

Alternatively, you could embed the apidomain.com in a frame or something like that to keep the user on your page, or add "&return=www.yourdomain.com/done.php" to $loc and configure the api to return the user to the value specified.

With the auto increment thing, what is it that you want to auto increment? The id, in the table, of the username submitted? If so, set up a column to auto increment when you create the SQL table.

(If none of this is making sense then look at some tutorials for forms, MySQl tables etc. with this stuff in mind)

Hope that helped.

humbug 5 Junior Poster in Training

I have made those changes but no luck.

here's the site. Hit view source to get everything you need (there's no external linking).

I'm baffled.

Edit: The W3Schools TryIt example doesn't work for my on firefox either.

humbug 5 Junior Poster in Training

What exactly are you asking for? What is a word "we like"? It will probably be possible to write a function to do what you want but I'm not entirely sure what that is.

All in all, what info do you want to get out of the function and what info do you need to put in?

humbug 5 Junior Poster in Training

In php, if you try to perform an operation on $start_time (assuming that it is a variable in the script containing a string) it will be used as an integer. It works fine if the string is something like "1234". $start_time will then be converted to an integer variable (because it is on the left of the "=").

If there is a column in a mysql table that is named "start_time" and is a varchar datatype and you do something like $start_time = $row['start_time'] (where $row contains a row of a result from a query) then $start_time will be a string.

If you are writing a query to submit data to the mysql database and you can do something like

$query = "INSERT INTO table (`start_time`, `finish_time`) VALUES ( " . $start_time . ", " . $finish_time . ")";
//or
$query = "INSERT INTO table (`start_time`, `finish_time`) VALUES ( '" . $start_time . "', '" . $finish_time . "')";

With the single quotes ('), the mysql treats whatever is in them as a string no matter what. When you do $string = "$int"; or $string = "number is " . $int; , $int is used as a string. So when you are creating the query it doesn't matter what type $start_time is. Without the single quotes I think SQL will assume it's whatever type it needs to be. (mysql converts it to the right data type anyway so there's usually no problem). Just be careful doing "... WHERE …

humbug 5 Junior Poster in Training

Is it throwing any errors? Is it echoing anything at all? Make sure the values that are sent to the page via POST are the correct values to use in the mysql table. Note that the 'if $sercounty == "all"' is case sensitive.

humbug 5 Junior Poster in Training

If you don't want to get into the CRON stuff then I would suggest that instead of having tables for inbos and outbox, you could have two more columns in the "message" table, one called "in_inbox" and one called "in_outbox" then when a user clicks "delete" in their inbox you set "in_inbox" to 0 and then do a check to see if both "in_inbox" and "in_outbox" areboth 0. If so, delete the entry.

humbug 5 Junior Poster in Training

Perhaps I've misunderstood the question, and the two previous posters used regular expressions but I would normally test a date with something like the following:

function is_date($value) {
  // If the value of the field is empty, immediately return false.
  if (empty($value)) { return FALSE; }

  // Attach the exploded values to variables.
  list($day, $month, $year) = explode("/", $value);

  // Check those variables in the checkdate function. If it's valid, the function returns true.
  return checkdate($month, $day, $year);
}

This is a great method for the date. If you wanted to you could even return "$year - $month - $day"; if it is a valid date or FALSE if it isn't seeing as you already have the variables set.

As for the time, I would probably take the input as a string and use one of the regular expression checks above to see if it consists of 4 numbers, then typecast it to an integer and check if ($time_num >= 900 && $time_num <= 1700) { echo "time is valid"; }

jackakos commented: good +1
humbug 5 Junior Poster in Training

Personally, I would make a few tables like this: (I will refer to email's (eg someone@example.com) as emails and messages between users as Personal Messages (PM's)
table: users

Column:   description
id:       unique, auto increment id of user
username: username
password: hash of password
email:    users email address

table: PMs

Column:   description
id:       unique, auto increment id of message
from:     user id of who sent the message
to:       user id of who the message is to
subject:  message subject
message:  message content
read:     tinyint where 1 means "read" and 0 means unread

I always include an id and use that when referring to rows. On a page that isn't the users "inbox" I would use the query "SELECT `id` FROM `PMs` WHERE to='$user_id' AND read=0" then if a result was returned then you echo a link to their inbox.

In the inbox I'd use "SELECT * FROM `PMs` WHERE to='$user_id'" and the "read" column can be used to, say, display the messages as bold or not bold.

In the outbox I'd use "SELECT * FROM PMs WHERE from='$user_id'" .

humbug 5 Junior Poster in Training

Oh, ok. didn't even see that. Thanks.

humbug 5 Junior Poster in Training

I've made the necessary changes but it doesn't seem to make a difference.

Here's my new css

/*
 * This is the global style sheet for Carpool.com. Every page will link to it.
 * Ben Ritter 2008
 */ 

html, body {
	min-height:100%;
	font-family: arial
}

h1 {
	padding: 20px 0 0 120px;
	vertical-align: middle;
	margin: 0;
}
h2 {
	padding: 5px 20px 0 0;
	margin: 0;
	text-align: right
}

div{ 
	min-height:100%;
	/*border-style: solid;/**/
	/*border-width: 2px/**/
}

div.pageWrapper {
	border-color: green;
	border-width: 2;
	min-height: 100%
}

div.banner {
	/*border-width: 3px; /**/
	/*border-color: blue; /**/
	background-color: red;
	width: 100%
}

.login {background-color: blue;}
div.login {
	float: right;
	text-align: right;
	padding: 5px;
	height: 100px
}
input.login {margin: 4px}
form.login {vertical-align: middle}

div.nav {
	float: left;
	width: 86px;
	border-style:solid;
	border-width: 1px;
	border-color: red;
	padding: 0 5px 0 8px
}

ul.nav{
	list-style-type: none;
	padding: 0
}

div.content{
	padding: 10px
}

/*.signup{}*/

/*.login {}*/

.formLabel {color: blue}
.formInput {color:red} /*for the "*" denoting required fields*/
.formDescription {color:#505050}

.error {
	color:red;
	font-weight: bold
}

/* Below here is for fixing floats that protrude from their container */
.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
humbug 5 Junior Poster in Training

the queries on lines 16 and 20 will fail because your syntax is wrong (probably i simple typing error).

it should read

$query = "SELECT * FROM `login`";

Are the "`" quotation things actually necessary? www.w3schools.com doesn't mention it and I couldn't see it in www.dev.mysql.com's documentation. Are they only for table names?

Cheers.

humbug 5 Junior Poster in Training

You could store the number in either a txt file (if you don't want to do the mysql connection thing just for it) or in a db and also store the date/time for which that number "expires" and it should be incremented. Then every time a user views the page you can do a check to see if the time is past the time in the file and if so, increment the number before displaying it to the user.

You want to make sure you use server time through and not the time on the users computer.

humbug 5 Junior Poster in Training

I have just written a script to do just that. I used ereg() to do a search for a regular expression that will verify a valid entry. e.g:

if (!ereg('^[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]$', $date)){
//I got an error when I used "[0-9]{2}" instead of "[0-9][0-9]"
//^ matches start of string and $ matches end.
  &errors_present = TRUE;
  $errors .= "date not valid";
}
if (!ereg('^[a-zA-Z ]+$', $date)){
//etc.
humbug 5 Junior Poster in Training

Well your looking at one right now...

I don't know if you will find many sites that will give you their php source code but you can look at tutorials to find out how to do specific things and get a general idea of what method certain sites are using by being observant.

Daniweb does some fancy thing and rewrites the URL before processing it so it does a lot of stuff that you can't see so look elsewhere for that. Be observant of things like "?var=value" on the end of URL's (that's using the GET method of transferring data) and when your being redirected and you might be able to get an idea of what they're doing.

For actual html, you can look at sites like www.lyricwiki.org, www.youtube.com, www.westpac.com.au, www.escapistmagazine.com and www.newgrounds.com and check out their source code, the style sheets they link to etc. to see what methods they use to layout their page (mostly <div>'s and never tables).

There are also some addons for Firefox (I think) that let you have a look at how the page is set up which can be very handy. I think it was called firebug in FF 2.

humbug 5 Junior Poster in Training

Here's a few mistakes in your code that I have spotted:

if($gender==all||$sercountry==all){
//should be:
if($gender=="all"||$sercountry=="all"){

Here is how I would structure it:

<?php
include"config.php";

$gender=$_POST['gender'];
$sercountry=$_POST['country'];
trim($gender);
trim($sercountry);

if(!$sercountry || !$gender){ //fail
    echo "<font color=brown><b>You have not entered ALL search details.<b></font>try again</b></font>";
    exit;
}	 
	
if($gender=="all" || $sercountry=="all"){
    echo"$gender $sercountry<br>"; //for debugging
    $query="SELECT *FROM login";
    $result=mysql_query($query);
} else {
    echo"$gender $sercountry<br>"; //for debugging
    $query="SELECT *FROM login WHERE ";
    if($gender != "all"){
        $query .= "gender = `$gender` ";
    }
    if($sercountry != "all"){
        $query .= "country like `$sercountry`";
    }
    $result=mysql_query($query);
}

$num_results=mysql_num_rows($result);
if($num_results==0){
    echo"<font color=maroon><b>No matches for your search.<br>  specify  category</b><br> <a href=index.php><< BACK</a></font>";
}

if($result){
    //this should be out here or you will get a table for each result
    echo "<table width=540 height=20 border=1 bordercolor=cyan cellpadding=5 cellspacing=2 align=center bgcolor=aliceblue>";
    //this is for the table headings
    echo "<tr><td>&nbsp;</td><td>NAME:</td><td>FAMILY:</td><td>COUNTRY:</td><td>GENDER:</td><td>USER:</td></tr>";
    while($row=mysql_fetch_array($result)){
        $userid=$row['id'];  
        $name=$row['name']; 
        $user=$row['user']; 
        $family=$row['family']; 
        $country=$row['country']; 
        $date=$row['date']; 
        $gender=$row['gender'];
        echo"<tr><td width=10%><a href= profile.php?wewe=$userid><img src=retrieve.php?id=$userid width=200 height=150 border=0></a></td><td width=30%><font color=blue><a href= profile.php?wewe=$userid> $name</a></font></td><td><font color=blue>$family</font></td><td><font color=blue>$country</font></td><td><font color=blue>$gender</font></td><td><font color=blue>$user</font></td></tr>";
    }
    echo "</table>";
 }
?>

Because I'm feeling generous, I wrote out the echo big as well. It will now display every result on one line of a table with the headings "&nbsp;", "NAME:", "FAMILY:", "COUNTRY:", "GENDER:" and "USER:".

humbug 5 Junior Poster in Training

No problem.

I think I was misinformed about the $record['countryname'] thing. I think it works without the quotes. Sorry about that.