Re: [PHP] Name of variable to string

2008-02-08 Thread Adrian Bruce

tedd wrote:

Hi gang:

From a variable with the name of $this_variable -- how do I get a 
string 'this_variable' ?


Cheers,

tedd
At some point or the other you will have to define $this_variable as 
$this_variable, so at that point you will have access to the string 
'this_variable'.  Even if you define it using variable vairables or 
within or for each loop (e.g. get_definied_vars, $_POST) you will have 
an oppertunity to get the 'this_variable' string.






Ade

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



Re: [PHP] generate xls file on fly

2008-02-08 Thread Adrian Bruce

Hiep Nguyen wrote:

hi friends,

i have a php page with the following logic:

html
head
titleDownload/title
/head
table
  trtdTitle/tdtdAuthor/td/tr
  ? $sql = select title,author from book where title != null and 
author != null; ?

  ? $rs = mysql_query($sql) or die(mysql_error()); ?
  ? while($row = mysql_fetch_array($rs)) { ?
  trtd?=$row[0];?/tdtd?=$row[1];?/td/tr
  ? } ?
  trtda href=Download Into Excel File/a/td/tr
/table
/html


is there anyway to generate this into xls file w/o using fopen  
fwrite to the server?  my goal is to have a link after the table and 
user can click on that link and a save window pop up to allow user to 
save to local disk.


appreciate very much for any input.

t. hiep



Somthing like this works ok, you can further refine it for the purpse 
you want. 


?php

$q= mysql_query(select * from table);
$count = mysql_num_fields($q);

//print field names
for ($i = 0; $i  $count; $i++) {
$header .= mysql_field_name($export, $i).\t;
}
//print data
while($row = mysql_fetch_array($q, MYSQL_NUM))
{
  $table[]  = implode(\t, $row);
}

$table= $header . \r\n . implode(\r\n, $table);
//set headers that prompt user for download
header(Content-Type: application/vnd.ms-excel);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
header(Content-Disposition: attachment; filename=fileName);
echo $table;

?

Ade

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



Re: [PHP] PHP LDAP - Single Sign On

2006-06-28 Thread Adrian Bruce
thanks for the response, i can see how this works  (i think) for basic 
authentication with user input,but what i really need is to actually 
retrieve the logged on user name after a user has logged into windows. 
i.e.  the user name that the http client passes to the apache mod has 
been captured not from user input, but from say a piece of code that 
picks up the user name when the user logs in.


Probably less to do with php now that i come to think of it, but thanks 
anyway.


Ade

Jay Blanchard wrote:

[snip]
Sorry if this has been asked before but i am currently drawing a blank 
STW etc.. is there any way of retrieving the user name of a user 
(through the browser) that has logged on to a network (windows OS).  I 
have used php with LDAP before and made the user log into the website, 
however i would really like to have a Single Sign On (SSO) environment.


Is this possible? PHP is my preferred language but if you know of any 
way of doing this i would be greatful.

[/snip]

http://www.pocket.com/ldap
http://httpd.apache.org/docs/2.0/mod/mod_auth_ldap.html

  


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



[PHP] PHP LDAP - Single Sign On

2006-06-27 Thread Adrian Bruce

Hi all

Sorry if this has been asked before but i am currently drawing a blank 
STW etc.. is there any way of retrieving the user name of a user 
(through the browser) that has logged on to a network (windows OS).  I 
have used php with LDAP before and made the user log into the website, 
however i would really like to have a Single Sign On (SSO) environment.  
Is this possible? PHP is my preferred language but if you know of any 
way of doing this i would be greatful.


TIA

Ade

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



[PHP] require_once hell

2006-03-29 Thread Adrian Bruce

Hi

this may be a stupid moment but i cant find an help on google so.i 
am including two classes in my code using the  require_once(path to 
file) method.  this works fine for the first class but when including 
the second it simply outputs the contents on to the page.  I feel I must 
be missing something stupid so i have not included any example code, any 
general ideas?


Thanks in advance

Ade

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



[PHP] Date addition problem

2006-03-29 Thread Adrian Bruce

Hi

I am having an unusual problem when trying to calculate dates in advance 
from a start date.  the code below shows a loop where by on each run an 
increasing number of weeks is added to the start date, this works as 
expected up untill the 8th time where for some reason it produces 
01-11-05 instead of 02-11-05.  I am at a loss as to why this would 
happen when it works perfectly for all the other dates.  where am i 
going wrong?


[snip]

?php
echoh1 date test/h1;
$start = 05-09-07;
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('d-m-y',$startmk);

for($i=0;$i10;$i++){
   $nextdate = date('d-m-y',$startmk + ($i*604800));
   echoh1$i:  $startdate -- -- --$nextdate/h1;
}
?   


OUTPUT:

0: 07-09-05 -- -- --07-09-05
1: 07-09-05 -- -- --14-09-05
2: 07-09-05 -- -- --21-09-05
3: 07-09-05 -- -- --28-09-05
4: 07-09-05 -- -- --05-10-05
5: 07-09-05 -- -- --12-10-05
6: 07-09-05 -- -- --19-10-05
7: 07-09-05 -- -- --26-10-05
8: 07-09-05 -- -- --01-11-05
9: 07-09-05 -- -- --08-11-05

[/snip]

Thanks a lot

Ade

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



Re: [PHP] Date addition problem

2006-03-29 Thread Adrian Bruce
That should not effect it, if i am adding $i * 7 days each time then i 
should get the date that comes 7 days later irrespective of how many 
days are in the month, shouldn't I ?  8 * 7 = 56, 56 days after the 
07-09-05 is 02-11-2005.


Thomas Munz wrote:

Cause 9th month have 30 days but 10th month have 31 days. You don't check the 
amount of day there... :)



on Wednesday 29 March 2006 14:51, Adrian Bruce wrote:
 


Hi

I am having an unusual problem when trying to calculate dates in advance
from a start date.  the code below shows a loop where by on each run an
increasing number of weeks is added to the start date, this works as
expected up untill the 8th time where for some reason it produces
01-11-05 instead of 02-11-05.  I am at a loss as to why this would
happen when it works perfectly for all the other dates.  where am i
going wrong?

[snip]

?php
echoh1 date test/h1;
$start = 05-09-07;
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('d-m-y',$startmk);

for($i=0;$i10;$i++){
   $nextdate = date('d-m-y',$startmk + ($i*604800));
   echoh1$i:  $startdate -- -- --$nextdate/h1;
}
?

OUTPUT:

0: 07-09-05 -- -- --07-09-05
1: 07-09-05 -- -- --14-09-05
2: 07-09-05 -- -- --21-09-05
3: 07-09-05 -- -- --28-09-05
4: 07-09-05 -- -- --05-10-05
5: 07-09-05 -- -- --12-10-05
6: 07-09-05 -- -- --19-10-05
7: 07-09-05 -- -- --26-10-05
8: 07-09-05 -- -- --01-11-05
9: 07-09-05 -- -- --08-11-05

[/snip]

Thanks a lot

Ade
   



 



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



Re: [PHP] Date addition problem

2006-03-29 Thread Adrian Bruce


I have come up with an alternative myself but still cant explain why the 
first method did not work, still be interested to know why if anyone can 
offer some thoughts. Using strtotime for the calc seems to produce 
correct results


my soluiton:
[snip]

?php
echoh1 date test 2/h1;
$start = 05-09-07;
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('Y-m-d',$startmk);

for($i=0;$i10;$i++){
   $add = $i*7;  
   $nextdate = date('d-m-y', strtotime($startdate. + .$add. days));   
   echoh1$i:  $startdate -- -- --$nextdate/h1;

}
?  


[/snip]

Adrian Bruce wrote:

That should not effect it, if i am adding $i * 7 days each time then i 
should get the date that comes 7 days later irrespective of how many 
days are in the month, shouldn't I ?  8 * 7 = 56, 56 days after the 
07-09-05 is 02-11-2005.


Thomas Munz wrote:

Cause 9th month have 30 days but 10th month have 31 days. You don't 
check the amount of day there... :)



on Wednesday 29 March 2006 14:51, Adrian Bruce wrote:
 


Hi

I am having an unusual problem when trying to calculate dates in 
advance

from a start date.  the code below shows a loop where by on each run an
increasing number of weeks is added to the start date, this works as
expected up untill the 8th time where for some reason it produces
01-11-05 instead of 02-11-05.  I am at a loss as to why this would
happen when it works perfectly for all the other dates.  where am i
going wrong?

[snip]

?php
echoh1 date test/h1;
$start = 05-09-07;
$start = explode('-',$start);
$startmk = mktime(0,0,0,$start[1],$start[2],$start[0]);
$startdate = date('d-m-y',$startmk);

for($i=0;$i10;$i++){
   $nextdate = date('d-m-y',$startmk + ($i*604800));
   echoh1$i:  $startdate -- -- --$nextdate/h1;
}
?

OUTPUT:

0: 07-09-05 -- -- --07-09-05
1: 07-09-05 -- -- --14-09-05
2: 07-09-05 -- -- --21-09-05
3: 07-09-05 -- -- --28-09-05
4: 07-09-05 -- -- --05-10-05
5: 07-09-05 -- -- --12-10-05
6: 07-09-05 -- -- --19-10-05
7: 07-09-05 -- -- --26-10-05
8: 07-09-05 -- -- --01-11-05
9: 07-09-05 -- -- --08-11-05

[/snip]

Thanks a lot

Ade
  



 





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



[PHP] displaying documents stored under web root

2006-03-10 Thread Adrian Bruce

Hi

After some advice (surprise!)

I currently store restricted documents beneath the web root so they are 
not accessible via the URL, when a valid user wishes to view a document 
i copy it to a temporary folder above the root and load it in a new 
page.  the only way i can then manage to delete the copy is 
automatically deleting all temp files when any user goes to the log out 
page.


This is obviously not a very good way of doing this but unless i can 
establish when a user is no longer viewing the doc then i dont know when 
to delete it.  I was wandering how others deal with these problems like this


any advice appreciated greatly

Ade

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



Re: [PHP] PHP and LDAP...

2006-01-17 Thread Adrian Bruce

David

I found this resource usefull when authenticating users against LDAP, 
its easy to set up and use.


http://adldap.sourceforge.net/

Ade

David BERCOT wrote:


Hi,

I'm new on this list and with PHP. But I am a old web developer (with
ASP).
I'm looking for verifying a username/password in Active Directory with a
LDAP request...
I have this error :
Warning: ldap_search() [function.ldap-search]: Search: Operations error
in /var/www/ldap.html on line 69

I think my criterias are not OK but I think there are classical :
$sr=ldap_search($ds,o=Justice, c=FR,(sn=Berc*));

Do you have a little example which always return an answer, in AD or in
true LDAP (because I have two different servers) ?

Then, I have another question... As I said, I'd like to verify
username/password. Is it possible ? With AD ? With LDAP ?
Is the password clear on network ? Do I have some solutions to resolve
that problem ?

Thank you very much.

David.

 



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



[PHP] Maps and plotting data

2006-01-10 Thread Adrian Bruce


Has anyone used any of the php mapping classes that are available? 
(Image_GIS etc) I would like to create dynamic maps and plot data i.e. 
postcodes on them like you do in applications like map-point.  I am not 
quite sure if  there is any php scripts/programs that already do this or 
if i have to do this myself. 

I can see it being very time consuming to geo-map a map image and match 
up all co-ordinates with postal code values!


Any suggestions/experiences would be most appreciated.

Thanks
Ade

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



Re: [PHP] Is there a way to display data from database for Select Options in a form?

2006-01-10 Thread Adrian Bruce

Something along these lines will work fine

?php
$query = mysql_query(select dates from table ) or die (mysql_error());

echoselect name='test';

while ($row = mysql_fetch_array($query, MYSQL_NUM)){
  
   echooption value='$row[0]'$row[1]/option;


}
echo/select;
?

Regards
Ade

Sue wrote:


Hello,

We have a form that contains a Select option for a listing of available 
dates for the user to choose from.  Right now we have to manually change the 
dates within the form's Selection list as new dates become available to 
choose from.  We currently store these available dates in our database, and 
am wondering if we can somehow extract these dates from the table to display 
in our form?  This would eliminate alot of maintenance needed to this form. 
If anyone has any ideas as to reference material etc. that I may look which 
would give me an idea how to do this using PHP, I'd appreciate it!


Thanks!
Sue 

 



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



Re: [PHP] Is there a way to display data from database for Select Options in a form?

2006-01-10 Thread Adrian Bruce
the quickest solution and one that is easy to understand, I am no php 
expert and have never claimed as such so why 'noob'?


Why is this such a poor method? if i type the HTML to be outputted 
correctly then what validation is required? also I think Someone new 
would run from your proposed solution


Jochem Maas wrote:


teaching noobs to output html while (oun intended) looping thru a
result set is counter-productive. discuss.

Adrian Bruce wrote:


Something along these lines will work fine

?php
$query = mysql_query(select dates from table ) or die (mysql_error());

echoselect name='test';

while ($row = mysql_fetch_array($query, MYSQL_NUM)){
 echooption value='$row[0]'$row[1]/option;

}
echo/select;
?

Regards
Ade

Sue wrote:


Hello,

We have a form that contains a Select option for a listing of 
available dates for the user to choose from.  Right now we have to 
manually change the dates within the form's Selection list as new 
dates become available to choose from.  We currently store these 
available dates in our database, and am wondering if we can somehow 
extract these dates from the table to display in our form?  This 
would eliminate alot of maintenance needed to this form. If anyone 
has any ideas as to reference material etc. that I may look which 
would give me an idea how to do this using PHP, I'd appreciate it!


Thanks!
Sue
 







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



[PHP] gdf fonts

2005-12-21 Thread Adrian Bruce

Hi

Does anyone know where i can get some decent gdf fonts for using in the 
imageloadfont() function, i have found some on the net but they are all 
a bit naf so far.  I'm really just looking for something like Arial or 
verdana.  Im creating pie charts on the fly but at the moment they look 
like something that would be produced by a spectrum or commodore 64!


Thanks
Adrian

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



Re: [PHP] One big file or many includes?

2005-12-16 Thread Adrian Bruce
Definitely sounds as if you should be employing the object-orientated 
methodology, If the project is as big as you say it is then really you 
should be looking to use some UML planning tool so that you can keep all 
you code organised. 

It is ok on smaller projects to bash out some rough plans and get into 
the coding but with  more complex requirements its a recipe for 
disaster, wait until you client asks for a few seemingly simple changes 
and then you realize just how important a good design and plan is.


good luck
Adrian

Aaron Koning wrote:


I don't know about whats best for the compiler (rather interpreter), but if
it is a really big site with a lot of access, transaction and management
functionality I recommend you start breaking the code into classes and
separating each class into a file and documenting... A LOT! It will be
clearer to understand and maintain. IMHO.

There are lots of sites out there that describe how to separate web code
into layers such as: display, logic/rules, database interactivity, etc.

Aaron

On 12/15/05, Martin Leduc [EMAIL PROTECTED] wrote:
 


Hi everyones,

I coding PHP since 2002 and this is the first time I have to take this
decision.

My group and I have to build a VERY, VERY BIG website for a callcenter
users.  Understand I have to create (or use ;)) several code for access,
transactions and management.

The customer had buy MSSQL server, so we have to use it and it's working
very fine.  NO MYSQL (is not my personal choice ;))

Currently it's already hard to program and now we have many file.  We have
only 20% done and the code are a real mess!!!

Creating Class, functions, splitting code in several php files using
include, see the files sitemap??

So for the optimisation topic, what is THE BEST for the PHP compiler.  One
big file or many included files?

Regards

Martin

PS:  If some one know somes related links about the subject, please dont
hesitate. ;)

--
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] upload path

2005-12-16 Thread Adrian Bruce

hi all

a quick one i hope! i am trying to allow users to save a set of data as 
a csv file when clicking on a link on our intranet.  i can do all the 
formatting and output to file but i would like the user to be able to 
specify where the file is saved in the same way as they would choose a 
file to upload.  Any ideas how this can be done?


thanks
Ade

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



Re: [PHP] upload path

2005-12-16 Thread Adrian Bruce
i see what you mean but i dont think that will work for me, ideally  
just want them to choose a location after which i will create the file 
in this location.  the only option i can think of the moment is to 
default to the users home directory.


Ive just realised that the subject of my email is rather misleading, 
sorry i am a numpty at times.


Ade

Jay Blanchard wrote:


[snip]
a quick one i hope! i am trying to allow users to save a set of data as 
a csv file when clicking on a link on our intranet.  i can do all the 
formatting and output to file but i would like the user to be able to 
specify where the file is saved in the same way as they would choose a 
file to upload.  Any ideas how this can be done?

[/snip]

You could have a drop down list of the available directories for storage on
the server and use that with move_uploaded_file()
 



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



Re: [PHP] upload path

2005-12-16 Thread Adrian Bruce

aaah, scrap that, i think i have solved my own problem,

thanks for your time anyway,



Jay Blanchard wrote:


[snip]
i see what you mean but i dont think that will work for me, ideally  
just want them to choose a location after which i will create the file 
in this location.  the only option i can think of the moment is to 
default to the users home directory.


Ive just realised that the subject of my email is rather misleading, 
sorry i am a numpty at times.

[/snip]

Are you wanting to create a directory for them, that they name?

 



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



[PHP] Automatic log out

2005-12-01 Thread Adrian Bruce

Hi

I currently use an automatic logout out system that sets a time out  in 
two ways.


(If the ip address on computer is recognized then set timeout to 10 
mins, if not then set to 2 mins.)


1) The time out setting is used to create a meta refresh tag that will 
re-direct the user to the logout page after X seconds. 
2) At the beginning of each page i set a variable with the current time 
and check to see if the difference between the previously set variable 
and the now current time is greater than X seconds, if so then log the 
user out. 

I know meta refresh is not to be relied on and that is why i use the 2nd 
method as well, but i have had varied reports that this system does not 
work, i.e. it logs people out to quickly. 

Does anyone know a better way of doing this or improvements?? it would 
also be nice to stop the pages displaying after a time out when a user 
presses the back button!


Thanks a lot in advance

Adrian

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



[PHP] Dynamic DB query - form display

2005-11-18 Thread Adrian Bruce

Hi

I am trying Dynamically creating a Query based on form input for an 
intranet, i have a text input that allows a user to input part of a 
where clause such as  - not like '04%' - . this bit works fine but i 
would like to display the clause back in the form field when the page 
reloads. 


$clause = not like '04%';
echoinput type='text' value='$clause';

Now obviously i hit a problem with the use of 'the quotation marks ' '  
and just see - not like \  - in the form field.  I need to keep the ' 
marks around the 04% for the query.  Any ideas how i can do this??


Any help much appreciated!

Adrian

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



Re: [PHP] Dynamic DB query - form display

2005-11-18 Thread Adrian Bruce


I'm aware it would be a security hole if it were available to all users, 
but it's just for me at the mo, other users get a watered down version 
with just check  boxes. I basically want to allow flexible filtering of 
a set of data but obviously this poses a few challenges, any ideas 
always weclome!


Thanks for the tip by the way,  i ended up doing the following

$field = stripslashes(htmlentities($field,ENT_QUOTES));

Adrian

David Grant wrote:


Hi Adrian,

This appears to be a security hole, but since that wasn't the reason for
the question, please try:

echoinput type='text' value=' . htmlentities($clause, ENT_QUOTES) . ';

php.net/htmlentities

Cheers,

David Grant

Adrian Bruce wrote:
 


Hi

I am trying Dynamically creating a Query based on form input for an
intranet, i have a text input that allows a user to input part of a
where clause such as  - not like '04%' - . this bit works fine but i
would like to display the clause back in the form field when the page
reloads.
$clause = not like '04%';
echoinput type='text' value='$clause';

Now obviously i hit a problem with the use of 'the quotation marks ' ' 
and just see - not like \  - in the form field.  I need to keep the '

marks around the 04% for the query.  Any ideas how i can do this??

Any help much appreciated!

Adrian

   



 



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



Re: [PHP] post and variables

2005-11-10 Thread Adrian Bruce

if (($_POST['$table_name']) == 1){

//do something

}

what you have is essentialll looking for a posted value called '$table_name== 
1'!


Ross wrote:


Thanks fpr all the feedback on the password but I have another one...

How do I use $_POST with variables. Cant find an example of this anywhere on 
php.net



if ($_POST['$table_name== 1']) {

//do something

}

Ta,

ross

 



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



Re: [PHP] Detailed Report

2005-10-27 Thread Adrian Bruce


load each row of the resultset into an array $row using 
mysql_fetch_array(), each field in the result set  row will  be held in 
the corresponding array element.


while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
   echo$row[0] | $row[1] | $row[2];
}

Hope this helps,
Ade

Danny wrote:


Hi All,
I´ve got a connection, to a MySQL db, and get the following
ResultSet(Category | Name | Code | City)
Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
Customers | Max | A36 | Paris
Providers | John | A36 | London
Providers | Mark | B67 | Madrid
And I need the report in the following format:
Customers
John - A36 - New York
Jason - B45 - Los Angeles
Max - A36 - Paris
Providers
John - A36 - London
Mark - B67 - Madrid
Any one can help? I´m a bit stalled
thx
regards.
--

 



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



Re: [PHP] Detailed Report

2005-10-27 Thread Adrian Bruce
ok, so i assume that customers is a grouping of some sort and that in 
some cases you may come accross a row like Staff | John | A36 |LA .  
It may not be a perfect way of doinig it but this is what i would 
generally try:


  while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
   if($row[0] == $group){
echo $row[1] | $row[2]; 
  }

  else{
 echo$row[0]br/br/$row[1] | $row[2] | $row[3];
  }
   $group = $row[0];
}

Ade

Danny wrote:

Thanks for your help Adrian, but the problem is that I need to show 
row[0] once (Customers text are repeated), and below the details of 
the records
 
Your solution shows:
 
Customers | John | A36 | New York

Customers | Jason | B45 | Los Angeles
(...)
And I need
CustomersBR
John | A36 | New York
Jason | B45 | Los Angeles
 
(...)
 
 
 
(...)
 
 
 



 
On 10/27/05, *Adrian Bruce* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:



load each row of the resultset into an array $row using
mysql_fetch_array(), each field in the result set  row will  be
held in
the corresponding array element.

while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
   echo$row[0] | $row[1] | $row[2];
}

Hope this helps,
Ade

Danny wrote:

Hi All,
 I´ve got a connection, to a MySQL db, and get the following
ResultSet(Category | Name | Code | City)
 Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
Customers | Max | A36 | Paris
Providers | John | A36 | London
Providers | Mark | B67 | Madrid
And I need the report in the following format:
 Customers
John - A36 - New York
Jason - B45 - Los Angeles
Max - A36 - Paris
 Providers
John - A36 - London
Mark - B67 - Madrid
 Any one can help? I´m a bit stalled
 thx
regards.
--




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




--
dpc 


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



Re: [PHP] selected index

2005-10-25 Thread Adrian Bruce


dont know of a function but this should work

$size = count($array);
for($i=0;$i$size;$i++){
   if($selected_person == $array[$i]){
  echoindex: $i;
   }
}

Adrian

Ross wrote:


Hi,

I have an array

$people= array (ross, bob, chris)
I have a variable

$selected_person = chris



I want to do the find out the index of the $selected_person in the $people 
array. Is there a function that can do this??


ta,



Ross

 



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



Re: [PHP] create HTML page on the fly

2005-10-25 Thread Adrian Bruce
I think you can use a different handle when using fwrite() which will 
make php create a file if one is not already there: something  like


if ($fp = fopen($file,x+)){
   echoopened; 
} 
   fwrite($fp,$content);

   fclose($fp);

Ade

Angelo Zanetti wrote:


Hi guys.

I've created a small newsletter application and the content of the 
newsletter is stored in a DB (the HTML).


However once the newsletter is complete and the user clicks a button I 
want the newsletter/html file  to be created on the server. How do I 
go about this?


I assume that I will use fwrite() to add the HTML to the file, I need 
to know how to actually create the file before adding the content to it.


thanks in advance.
Angelo



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