Re: [PHP-DB] Forms...

2005-03-10 Thread Neil Smith [MVP, Digital media]
At 07:52 10/03/2005 +, you wrote:
Message-ID: [EMAIL PROTECTED]
Date: Wed, 09 Mar 2005 20:37:36 +0100
From: Jochem Maas [EMAIL PROTECTED]
if your into XHTML:
input name=right_eye type=checkbox value=1 checked=checked 
value=1 /
Actually that's invalid XHTML (it won't validate) due to a typo I guess.
Each XML (aka XHTML) DOM element can only have a ~single~ attribute with a 
particular name.
The typo above has two copies if the 'value' attribute which would prevent 
the XHTML being valid XML.

HTH
Cheers - Neil 

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


Re: [PHP-DB] Forms...

2005-03-10 Thread Jochem Maas
Neil Smith [MVP, Digital media] wrote:
At 07:52 10/03/2005 +, you wrote:
Message-ID: [EMAIL PROTECTED]
Date: Wed, 09 Mar 2005 20:37:36 +0100
From: Jochem Maas [EMAIL PROTECTED]
if your into XHTML:
input name=right_eye type=checkbox value=1 checked=checked 
value=1 /

Actually that's invalid XHTML (it won't validate) due to a typo I guess.
true, yeah I added an extra value attr. wasn't paying enought attention.
Each XML (aka XHTML) DOM element can only have a ~single~ attribute with 
a particular name.
The typo above has two copies if the 'value' attribute which would 
prevent the XHTML being valid XML.

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


[PHP-DB] sporadic access denied/no db selected errors executing simple query...

2005-03-10 Thread Robert Locke
Greetings,
I have a problem which shows up *intermittently* when executing a
simple query.  Basically, mysql_query() returns no resource *some* of
the time.  When I trap the error using mysql_error(), I get the
following:
No Database Selected
For kicks, I altered the query to use the fully qualified table name
(db.table), and the error changed to:
Access denied for user: '[EMAIL PROTECTED]' to database 'db'
If I continue after the error, this is followed by:
PHP Warning: mysql_num_rows(): supplied argument is not a
 valid MySQL result resource in /home/www/...
I was able to replicate this on a browser as well as using ab with
no concurrency.  The system will sometimes handle 1000 or more queries
without any problems, and then a bunch of errors will appear.
I cannot roll this out into a production environment until this is
fixed.  I would really appreciate any advice.
Here's the relevant code:
$conn = mysql_connect(CHAR_DB,CHAR_DB_USER,CHAR_DB_PASS) or 
die(Cannot connect to db.);

mysql_select_db(USER_DB, $conn);
$sql = SELECT cash FROM cash WHERE id = '$id';
$res = mysql_query($sql);
if (!$res) {
error_log('Invalid query: ' . mysql_error());
}
$numrows = mysql_num_rows($res);
Thanks!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] reading a .txt file w/PHP and storing the data in mySQL

2005-03-10 Thread Art.M (Wikki)
Hi, new to the list and new period =) I found this great little gem
while RTFM and I modified it slightly for my use.

//?php
// Get a file into an array.  In this example we'll go through HTTP to get
// the values from the file that is being read
//$lines = file('http://www.w-ifc.com/test/SCORE.TXT');

// Loop through our array, show source; and line numbers too.
//foreach ($lines as $line_num = $line) {
//   echo Line #b{$line_num}/b :  . htmlspecialchars($line) . br /\n;
//}

//?

and .. it works nicely as you can see here ...

http://w-ifc.com/test/get_score.php

Now, it's seems fortunate that each Line#'s  (or now each array??) 
data is specific unto itself and there are no dependencies from other
lines in terms of managing the data.

So, now I wan't to store my array's in a nice orderly fashion in mySQL
DB. Which, I understand the basic stuff for getting into the DB. I
just don't quite understand my next step with the array itself... 
should explode() each line now to index each array or...  preset the
variables and then ...

Here is the breakdown of the DB I invision using

THINGS LIST

id  -key
game_id -maybe secondary key? (designated by upload interface)
game_date   (timezone specific on interface upload)
game_type   (heads up, 2 -vs- 2, tournement, stroke,
match, etc, etc)
game_format (style of play, scotch doubles, rotations, etc, ect)
game_version(version of game used)
course_name (self)
course_rating   (build or use existing formulae)

hole_played (self)
hole_handicap   (self)
hole_yardage(self)
hole_par(self)

player_name ...
player_handicap ...
player_score...
player_tee_box  ...

game_conditions ...
pin_positions   ...
gimmes  ...
mulligans   ...

front_9...
back_9   ...
total   ...


Your input is very appreciated and thanks ahead =)

Wik

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



[PHP-DB] Saving Data to a csv file

2005-03-10 Thread Lens Man
Hi,

I'm trying to make a downloadable csv file from a address database based on
PHP and MySQL.
I have a script for getting the data (no problem so far) but I want to have
the data delivered as a starting downlaod in csv format.
Can anyone give me a helping hand?

Thx in advance

Lensman

-- 
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION Kein Einrichtungspreis nutzen: http://www.gmx.net/de/go/dsl

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



RE: [PHP-DB] Saving Data to a csv file

2005-03-10 Thread Bastien Koert
I wrote this a while ago for a pipe-delimited file download
function force_download($file)
{
   //$dir=/path/to/file/;
   if (isset($file)) {
  header(Content-type: application/force-download);
  header('Content-Disposition: inline; filename=' . $file . '');
  header(Content-Transfer-Encoding: Binary);
  header(Content-length: .filesize($file));
  header('Content-Type: application/octet-stream');
  //header(Content-disposition: attachment; 
filename=.basename($file).);
  header('Content-Disposition: attachment; filename=' . $file . '');
  readfile($file);
   } else {
  echo No file selected;
   } //end if

}//end function
the parameter for the function s the filename
bastien
From: Lens Man [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Saving Data to a csv file
Date: Thu, 10 Mar 2005 18:53:16 +0100 (MET)
Hi,
I'm trying to make a downloadable csv file from a address database based on
PHP and MySQL.
I have a script for getting the data (no problem so far) but I want to have
the data delivered as a starting downlaod in csv format.
Can anyone give me a helping hand?
Thx in advance
Lensman
--
DSL Komplett von GMX +++ Supergünstig und stressfrei einsteigen!
AKTION Kein Einrichtungspreis nutzen: http://www.gmx.net/de/go/dsl
--
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] Variable Variable Array

2005-03-10 Thread Ryan Jameson \(USA\)
Hi Folks,

I've been using variable variables for years with PHP.

$var = myVarName;
$$var = Some Val;

echo $myVarName; //outputs Some Val


... 
Today I am trying to assign an Associative Array value to a variable
variable. For some reason it doesn't take. Does anyone know why?

Example:

$var['first']='bob';
$var['second']='frank';

$varName = myVarName;
$$varName = $var;

echo $$varName['second']; //should output frank but doesn't. :-\
-
echo $var['second']; //should output frank works fine.


The reason I want to do this is to speed up access to DATABASE query
results by use of the associative array. Since the results are keyed on
a specific column I'd like to load the very small recordset and then
access each row associatively on that column value. Currently I have to
requery the database every time, which is faster than loop/testing the
whole result set each time. I'd use a hashtable in Java but PHP ain't
Java. If ne1 has a better way I'm game.

Thanks for your help.
 Ryan

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



Re: [PHP-DB] Variable Variable Array

2005-03-10 Thread Evert | Rooftop Solutions
Ryan Jameson (USA) wrote:
Hi Folks,
I've been using variable variables for years with PHP.
 

I'm not really sure this is really good practice. Sure, php allows it 
but I think you should try to avoid them.

$var = myVarName;
$$var = Some Val;
echo $myVarName; //outputs Some Val
 
Today I am trying to assign an Associative Array value to a variable
variable. For some reason it doesn't take. Does anyone know why?

Example:
$var['first']='bob';
$var['second']='frank';
$varName = myVarName;
$$varName = $var;
echo $$varName['second']; //should output frank but doesn't. :-\
-
echo $var['second']; //should output frank works fine.
 

I'm not really sure what the problem is over here, but the obvious 
answer would be that PHP might not allow it's use on arrays.

The reason I want to do this is to speed up access to DATABASE query
results by use of the associative array. Since the results are keyed on
a specific column I'd like to load the very small recordset and then
access each row associatively on that column value. Currently I have to
requery the database every time, which is faster than loop/testing the
whole result set each time. I'd use a hashtable in Java but PHP ain't
Java. If ne1 has a better way I'm game.
 

Really, everyhing you describe can be done with normal arrays. Perhaps 
you should give a sample of the code so I could have a look and give 
ideas on how you could rewrite it.
The easiest way to rewrite your above example would be:

$var['first'] = 'bob';
$var['second'] = 'frank';
$myChangingVar = $var;
echo $myChangingVar['second'];   //outputs frank;
$myChangingVar['second'] = 'Michael Jackson';
echo $var['second'] // outputs USA's #1 icon
grt,
Evert
Thanks for your help.
 Ryan
 

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


Re: [PHP-DB] Variable Variable Array

2005-03-10 Thread Martin Norland
Ryan Jameson (USA) wrote:
Hi Folks,
I've been using variable variables for years with PHP.
$var = myVarName;
$$var = Some Val;
echo $myVarName; //outputs Some Val
[snip]
Example:
$var['first']='bob';
$var['second']='frank';
$varName = myVarName;
$$varName = $var;
echo $$varName['second']; //should output frank but doesn't. :-\
-
echo $var['second']; //should output frank works fine.
Try adding
	$frank = 'woopsie!';
to the top of your script and running it.
-
	echo ${$VarName}['second'];
is what you want - you want to be very clear what order these things 
need to be analyzed in, especially when dealing with arrays and the likes.

Cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


[PHP-DB] PHP and PostgreSQL

2005-03-10 Thread Van Ingen, Lane
I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux 
10.0.0 . I am getting
the following error out of Apache:
Fatal Error: Call to undefined function: pg_connect()
 
After browsing your web site, I found http://us2.php.net/pgsql . But am unable 
to proceed because I
am not sure what to do. Specific questions:
  (1) How do I determine what version of PHP I have? Browsed PHP directories, 
but couldn't find it.
  (2) The information I found said I could use a shared object module and/or 
(I think) alter php.ini .
 
I don't think this is hard to fix, but I need to find a blow-by-blow of what to 
do. Can somebody help me?


Re: [PHP-DB] PHP and PostgreSQL

2005-03-10 Thread Stephen Johnson
Did you compile php or did you install from a binary?

If you compiled -- did you configure the PHP module --with-pgsql?

I have not installed a binary in the past so I am not sure how you activate
the pgsql module in that regard.

The problem though is that the version of PHP you are running is not
configured to support pgsql and you will need to do that to get it recognize
the pgsql specific functions.


?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From: Van Ingen, Lane [EMAIL PROTECTED]
 Date: Thu, 10 Mar 2005 14:32:39 -0500
 To: php-db@lists.php.net
 Subject: [PHP-DB] PHP and PostgreSQL
 
 I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux
 10.0.0 . I am getting
 the following error out of Apache:
   Fatal Error: Call to undefined function: pg_connect()
 
 After browsing your web site, I found http://us2.php.net/pgsql . But am unable
 to proceed because I
 am not sure what to do. Specific questions:
 (1) How do I determine what version of PHP I have? Browsed PHP directories,
 but couldn't find it.
 (2) The information I found said I could use a shared object module and/or
 (I think) alter php.ini .
 
 I don't think this is hard to fix, but I need to find a blow-by-blow of what
 to do. Can somebody help me?
 

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



RE: [PHP-DB] PHP and PostgreSQL

2005-03-10 Thread Mychael Scribner
save this to a php file and run it. I a attached file just in case.

?php
phpinfo();
?

This will give you all of the information you will need for you php 
installation.

-Original Message-
From: Van Ingen, Lane [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 10, 2005 2:33 PM
To: php-db@lists.php.net
Subject: [PHP-DB] PHP and PostgreSQL


I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux 
10.0.0 . I am getting
the following error out of Apache:
Fatal Error: Call to undefined function: pg_connect()
 
After browsing your web site, I found http://us2.php.net/pgsql . But am unable 
to proceed because I
am not sure what to do. Specific questions:
  (1) How do I determine what version of PHP I have? Browsed PHP directories, 
but couldn't find it.
  (2) The information I found said I could use a shared object module and/or 
(I think) alter php.ini .
 
I don't think this is hard to fix, but I need to find a blow-by-blow of what to 
do. Can somebody help me?

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

RE: [PHP-DB] Variable Variable Array

2005-03-10 Thread Bastien Koert
Do you mean something like this:
http://www.weberdev.com/get_example-4065.html
It creates a quick associative array from the resultset
Bastien
From: Ryan Jameson (USA) [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Variable Variable Array
Date: Thu, 10 Mar 2005 11:56:16 -0700
Hi Folks,
I've been using variable variables for years with PHP.
$var = myVarName;
$$var = Some Val;
echo $myVarName; //outputs Some Val
...
Today I am trying to assign an Associative Array value to a variable
variable. For some reason it doesn't take. Does anyone know why?
Example:
$var['first']='bob';
$var['second']='frank';
$varName = myVarName;
$$varName = $var;
echo $$varName['second']; //should output frank but doesn't. :-\
-
echo $var['second']; //should output frank works fine.
The reason I want to do this is to speed up access to DATABASE query
results by use of the associative array. Since the results are keyed on
a specific column I'd like to load the very small recordset and then
access each row associatively on that column value. Currently I have to
requery the database every time, which is faster than loop/testing the
whole result set each time. I'd use a hashtable in Java but PHP ain't
Java. If ne1 has a better way I'm game.
Thanks for your help.
 Ryan
--
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] PHP and PostgreSQL

2005-03-10 Thread Van Ingen, Lane
I think from binary; it was installed as a part of Slackware, and I made no 
special efforts to compile. 
   Version of PHP is   4.3.7  (thanks Mychael)
 Other:
   Linux kernel is 2.4.26
   Apache version is 1.3.31
 
Looks like MySQL may already be configured in PHP (saw that in phpinfo() )
 
When installing PostgreSQL, I am fairly certain I made no attempt to configure 
anything in the database
to permit use of PHP, as that was not a consideration at that time. In fact, 
not sure it even asked; it did ask
about some languages (stored procedure language, TCL, etc).
 
-Original Message- 
From: Mychael Scribner [mailto:[EMAIL PROTECTED] 
Sent: Thu 3/10/2005 2:40 PM 
To: Van Ingen, Lane; php-db@lists.php.net 
Cc: 
Subject: RE: [PHP-DB] PHP and PostgreSQL



save this to a php file and run it. I a attached file just in case.

?php
phpinfo();
?

This will give you all of the information you will need for you php 
installation.


-Original Message- 
From: Stephen Johnson [mailto:[EMAIL PROTECTED] 
Sent: Thu 3/10/2005 2:37 PM 
To: Van Ingen, Lane; php-db@lists.php.net 
Cc: 
Subject: Re: [PHP-DB] PHP and PostgreSQL

Did you compile php or did you install from a binary?

If you compiled -- did you configure the PHP module --with-pgsql?

I have not installed a binary in the past so I am not sure how you activate
the pgsql module in that regard.

The problem though is that the version of PHP you are running is not
configured to support pgsql and you will need to do that to get it recognize
the pgsql specific functions.


?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax)

continuing the struggle against bad code

*/
?

 From: Van Ingen, Lane [EMAIL PROTECTED]
 Date: Thu, 10 Mar 2005 14:32:39 -0500
 To: php-db@lists.php.net
 Subject: [PHP-DB] PHP and PostgreSQL

 I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux
 10.0.0 . I am getting
 the following error out of Apache:
   Fatal Error: Call to undefined function: pg_connect()

 After browsing your web site, I found http://us2.php.net/pgsql . But am unable
 to proceed because I
 am not sure what to do. Specific questions:
 (1) How do I determine what version of PHP I have? Browsed PHP directories,
 but couldn't find it.
 (2) The information I found said I could use a shared object module and/or
 (I think) alter php.ini .

 I don't think this is hard to fix, but I need to find a blow-by-blow of what
 to do. Can somebody help me?





RE: [PHP-DB] Variable Variable Array

2005-03-10 Thread Ryan Jameson \(USA\)
echo ${$VarName}['second'];
is what you want - you want to be very clear what order these things
need to be analyzed in, especially when dealing with arrays and the
likes. 

That was the problem!!! Thanks guys.

 Ryan

-Original Message-
From: Martin Norland [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 10, 2005 12:19 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Variable Variable Array

Ryan Jameson (USA) wrote:
 Hi Folks,
 
 I've been using variable variables for years with PHP.
 
 $var = myVarName;
 $$var = Some Val;
 
 echo $myVarName; //outputs Some Val
[snip]
 Example:
 
 $var['first']='bob';
 $var['second']='frank';
 
 $varName = myVarName;
 $$varName = $var;
 
 echo $$varName['second']; //should output frank but doesn't. :-\
 -
 echo $var['second']; //should output frank works fine.

Try adding
$frank = 'woopsie!';
to the top of your script and running it.
-
echo ${$VarName}['second'];
is what you want - you want to be very clear what order these things
need to be analyzed in, especially when dealing with arrays and the
likes.

Cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257 The opinion(s) contained within this email do not
necessarily represent those of St. Jude Children's Research Hospital.

--
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] Variable Variable Array

2005-03-10 Thread Martin Norland
Evert|Rooftop Solutions wrote:
Ryan Jameson (USA) wrote:
I've been using variable variables for years with PHP.
I'm not really sure this is really good practice. Sure, php allows it 
but I think you should try to avoid them.
[snip]
It's excellent practice to use dynamic variables* when you need them. 
There are simply no practical ways around them in many cases, and they 
can make cleaner and shorter code in many many places.

For truly dynamic pieces of code, there's really just no other way 
(creating an arbitrary class object for an arbitrary database table and 
calling common methods (e.g. validate_data(), add()) on said classes.

Of course, when you're doing things like this, you need to make sure 
you're sanity checking your data that much more, as you can get into 
namespace issues if you aren't careful.

but if you're careful, you can get fun scary things like this!
$this-{$this-form} = new $this-form;
or this!
	$this-result[$table_name][$view_name] = 
${{$table_name}{$view_name}}-add($view_data);

... be sure to comment your code :)
* Note: I call them dynamic variables, I have no clue if that's the 
'accepted' term for them.  Makes sense to me, though.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


RE: [PHP-DB] Variable Variable Array

2005-03-10 Thread Ryan Jameson \(USA\)
Dynamic Variable sounds good. :-) I use them all the time, and they are
often necessary. Probably not in this case though, I like to throw them
in to confuse the newbs.. :-) J/K

 Ryan

-Original Message-
From: Martin Norland [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 10, 2005 1:53 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Variable Variable Array

Evert|Rooftop Solutions wrote:
 Ryan Jameson (USA) wrote:
 
 I've been using variable variables for years with PHP.

 I'm not really sure this is really good practice. Sure, php allows it 
 but I think you should try to avoid them.
[snip]
It's excellent practice to use dynamic variables* when you need them. 
There are simply no practical ways around them in many cases, and they
can make cleaner and shorter code in many many places.

For truly dynamic pieces of code, there's really just no other way
(creating an arbitrary class object for an arbitrary database table and
calling common methods (e.g. validate_data(), add()) on said classes.

Of course, when you're doing things like this, you need to make sure
you're sanity checking your data that much more, as you can get into
namespace issues if you aren't careful.

but if you're careful, you can get fun scary things like this!

$this-{$this-form} = new $this-form;

or this!

$this-result[$table_name][$view_name] =
${{$table_name}{$view_name}}-add($view_data);

... be sure to comment your code :)

* Note: I call them dynamic variables, I have no clue if that's the
'accepted' term for them.  Makes sense to me, though.

cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257 The opinion(s) contained within this email do not
necessarily represent those of St. Jude Children's Research Hospital.

--
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] Variable Variable Array

2005-03-10 Thread Evert | Rooftop Solutions
Ryan Jameson (USA) wrote:
Dynamic Variable sounds good. :-) I use them all the time, and they are
often necessary. Probably not in this case though, I like to throw them
in to confuse the newbs.. :-) J/K
 

Try regular expressions, it confuses them even more :)
Anyway, could you point me to a situation where it's nescesarry to use 
them? I'd like to see if I can do the same with about the same amount of 
code, without the use of dynamic variables

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


[PHP-DB] Grouping Data Together

2005-03-10 Thread Craig Hoffman
Hello,
I could use some assistance here.  I'll try and explain this the best I 
can.  I'm trying to get this query to work where it pulls up all the 
rows that are associated with a  common id .  For example let say you 
have data that you want to group together.  For example:

Group 1 would look like this:
Title 1
Abstract for title 1
- articles that belong to title 1
- articles that belong to title 1
Then group two:
Title 2
Abstract for title 2
- articles that belong to title 2
- articles that belong to title 2
and so forth
Basically my script is working, it queries the correct results,  but it 
only pulls up one set of results (title 1), instead of ALL results.  I 
am including the code below, perhaps someone could take a look at it?  
I hope this makes sense?  :)
- Craig

?php
require (include/db.php);
	$query = SELECT * FROM clients, articles WHERE clients.id = 
articles.id GROUP BY co_name ORDER BY date_uploaded;
	$result = mysql_query($query, $db) or die(mysql_error());
	echo(h3Client List/h3);
while ($row = mysql_fetch_array($result)) {
	
	$co_name = $row['co_name'];
	$co_logo = $row['co_logo'];
	$co_text = $row['co_text'];
	
	$corp_name = array($co_name);
	print_r ($corp_name);
	foreach ($corp_name as $corp1_name) {
	
		$rc = \r;	
	
			if ($co_logo = $co_logo) {
	echo (img src='./image/client_graphics/$co_logo' alt='$co_logo' 
width='150' height='69' class='co_name_img');
		}	
		echo(p);	
		echo ereg_replace($rc, 'br /', trim(stripslashes(div 
class='res_header'$corp1_name/div)));
		echo ereg_replace($rc, 'br /', trim(stripslashes($co_text)));

	$query = SELECT articles.*, clients.id FROM articles, clients WHERE 
clients.id = articles.id AND co_name = '$corp1_name' GROUP BY 
article_name ORDER BY date_uploaded;
	//echo $query;
	$result = mysql_query($query, $db) or die(mysql_error());

echo(ul class='client_list');
 while ($row = mysql_fetch_array($result)) {
$article_name = $row['article_name'];
echo(li$article_name/li);
}

echo(/ul);
echo(/p);
}
}
?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Grouping Data Together

2005-03-10 Thread Craig Hoffman
Found the problem - Craig
On Mar 10, 2005, at 5:47 PM, Craig Hoffman wrote:
Hello,
I could use some assistance here.  I'll try and explain this the best 
I can.  I'm trying to get this query to work where it pulls up all the 
rows that are associated with a  common id .  For example let say you 
have data that you want to group together.  For example:

Group 1 would look like this:
Title 1
Abstract for title 1
- articles that belong to title 1
- articles that belong to title 1
Then group two:
Title 2
Abstract for title 2
- articles that belong to title 2
- articles that belong to title 2
and so forth
Basically my script is working, it queries the correct results,  but 
it only pulls up one set of results (title 1), instead of ALL results. 
 I am including the code below, perhaps someone could take a look at 
it?  I hope this makes sense?  :)
- Craig

?php
require (include/db.php);
	$query = SELECT * FROM clients, articles WHERE clients.id = 
articles.id GROUP BY co_name ORDER BY date_uploaded;
	$result = mysql_query($query, $db) or die(mysql_error());
	echo(h3Client List/h3);
while ($row = mysql_fetch_array($result)) {
	
	$co_name = $row['co_name'];
	$co_logo = $row['co_logo'];
	$co_text = $row['co_text'];
	
	$corp_name = array($co_name);
	print_r ($corp_name);
	foreach ($corp_name as $corp1_name) {
	
		$rc = \r;	
	
			if ($co_logo = $co_logo) {
	echo (img src='./image/client_graphics/$co_logo' alt='$co_logo' 
width='150' height='69' class='co_name_img');
		}	
		echo(p);	
		echo ereg_replace($rc, 'br /', trim(stripslashes(div 
class='res_header'$corp1_name/div)));
		echo ereg_replace($rc, 'br /', trim(stripslashes($co_text)));

	$query = SELECT articles.*, clients.id FROM articles, clients WHERE 
clients.id = articles.id AND co_name = '$corp1_name' GROUP BY 
article_name ORDER BY date_uploaded;
	//echo $query;
	$result = mysql_query($query, $db) or die(mysql_error());

echo(ul class='client_list');
 while ($row = mysql_fetch_array($result)) {
$article_name = $row['article_name'];
echo(li$article_name/li);
}

echo(/ul);
echo(/p);
}
}
?
--
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] PHP and MySQL 5.0 stored procedures

2005-03-10 Thread Guy Harrison
Hi all,

I'm new to PHP, but have been doing a lot of work with the MySQL 5.0 alphas
looking at the stored procedure implementation.  I wanted to work with
stored procedures in the PHP mysqli interface, but it doesn't seem to be
ready for them yet.

The things I want to do with stored procedures that I can't seem to do yet
are:

*Create a prepared statement based on call stored proc (I get 'This
command is not supported in the prepared statement protocol yet')
*Retrieve the value of an OUT parameter from a stored procedure.  Eg,
after I execute the stored procedure I should be able to look into a
variable bound to the stored procedure and see the value put in there by the
stored procedure.
*Retrieve multiple result sets from the stored procedure.  Stored
procedures can return any number of result sets, so I'm looking for somthing
like the multi_query call to operate against a prepared statement.

I'm wondering if anyone knows if there is any activity around getting mysqli
ready for 5.0, and if there is any advanced info about how it might work.

Thanks,
Guy

[EMAIL PROTECTED]

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