RE: [PHP] Confused

2002-09-23 Thread M . A . Bond

Nope,

Do a select like so:

Select user_name, group_name from users,groups where
users.group_id=groups_id order by group_name;


Then do a php loop (you'll need to find the eact php commands, this is just
an example):

While (!$results-EOF)
{

If ($results[group_name]!=$old_groupname)
{
$old_groupname=$results[group_name];
print TRTD$old_groupname/tdtdnbsp;/td/tr;
}else
{
print TRTDnbsp;/tdTD$results[user_name]/td/tr;
}
$results=mysql_fetch_array($sql);
}

You'll obviously need to get exact mysql commands etc, and open and close
your table outside the loop, but this should be basically it.


Thanks

Mark


-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]] 
Sent: 23 September 2002 13:37
To: '[EMAIL PROTECTED]'
Subject: [PHP] Confused


I have two MySQL tables, groups and users:

groups: group_id, group_name

users: user_id, user_name, group_id, etc.

I would like to produce one table for each group which will list all the

members for that particular group. For example:

Blue (group_id 1)

Tom (group_id 1)

Nancy (group_id 1)

Jim (group_id 1)

Red (group_id 2)

Bob (group_id 1)

Susan (group_id 1)

James (group_id 1)

...

My question is, do I need to run 2 queries? The first to select all the

groups and the second to select all the users in each group based on the

group_id? How would I loop through to create a table for each group? 

Thanks in advance for any help.

Randy Rankin


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




RE: [PHP] mysql_num_rows error

2002-09-23 Thread M . A . Bond


 I am new to php and that the folowing error: Warning:
mysql_num_rows():
 supplied argument is not a valid MySQL result resource in 
 /home/tbonestu/public_html/smallimages.php
 
 i dont know what i am doing wrong here is the code:
 
   $db = mysql_pconnect(connect info);
 
  mysql_select_db(images);
  $query = select * from images where type =.$type.;  $result = 
 mysql_query($query);  $num_results = mysql_num_rows($result);

That generally means your query failed. Try to echo mysql_error() after
your query to see what the problem is. You probably need quotes around $type
or $type has no value.

You also have too many quotes on the $query line, try echoing your $query
variable to see if it reads properly.

Mark



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




RE: [PHP] How do i assign Integers only and not real numbers?

2002-09-23 Thread M . A . Bond

You could cast it to an int, although the manual warns that you can get
spurious errors upon casting an unknown fraction, so be careful.

$year= (int) ($years);

Mark


-Original Message-
From: Tom [mailto:[EMAIL PROTECTED]] 
Sent: 23 September 2002 15:47
To: [EMAIL PROTECTED]
Subject: [PHP] How do i assign Integers only and not real numbers?


Hi all,

I have a line of code that assigns a new year number: -

$years = $years + ( $themonth / 12 );

but sometimes $years == 1998.08

or

$year == 2002.75

etc...

I cant find anything like a round() or floor() function in PHP so that year
would be 1998 or 2002 only.

Does anyone know what function would do this?  Sorry if I`m wasting your
time if its a really obvious one!

thanks in advance,
Tom



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


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




RE: [PHP] MS SQL Problem

2002-09-13 Thread M . A . Bond


?PHP
$hostname = LocalServer;
^^

This should be LocalHost (unless you are trying to connect to a server
with a DNS alias of LocalServer).

Mark

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




RE: [PHP] Re: Mail problem

2002-08-30 Thread M . A . Bond

I actually had to set the SMTP setting to localhost on our solaris boxes to
get this to work. I discovered this because we have a few older machines
without php.ini files altogether, and the default is to have this set (the
older machines worked).

Thanks

Mark Bond


-Original Message-
From: Mark Colvin [mailto:[EMAIL PROTECTED]] 
Sent: 30 August 2002 13:40
To: 'Erwin'
Cc: Php (E-mail)
Subject: RE: [PHP] Re: Mail problem


Still not resolved. I checked my local php.ini and the sendmail_path
variable is commented out. If I do a phpinfo() on the same server,
sendmail_path has a value of /usr/sbin/sendmail -t -i ? I don't know where
it pick up this value from but I can send emails from this server. The
production server that is situated with my isp also has the sendmail_path
set to /usr/sbin/sendmail -t -i but this won't send emails. Both web servers
are on linux 7.2 boxes. Am I correct in assuming that the SMTP and
sendmail_from variables are only relevant for webservers on windows hosts
and all I need to be concerned with is sendmail_path? I have searched
various places for an answer as to why I can't mail from my production
server without much success.



This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.


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

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




RE: [PHP] Exiting from an include or required file

2002-08-21 Thread M . A . Bond

Or just do a return();

?php
if (empty($_POST['search_criteria'])) 
{
echo You must provide search criteria;
  return;
}



-Original Message-
From: Roedel, Mark [mailto:[EMAIL PROTECTED]] 
Sent: 21 August 2002 15:48
To: Henry; php-general
Subject: RE: [PHP] Exiting from an include or required file



Seems like the easy way, at least in this case, would be to make the second
part of your File A an else to your if.

?php
if (empty($_POST['search_criteria'])) {
echo You must provide search criteria;
} else {
echo You provided search criteria;
}


---
Mark Roedel   | Blessed is he who has learned to laugh
Systems Programmer|  at himself, for he shall never cease
LeTourneau University |  to be entertained.
Longview, Texas, USA  |  -- John Powell


 -Original Message-
 From: Henry [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 21, 2002 9:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Exiting from an include or required file
 
 
 Hi All,
 
 I would like to exit from an include file and continue in the calling 
 script!
 
 As an example
 
 FILE A:
 
 ?php
 if (empty($_POST['search_criteria'))
 {
   echo You must provide search criteria;
 
   // exit the include file here But how?
  }
 
 echo You have provided serach criteria;
 ?
 
 
 FILE B
 
 #include A;
 
 form method=post
 input name=search_criteria type=text
 /form
 
 TIA
 
 Henry
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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

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