[PHP-DB] undefined function: mysql_pconnect()

2003-03-01 Thread Cameron
I'm new to this stuff, so you have to excuse me if I seem dense.  I can't
get MySQL base operation from PHP 4.22 under RedHat Linux 8.0.  I get the
following error when trying to use mysql_connect().

Call to undefined function: mysql_pconnect()

I don't have any other PHP running on the box, other non-db related
scripting works.  I'm using Apache 2.0, all the newest stuff.  The PHP
documentation says this should be built in, and when I utilize phpinfo(),
the output section dbx says MySQL is installed.

Can someone help me out?

Thanks...

Signed, someone who spent his time in ASP but wants out.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] undefined function: mysql_pconnect()

2003-03-01 Thread Julien Wadin
Could you post your entire script to see what's wrong ?

-Message d'origine-
De : Cameron [mailto:[EMAIL PROTECTED]
Envoyé : samedi 1 mars 2003 6:17
À : [EMAIL PROTECTED]
Objet : [PHP-DB] undefined function: mysql_pconnect()


I'm new to this stuff, so you have to excuse me if I seem dense.  I can't
get MySQL base operation from PHP 4.22 under RedHat Linux 8.0.  I get the
following error when trying to use mysql_connect().

Call to undefined function: mysql_pconnect()

I don't have any other PHP running on the box, other non-db related
scripting works.  I'm using Apache 2.0, all the newest stuff.  The PHP
documentation says this should be built in, and when I utilize phpinfo(),
the output section dbx says MySQL is installed.

Can someone help me out?

Thanks...

Signed, someone who spent his time in ASP but wants out.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Creating MySQL Entry Forms

2003-03-01 Thread Jeremy N.E. Proffitt
It has to be HTML based, it can't install on the server.

- Original Message -
From: Leif K-Brooks [EMAIL PROTECTED]
To: Jeremy N.E. Proffitt [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 9:37 PM
Subject: Re: [PHP-DB] Creating MySQL Entry Forms


 What's wrong with PhpMyAdmin?

 Jeremy N.E. Proffitt wrote:

 I need to create some simple web forms for entering, changing, deleteing
information from a fairly simple MySQL database.  This is to be for internal
use, so doesn't have to be really fancy or have alot of error checking.
   I could make a form for each table myself, but I would think their is
an easier way...
 
 Cheers
 Jeremy
 
 

 --
 The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] redirect

2003-03-01 Thread Jeremi Bergman
How can I redirect a user to a specific page if they are already
authenticated?

if ($SESSION_Authenticated) { //code here to redirect; }

thanks



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] redirect

2003-03-01 Thread Jeremi Bergman
Nevermind, I found the answer, and why it wasn't working.  Now I was
wondering how I can format a number to be a currency?  Like if
$totalprice = 14.343 have it print 14.34.

thanks

-Original Message-
From: Jeremi Bergman [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 01, 2003 2:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] redirect

How can I redirect a user to a specific page if they are already
authenticated?

if ($SESSION_Authenticated) { //code here to redirect; }

thanks



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] redirect

2003-03-01 Thread John W. Holmes
 Nevermind, I found the answer, and why it wasn't working.  Now I was
 wondering how I can format a number to be a currency?  Like if
 $totalprice = 14.343 have it print 14.34.

Number_format() or printf()

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] redirect

2003-03-01 Thread Kurth Bemis (List Monkey)
At 04:33 PM 3/1/2003 -0500, Jeremi Bergman wrote:

www.php.net/round

find the answer there, you will :-)

~kurth

Nevermind, I found the answer, and why it wasn't working.  Now I was
wondering how I can format a number to be a currency?  Like if
$totalprice = 14.343 have it print 14.34.
thanks

-Original Message-
From: Jeremi Bergman [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 2:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] redirect
How can I redirect a user to a specific page if they are already
authenticated?
if ($SESSION_Authenticated) { //code here to redirect; }

thanks



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Code to send user info to database

2003-03-01 Thread Michelle Whelan

I have a website that is hosted by Yahoo! Web Hosting which supports PHP with MySQL.  
The db is already created, so there's no problem there.  The problem I am having is 
knowing what code to write for my form entries so that the info entered by a user can 
be sent to my db named users and then later when a zip code search is conducted, the 
matching info can be retrieved and displayed on a results page.  Someone else created 
the db for me so I don't really know much about that side of it.  I've been reading up 
on how to write PHP, but I am still lost as to where to start for my forms.  Is there 
any other info you need to know? 
 Hutchins, Richard [EMAIL PROTECTED] wrote: Michelle,

You said you've tried tutorial after tutorial. What specific problems are
you having? What kind of database are you using? Have you architected the db
yet? We can't help much if we don't know what specific problems you're
having (e.g. db connection problems, PHP parse errors, unexpected results,
etc., etc.).

Rich

 -Original Message-
 From: Michelle Whelan [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 28, 2003 2:09 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Code to send user info to database
 
 
 
 Hi all, 
 
 I'm just starting out with writing PHP and would like to get 
 help with writing the code for my forms to have the data sent 
 to a database. Here is one of my forms:
 
  if ($submit == Submit){ 
 echo Your listing has been submitted; 
 echo Go back Home ;
 echo www.dirtjobs.com/havedirt.phpAdd 
 another listing;
 } 
 else{ 
 echo ' 
 
 
 
 
 
 
 
  
 
  size=2 color=#FFWHAT TYPE OF DIRT?
 
  CLEAN DIRT FOR FINISH GRADINGDIRT WITH 6 MINUS ROCKSDIRT WITH ROCKS
 
 
 
  size=2 color=#FFAPPROXIMATE QUANTITY OF DIRT IN YARDS:
  [input]  name=noyardsYards
 
 
  
 
  size=2 color=red*MANDATORY*
 
 
  size=2 color=#FFCONTACT NAME:
  [input] 
 
 
  size=2 color=#FFCONTACT PHONE NUMBER:
  [input]  
  [input]  
  size=2 color=#FF -  [input]  maxlength=4 name=suffix
 
 
  size=2 color=#FFZIP CODE:
  [input] 
 

 (Jobs are sorted by zip code to find other jobs in the 
 area)
 
 
  size=2 color=#FFJOB EXPIRATION DATE: 
  [input] 
 

 (If no date is listed, jobs will be removed in 60 
 days.)
 
 
  
 
  size=2 color=blue(*Optional)/font
 
 
  size=2 color=#FFEMAIL ADDRESS:
  [input] 
 
 
  size=2 color=#FFCITY OF JOB LOCATION:
  [input] 
 
 
  size=2 color=#FFJOB CROSS STREETS:
  [input] 
 
 
  size=2 color=#FFJOB EXPIRATION DATE:
  [input] 
 

 (If no date is listed, jobs will be removed in 60 
 days.)
 
 
  
 
  [input]  value=Submit 
  [input] 
 
 
 
 I imagine the code is probably somewhat simple, but I have 
 read tutorial after tutorial etc. and am getting nowhere for 
 the past two weeks. 
 
 This is also the first time I have ever posted to a mailing 
 list so I apologize if my request is incorrect in format. 
 
 Thanks so much, 
 
 Michelle 
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Code to send user info to database

2003-03-01 Thread Michelle Whelan

I have a website that is hosted by Yahoo! Web Hosting which supports PHP with MySQL.  
The db is already created, so there's no problem there.  The problem I am having is 
knowing what code to write for my form entries so that the info entered by a user can 
be sent to my db named users and then later when a zip code search is conducted, the 
matching info can be retrieved and displayed on a results page.  Someone else created 
the db for me so I don't really know much about that side of it.  I've been reading up 
on how to write PHP, but I am still lost as to where to start for my forms.  Is there 
any other info you need to know? 
 Hutchins, Richard [EMAIL PROTECTED] wrote: Michelle,

You said you've tried tutorial after tutorial. What specific problems are
you having? What kind of database are you using? Have you architected the db
yet? We can't help much if we don't know what specific problems you're
having (e.g. db connection problems, PHP parse errors, unexpected results,
etc., etc.).

Rich

 -Original Message-
 From: Michelle Whelan [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 28, 2003 2:09 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Code to send user info to database
 
 
 
 Hi all, 
 
 I'm just starting out with writing PHP and would like to get 
 help with writing the code for my forms to have the data sent 
 to a database. Here is one of my forms:
 
  if ($submit == Submit){ 
 echo Your listing has been submitted; 
 echo Go back Home ;
 echo www.dirtjobs.com/havedirt.phpAdd 
 another listing;
 } 
 else{ 
 echo ' 
 
 
 
 
 
 
 
  
 
  size=2 color=#FFWHAT TYPE OF DIRT?
 
  CLEAN DIRT FOR FINISH GRADINGDIRT WITH 6 MINUS ROCKSDIRT WITH ROCKS
 
 
 
  size=2 color=#FFAPPROXIMATE QUANTITY OF DIRT IN YARDS:
  [input]  name=noyardsYards
 
 
  
 
  size=2 color=red*MANDATORY*
 
 
  size=2 color=#FFCONTACT NAME:
  [input] 
 
 
  size=2 color=#FFCONTACT PHONE NUMBER:
  [input]  
  [input]  
  size=2 color=#FF -  [input]  maxlength=4 name=suffix
 
 
  size=2 color=#FFZIP CODE:
  [input] 
 

 (Jobs are sorted by zip code to find other jobs in the 
 area)
 
 
  size=2 color=#FFJOB EXPIRATION DATE: 
  [input] 
 

 (If no date is listed, jobs will be removed in 60 
 days.)
 
 
  
 
  size=2 color=blue(*Optional)/font
 
 
  size=2 color=#FFEMAIL ADDRESS:
  [input] 
 
 
  size=2 color=#FFCITY OF JOB LOCATION:
  [input] 
 
 
  size=2 color=#FFJOB CROSS STREETS:
  [input] 
 
 
  size=2 color=#FFJOB EXPIRATION DATE:
  [input] 
 

 (If no date is listed, jobs will be removed in 60 
 days.)
 
 
  
 
  [input]  value=Submit 
  [input] 
 
 
 
 I imagine the code is probably somewhat simple, but I have 
 read tutorial after tutorial etc. and am getting nowhere for 
 the past two weeks. 
 
 This is also the first time I have ever posted to a mailing 
 list so I apologize if my request is incorrect in format. 
 
 Thanks so much, 
 
 Michelle 
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Creating MySQL Entry Forms

2003-03-01 Thread Paul Burney
on 3/1/03 2:00 PM, Jeremy N.E. Proffitt at [EMAIL PROTECTED] appended
the following bits to my mbox:

 What's wrong with PhpMyAdmin?

 It has to be HTML based, it can't install on the server.

Well, you can't administer MySQL with HTML pages.  You need PHP pages that
generate HTML pages.  PHPMyAdmin is just a collection of PHP pages that talk
to MySQL.  It doesn't require any special installation.

See: http://phpmyadmin.sf.net for more information.

Sincerely,

Paul Burney
http://paulburney.com/

?php
while ($self != asleep) {
$sheep_count++;
}
?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] undefined function: mysql_pconnect()

2003-03-01 Thread Paul Burney
on 3/1/03 12:16 AM, Cameron at [EMAIL PROTECTED] appended the
following bits to my mbox:

 I'm new to this stuff, so you have to excuse me if I seem dense.  I can't
 get MySQL base operation from PHP 4.22 under RedHat Linux 8.0.  I get the
 following error when trying to use mysql_connect().
 
 Call to undefined function: mysql_pconnect()

You need to install the php-MySQL RPM file from the Red Hat CD.  The default
install doesn't give you MySQL support.

HTH.

Sincerely,

Paul Burney

-- 

I'm inhaling Caesar's last gasp...
http://paul.burney.ws/thoughts/caesars_breath.html



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Auto inserting a database with dates

2003-03-01 Thread Chris Payne
Hi there everyone,

Is there a quick and easy (HAH :-) way of doing the following:

I have a DB and a table with id, date etc . now what I need is to create 3 years 
of entries for the date in advance of the system going live (Rather than while they 
use it - hard to explain why but necessary).

Is there an easy way to write a short PHP script that will populate the field $stock 
with 3 years dates in advance from the current date, using the format 02-03-200x ?  
it's either this way or I go through and insert new onces argghhh (That's not a 
pleasant thought :-)

Thanks :-)

Chris

Re: [PHP-DB] Random not working?

2003-03-01 Thread Doug Thompson
This recent thread from the mysql list explains a lot about the
problem.
http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:15034


hth,
Doug

On Sat, 1 Mar 2003 12:24:57 +0100, Frank Keessen wrote:

Hi All,

I'm trying to get a random record each time this script runs; Only it's giving me 
everytime the first record back.. No random at all..

// generate and execute query
$query = SELECT stedenid, naamstad, stadomschrijvk FROM steden ORDER BY RAND() LIMIT 
1;
$result = mysql_query($query) or die (Error in query: $query.  . mysql_error());
$row = mysql_fetch_object($result);
echo $row-naamstad;


Version info;

PHP 4.3.1
Mysql 3.23.54 

When i'm trying to excute the SELECT statement in phpmyadmin; i'm only getting the 
first record back and when i'm taking off the LIMIT 1 it will display all the records 
in ascending order so also not in random..


Regards,

Frank









-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Random not working?

2003-03-01 Thread Frank Keessen
Hi All,

I'm trying to get a random record each time this script runs; Only it's giving me 
everytime the first record back.. No random at all..

// generate and execute query
$query = SELECT stedenid, naamstad, stadomschrijvk FROM steden ORDER BY RAND() LIMIT 
1;
$result = mysql_query($query) or die (Error in query: $query.  . mysql_error());
$row = mysql_fetch_object($result);
echo $row-naamstad;


Version info;

PHP 4.3.1
Mysql 3.23.54 

When i'm trying to excute the SELECT statement in phpmyadmin; i'm only getting the 
first record back and when i'm taking off the LIMIT 1 it will display all the records 
in ascending order so also not in random..


Regards,

Frank







[PHP-DB] RE: [PHP] Random not working?

2003-03-01 Thread Rich Gray
 Hi All,

 I'm trying to get a random record each time this script runs;
 Only it's giving me everytime the first record back.. No random at all..

 // generate and execute query
 $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
 ORDER BY RAND() LIMIT 1;
 $result = mysql_query($query) or die (Error in query: $query. 
 . mysql_error());
 $row = mysql_fetch_object($result);
 echo $row-naamstad;


 Version info;

 PHP 4.3.1
 Mysql 3.23.54

 When i'm trying to excute the SELECT statement in phpmyadmin; i'm
 only getting the first record back and when i'm taking off the
 LIMIT 1 it will display all the records in ascending order so
 also not in random..


 Regards,

 Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] RE: [PHP] Random not working?

2003-03-01 Thread Frank Keessen
Thanks guys for the info; I will speak to my ISP!

Have a nice weekend!

Regards,

Frank
- Original Message -
From: Rich Gray [EMAIL PROTECTED]
To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 2:36 AM
Subject: [PHP-DB] RE: [PHP] Random not working?


  Hi All,
 
  I'm trying to get a random record each time this script runs;
  Only it's giving me everytime the first record back.. No random at all..
 
  // generate and execute query
  $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
  ORDER BY RAND() LIMIT 1;
  $result = mysql_query($query) or die (Error in query: $query. 
  . mysql_error());
  $row = mysql_fetch_object($result);
  echo $row-naamstad;
 
 
  Version info;
 
  PHP 4.3.1
  Mysql 3.23.54
 
  When i'm trying to excute the SELECT statement in phpmyadmin; i'm
  only getting the first record back and when i'm taking off the
  LIMIT 1 it will display all the records in ascending order so
  also not in random..
 
 
  Regards,
 
  Frank


 Frank

 This really belongs on the MySQL list but there was a known issue with
 RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment
ID
 column then a workaround would be to use rand() in PHP to generate a
random
 ID then use that with a 'where id = '.$id in your query...

 HTH
 Rich


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] RE: [PHP] Random not working?

2003-03-01 Thread Dennis Cole
You might try getting the random number before the query.

-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 8:37 PM
To: Frank Keessen; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] RE: [PHP] Random not working?


 Hi All,

 I'm trying to get a random record each time this script runs;
 Only it's giving me everytime the first record back.. No random at all..

 // generate and execute query
 $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
 ORDER BY RAND() LIMIT 1;
 $result = mysql_query($query) or die (Error in query: $query. 
 . mysql_error());
 $row = mysql_fetch_object($result);
 echo $row-naamstad;


 Version info;

 PHP 4.3.1
 Mysql 3.23.54

 When i'm trying to excute the SELECT statement in phpmyadmin; i'm
 only getting the first record back and when i'm taking off the
 LIMIT 1 it will display all the records in ascending order so
 also not in random..


 Regards,

 Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Making Join

2003-03-01 Thread Daniel Harik
Mark wrote:

 
 --- Daniel Harik [EMAIL PROTECTED] wrote:
   Hello,
  
   I have 2 tables users table, that stores user info, and photos
 table,
   i want to select all users with one photo form photos table,
 but i don't
   want it to be photos * users = result.
  
   Is there way to do it?
  
  Assuming you mean, you have a table called user_info and another
 called
  photos and each of them has a common element AND there must be a
 photo for
  the user then you could use this sort of select...
  
  select user_info.name, photo.image from user_info, photo where
 user_info.id
  = photo.user_id
  
  The above will not display anything if there are no matching id
 to user_id
  so if one of your users didn't have a photo they would not get
 displayed.
  Also, if a user had more than one photo they would all be
 displayed.
  
  If your users are expected to have one and only one photo then
 you may
 want
  get rid of the photo table and just put the photo in the user
 table.
  
  HTH
 
 
 Thank You for your reply, but the problem is that users may have
 many
 photos, and i need to get only one, i use folllowing sql:
 SELECT users.username, photos.file FROM users left join photos on
 users.id=photos.userid
 
 
 And i get:
 
  username file
 dan  9a2de085e456e78ed66f079572638ff3.jpg
 dan  852d28e6fa730f6d29d69aacd1059ae7.jpg
 dan  672df2f16e89e3dc92ff74e3a0fa4b4f.jpg
 dan  8bae6f20ed6e12ba1c86d04b8ebc9e1f.jpg
 dan  7de9d2db2b2096cfc3f072f8c15a9e50.jpg
 404  f474a8ee5965f0a792e5b626fb30c2cd.jpg
 404  3acd391cf7abafa032c5e3b21eb7b322.jpg
 404  4e5df8cfa4bce5dd30c1166b8a86fa23.jpg
 Bedman  NULL
 
 but i want only 3 users from this join, not 3x3=9
 
 If you only want the users, and not the photos, then the previous
 post should do what you want. But if you also want the photo, and
 there's more than one photoo for a user, how will the code know which
 photo you want? Do you want a random photo from each user? The last
 photo from each user? The first?
 
 Mark

Random is fine

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Making Join

2003-03-01 Thread Daniel Harik
Paul Burney wrote:

 on 2/28/03 3:15 PM, Daniel Harik at [EMAIL PROTECTED] appended the
 following bits to my mbox:
 
 Thank You for your reply, but the problem is that users may have many
 photos, and i need to get only one, i use folllowing sql:
 SELECT users.username, photos.file FROM users left join photos on
 users.id=photos.userid
 
 And i get:
 
 username file
 dan  9a2de085e456e78ed66f079572638ff3.jpg
 dan  852d28e6fa730f6d29d69aacd1059ae7.jpg
 dan  672df2f16e89e3dc92ff74e3a0fa4b4f.jpg
 dan  8bae6f20ed6e12ba1c86d04b8ebc9e1f.jpg
 dan  7de9d2db2b2096cfc3f072f8c15a9e50.jpg
 404  f474a8ee5965f0a792e5b626fb30c2cd.jpg
 404  3acd391cf7abafa032c5e3b21eb7b322.jpg
 404  4e5df8cfa4bce5dd30c1166b8a86fa23.jpg
 Bedman  NULL
 
 but i want only 3 users from this join, not 3x3=9
 
 So you just want the users who have pictures, but not all the pictures for
 each?  Something like:
 
 SELECT count(*) AS num_photos, username FROM photos LEFT JOIN users ON
 photos.userid=users.id GROUP BY userid
 
 You could add the file field in there as well, but it would only be
 returning one of the files (the first or last one for that user, but I
 don't know of a way for you to be specific).
 
 Hope that helps.
 
 Sincerely,
 


Thank You, group by users.id did the trick, but now i have another
problem, i want to select users with no photo as well, all with same
sql statment, so far i have 

SELECT users.id, users.gender, users.year, users.month, users.day, 
users.username, users.city, users.country, users.feet, users.inches, 
users.cm, users.openingLine, profiles.bodyType, profiles.ethnic, 
profiles.smoke, profiles.drink, profiles.children, profiles.religion, 
profiles.moment, photos.file FROM users,profiles, photos WHERE 
users.id=profiles.userid GROUP BY users.id

It works fine selecting random photo for user, but doesn't select users
with no photos.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php