php-general Digest 14 Jan 2007 13:49:08 -0000 Issue 4569

Topics (messages 247047 through 247068):

Re: Hello
        247047 by: John Meyer
        247048 by: David Giragosian
        247049 by: Skip Evans

multidimensional array problems
        247050 by: nitrox doe
        247058 by: Larry Garfield
        247060 by: Larry Garfield
        247063 by: Jim Lucas

fopen and fwrite r+
        247051 by: Richard Kolseth
        247054 by: Roman Neuhauser

Re: Extracting XMP text from Jpeg
        247052 by: Bill Guion
        247061 by: Dotan Cohen

Re: Anyone would like to test my open source application 
http://sourceforge.net/projects/dfo/ ?
        247053 by: Gert Cuykens
        247055 by: Jürgen Wind
        247059 by: Gert Cuykens

Stripslashes
        247056 by: Beauford
        247064 by: Jim Lucas
        247065 by: Larry Garfield
        247066 by: Jim Lucas

Re: Javascript detection , working version
        247057 by: Casey Chu

Re: Include file error, common one I think
        247062 by: Chris Carter

colon in coma [was: Re: [PHP] Anyone would like to test my open source 
application http://sourceforge.net/projects/dfo/ ?]
        247067 by: Roman Neuhauser
        247068 by: Colin Guthrie

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Edward wrote:
> How do I create a php document so that people in my nonprofit can vote
> on issues online through the organization's website?
> 
> Thanks,
> 
> Edward
> 
Start with PHP, add MySQL or your database of choice, mix and prepare.
Serves 500+.

--- End Message ---
--- Begin Message ---
On 1/13/07, John Meyer <[EMAIL PROTECTED]> wrote:

Edward wrote:
> How do I create a php document so that people in my nonprofit can vote
> on issues online through the organization's website?
>
> Thanks,
>
> Edward
>
Start with PHP, add MySQL or your database of choice, mix and prepare.
Serves 500+.

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


Edward,

Maybe start by telling the group your level of experience with PHP, MySQL,
(Javascript), ...

Just a thought.

David

--- End Message ---
--- Begin Message --- I think David is going to need to install something like PostNuke that comes with a polls module or something like that.

But David's suggestion is a good one... how much PHP/MySQL experience do you have?

Skip

David Giragosian wrote:
On 1/13/07, John Meyer <[EMAIL PROTECTED]> wrote:


Edward wrote:
> How do I create a php document so that people in my nonprofit can vote
> on issues online through the organization's website?
>
> Thanks,
>
> Edward
>
Start with PHP, add MySQL or your database of choice, mix and prepare.
Serves 500+.

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


Edward,

Maybe start by telling the group your level of experience with PHP, MySQL,
(Javascript), ...

Just a thought.

David


--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240

=-=-=-=-=-=-=-=-=-=-=

Check out PHPenguin, a lightweight and versatile PHP/MySQL development framework.

http://phpenguin.bigskypenguin.com

--- End Message ---
--- Begin Message ---
hi all,
im very new to php but i think i jumped on the
toughest thing to learn. Im trying to create a
team roster that will show game, game type
and league and then show each member based
on the game type. Ive worked out alot of code
but just cant figure where im going wrong. so
here is my code. Any pointers would be greatly
appreciated.

this is an example of what im trying to do
http://www.chalkthree.com/exampleroster.html

php code
<?php
//begin member league table
$memroster = "SELECT inf_league.game, inf_league.type, inf_member.user_name, inf_member.rank, " .
            "inf_member.country, inf_member.email " .
            "FROM inf_league " .
"INNER JOIN inf_memberleague ON inf_league.gid = inf_memberleague.l_id " . "INNER JOIN inf_member ON inf_member.user_id = inf_memberleague.m_id";
$memrosterresults = mysql_query($memroster)
 or die(mysql_error());
 while ($row = mysql_fetch_array($memrosterresults)) {

foreach ($row as $game => $type) {
echo "<p>";
echo "$type";
 foreach ($row as $type => $user_name) {
echo "$user_name" . " - " . "$rank" . " - " . "$country" . " - " . "$email"; }
print '</p>';
}
}
//end member league table
?>








mysql


CREATE TABLE `inf_league` ( `gid` int(11) NOT NULL auto_increment, `game` varchar(255) NOT NULL, `type` varchar(255) NOT NULL, `league` varchar(255) NOT NULL, `season` varchar(255) NOT NULL, PRIMARY KEY (`gid`)) TYPE=MyISAM AUTO_INCREMENT=4 ;-- -- Dumping data for table `inf_league`-- INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF', 'TWL', '2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (3, 'CoD2', 'Search & Destroy', 'CAL', '2006 4th QTR');-- ---------------------------------------------------------- -- Table structure for table `inf_member`-- CREATE TABLE `inf_member` ( `user_id` int(11) NOT NULL auto_increment, `user_level` int(2) NOT NULL default '0', `list_order` int(3) NOT NULL default '0', `user_name` varchar(100) NOT NULL default '', `password` varchar(25) NOT NULL default '', `email` varchar(100) NOT NULL default '', `country` text NOT NULL, `game` text, `rank` varchar(40) default NULL, `qoute` longtext, `config` int(1) default '0', `map` varchar(100) default '', `gun` varchar(100) default '', `brand` varchar(100) default '', `cpu` varchar(20) default '', `ram` varchar(20) default '', `video` varchar(100) default '', `sound` varchar(100) default '', `monitor` varchar(100) default '', `mouse` varchar(100) default '', PRIMARY KEY (`user_id`)) TYPE=MyISAM AUTO_INCREMENT=3 ;-- -- Dumping data for table `inf_member`-- INSERT INTO `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox', 'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 'Founder', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 1, 'raze', 'itsme', '[EMAIL PROTECTED]', 'United States', NULL, 'Leader', NULL, 0, '', '', '', '', '', '', '', '', '');-- ---------------------------------------------------------- -- Table structure for table `inf_memberleague`-- CREATE TABLE `inf_memberleague` ( `l_id` int(4) NOT NULL, `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for table `inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 1);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 1);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 2);

_________________________________________________________________
Get live scores and news about your team: Add the Live.com Football Page www.live.com/?addtemplate=football&icid=T001MSN30A0701
--- End Message ---
--- Begin Message ---
It's better to just leave the record as an array and read it that way.

while ($row = mysql_fetch_assoc($result)) {
print "<tr><td>{$row['game']}</td> <td>{$row['type']}</td></tr>\n";
}

And so on.  You're not actually dealing with a multi-dimensional array yet; 
$result is an object from which you are extracting data records as 
one-dimensional associative arrays.

On Saturday 13 January 2007 7:40 pm, nitrox doe wrote:
> hi all,
> im very new to php but i think i jumped on the
> toughest thing to learn. Im trying to create a
> team roster that will show game, game type
> and league and then show each member based
> on the game type. Ive worked out alot of code
> but just cant figure where im going wrong. so
> here is my code. Any pointers would be greatly
> appreciated.
>
> this is an example of what im trying to do
> http://www.chalkthree.com/exampleroster.html
>
> php code
> <?php
> //begin member league table
> $memroster = "SELECT inf_league.game, inf_league.type,
> inf_member.user_name, inf_member.rank, " .
>              "inf_member.country, inf_member.email " .
>              "FROM inf_league " .
>              "INNER JOIN inf_memberleague ON inf_league.gid =
> inf_memberleague.l_id " .
>              "INNER JOIN inf_member ON inf_member.user_id =
> inf_memberleague.m_id";
> $memrosterresults = mysql_query($memroster)
>   or die(mysql_error());
>   while ($row = mysql_fetch_array($memrosterresults)) {
>
> foreach ($row as $game => $type) {
> echo "<p>";
> echo "$type";
>   foreach ($row as $type => $user_name) {
> echo "$user_name" . " - " . "$rank" . " - " . "$country" . " - " .
> "$email"; }
> print '</p>';
> }
> }
> //end member league table
> ?>
>
>
>
>
>
>
>
>
> mysql
>
>
> CREATE TABLE `inf_league` (  `gid` int(11) NOT NULL auto_increment,  `game`
> varchar(255) NOT NULL,  `type` varchar(255) NOT NULL,  `league`
> varchar(255) NOT NULL,  `season` varchar(255) NOT NULL,  PRIMARY KEY 
> (`gid`))
> TYPE=MyISAM  AUTO_INCREMENT=4 ;-- -- Dumping data for table `inf_league`--
> INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES
> (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO `inf_league`
> (`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF',
> 'TWL', '2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`,
> `league`, `season`) VALUES (3, 'CoD2', 'Search & Destroy', 'CAL', '2006 4th
> QTR');-- ---------------------------------------------------------- --
> Table structure for table
> `inf_member`-- CREATE TABLE `inf_member` (  `user_id` int(11) NOT NULL
> auto_increment,  `user_level` int(2) NOT NULL default '0',  `list_order`
> int(3) NOT NULL default '0',  `user_name` varchar(100) NOT NULL default '',
> `password` varchar(25) NOT NULL default '',  `email` varchar(100) NOT NULL
> default '',  `country` text NOT NULL,  `game` text,  `rank` varchar(40)
> default NULL,  `qoute` longtext,  `config` int(1) default '0',  `map`
> varchar(100) default '',  `gun` varchar(100) default '',  `brand`
> varchar(100) default '',  `cpu` varchar(20) default '',  `ram` varchar(20)
> default '',  `video` varchar(100) default '',  `sound` varchar(100) default
> '',  `monitor` varchar(100) default '',  `mouse` varchar(100) default '',
> PRIMARY KEY  (`user_id`)) TYPE=MyISAM  AUTO_INCREMENT=3 ;--
> -- Dumping data for table `inf_member`-- INSERT INTO `inf_member`
> (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`,
> `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`,
> `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox',
> 'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 'Founder', NULL, 0, 
> NULL,
> NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO `inf_member`
> (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`,
> `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`,
> `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 1, 'raze',
> 'itsme', '[EMAIL PROTECTED]', 'United States', NULL, 'Leader', NULL, 0, '',
> '', '', '', '', '', '', '', '');--
> ---------------------------------------------------------- -- Table
> structure for table
> `inf_memberleague`-- CREATE TABLE `inf_memberleague` (  `l_id` int(4) NOT
> NULL,  `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for table
> `inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES
> (1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 1);INSERT
> INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 1);INSERT INTO
> `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 2);
>
> _________________________________________________________________
> Get live scores and news about your team: Add the Live.com Football Page
> www.live.com/?addtemplate=football&icid=T001MSN30A0701

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Copying back to the list...

Actually, I'd suggest doing a PHP-side grouping.  See this article for 
details:

http://www.garfieldtech.com/blog/php-group-by

On Saturday 13 January 2007 10:50 pm, nitrox . wrote:
> I hope this is returning to the mail list so all can read.
> Thanks for the reply Larry, i appreciate your time spent to reply to me. If
> i print the way your showing it prints for every instance. Im trying to
> create a team roster like the following url shows:
> http://www.chalkthree.com/exampleroster.html
>
> I have 3 tables in my db, league table, lookup table and member table. Do
> you think it would be better possably to do seperate querys and then match
> them in php? would that be possable the given the setup i have?
>
> >From: Larry Garfield <[EMAIL PROTECTED]>
> >To: [email protected]
> >Subject: Re: [PHP] multidimensional array problems
> >Date: Sat, 13 Jan 2007 21:51:08 -0600
> >
> >It's better to just leave the record as an array and read it that way.
> >
> >while ($row = mysql_fetch_assoc($result)) {
> >print "<tr><td>{$row['game']}</td> <td>{$row['type']}</td></tr>\n";
> >}
> >
> >And so on.  You're not actually dealing with a multi-dimensional array
> > yet; $result is an object from which you are extracting data records as
> > one-dimensional associative arrays.
> >
> >On Saturday 13 January 2007 7:40 pm, nitrox doe wrote:
> > > hi all,
> > > im very new to php but i think i jumped on the
> > > toughest thing to learn. Im trying to create a
> > > team roster that will show game, game type
> > > and league and then show each member based
> > > on the game type. Ive worked out alot of code
> > > but just cant figure where im going wrong. so
> > > here is my code. Any pointers would be greatly
> > > appreciated.
> > >
> > > this is an example of what im trying to do
> > > http://www.chalkthree.com/exampleroster.html
> > >
> > > php code
> > > <?php
> > > //begin member league table
> > > $memroster = "SELECT inf_league.game, inf_league.type,
> > > inf_member.user_name, inf_member.rank, " .
> > >              "inf_member.country, inf_member.email " .
> > >              "FROM inf_league " .
> > >              "INNER JOIN inf_memberleague ON inf_league.gid =
> > > inf_memberleague.l_id " .
> > >              "INNER JOIN inf_member ON inf_member.user_id =
> > > inf_memberleague.m_id";
> > > $memrosterresults = mysql_query($memroster)
> > >   or die(mysql_error());
> > >   while ($row = mysql_fetch_array($memrosterresults)) {
> > >
> > > foreach ($row as $game => $type) {
> > > echo "<p>";
> > > echo "$type";
> > >   foreach ($row as $type => $user_name) {
> > > echo "$user_name" . " - " . "$rank" . " - " . "$country" . " - " .
> > > "$email"; }
> > > print '</p>';
> > > }
> > > }
> > > //end member league table
> > > ?>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > mysql
> > >
> > >
> > > CREATE TABLE `inf_league` (  `gid` int(11) NOT NULL auto_increment,
> >
> >`game`
> >
> > > varchar(255) NOT NULL,  `type` varchar(255) NOT NULL,  `league`
> > > varchar(255) NOT NULL,  `season` varchar(255) NOT NULL,  PRIMARY KEY
> > > (`gid`))
> > > TYPE=MyISAM  AUTO_INCREMENT=4 ;-- -- Dumping data for table
> >
> >`inf_league`--
> >
> > > INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`)
> >
> >VALUES
> >
> > > (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO
> >
> >`inf_league`
> >
> > > (`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF',
> > > 'TWL', '2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`,
> > > `league`, `season`) VALUES (3, 'CoD2', 'Search & Destroy', 'CAL', '2006
> >
> >4th
> >
> > > QTR');-- ---------------------------------------------------------- --
> > > Table structure for table
> > > `inf_member`-- CREATE TABLE `inf_member` (  `user_id` int(11) NOT NULL
> > > auto_increment,  `user_level` int(2) NOT NULL default '0', 
> > > `list_order` int(3) NOT NULL default '0',  `user_name` varchar(100) NOT
> > > NULL default
> >
> >'',
> >
> > > `password` varchar(25) NOT NULL default '',  `email` varchar(100) NOT
> >
> >NULL
> >
> > > default '',  `country` text NOT NULL,  `game` text,  `rank` varchar(40)
> > > default NULL,  `qoute` longtext,  `config` int(1) default '0',  `map`
> > > varchar(100) default '',  `gun` varchar(100) default '',  `brand`
> > > varchar(100) default '',  `cpu` varchar(20) default '',  `ram`
> >
> >varchar(20)
> >
> > > default '',  `video` varchar(100) default '',  `sound` varchar(100)
> >
> >default
> >
> > > '',  `monitor` varchar(100) default '',  `mouse` varchar(100) default
> >
> >'',
> >
> > > PRIMARY KEY  (`user_id`)) TYPE=MyISAM  AUTO_INCREMENT=3 ;--
> > > -- Dumping data for table `inf_member`-- INSERT INTO `inf_member`
> > > (`user_id`, `user_level`, `list_order`, `user_name`, `password`,
> >
> >`email`,
> >
> > > `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`,
> >
> >`cpu`,
> >
> > > `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox',
> > > 'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 'Founder', NULL, 0,
> >
> >NULL,
> >
> > > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO
> > > `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`,
> > > `password`,
> >
> >`email`,
> >
> > > `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`,
> >
> >`cpu`,
> >
> > > `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 1, 'raze',
> > > 'itsme', '[EMAIL PROTECTED]', 'United States', NULL, 'Leader', NULL, 0,
> >
> >'',
> >
> > > '', '', '', '', '', '', '', '');--
> > > ---------------------------------------------------------- -- Table
> > > structure for table
> > > `inf_memberleague`-- CREATE TABLE `inf_memberleague` (  `l_id` int(4)
> >
> >NOT
> >
> > > NULL,  `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for table
> > > `inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, `m_id`)
> >
> >VALUES
> >
> > > (1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1,
> >
> >1);INSERT
> >
> > > INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 1);INSERT INTO
> > > `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 2);
> > >
> > > _________________________________________________________________
> > > Get live scores and news about your team: Add the Live.com Football
> > > Page www.live.com/?addtemplate=football&icid=T001MSN30A0701
> >
> >--
> >Larry Garfield                       AIM: LOLG42
> >[EMAIL PROTECTED]            ICQ: 6817012
> >
> >"If nature has made any one thing less susceptible than all others of
> >exclusive property, it is the action of the thinking power called an idea,
> >which an individual may exclusively possess as long as he keeps it to
> >himself; but the moment it is divulged, it forces itself into the
> >possession
> >of every one, and the receiver cannot dispossess himself of it."  --
> > Thomas Jefferson
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
> _________________________________________________________________
> From photos to predictions, The MSN Entertainment Guide to Golden Globes
> has it all. http://tv.msn.com/tv/globes2007/?icid=nctagline1

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Give this a go

<?php
//begin member league table
$memroster = "SELECT inf_league.game, inf_league.type, inf_member.user_name, inf_member.rank, " .
            "inf_member.country, inf_member.email " .
            "FROM inf_league " .
"INNER JOIN inf_memberleague ON inf_league.gid = inf_memberleague.l_id " . "INNER JOIN inf_member ON inf_member.user_id = inf_memberleague.m_id";
$memrosterresults = mysql_query($memroster) or die(mysql_error());

$currentType = FALSE;
echo "<p>\n";
while ( $row = mysql_fetch_assoc($memrosterresults) ) {
   if ( $row['type'] != $currentType ) {
       if ( $currentType !== FALSE ) {
           echo "</p>\n";
           echo "<p>\n";
       }
       echo "    <h3>{$row['type']}</h3>\n";
       $currentType = $row['type'];
   }
echo "{$row['user_name']} - {$row['rank']} - {$row['country']} - {$row['email']}<br />\n";
}
echo "</p>\n";
//end member league table
?>

This is untested, but it should give you the results you are looking for.

Jim Lucas

nitrox doe wrote:
hi all,
im very new to php but i think i jumped on the
toughest thing to learn. Im trying to create a
team roster that will show game, game type
and league and then show each member based
on the game type. Ive worked out alot of code
but just cant figure where im going wrong. so
here is my code. Any pointers would be greatly
appreciated.

this is an example of what im trying to do
http://www.chalkthree.com/exampleroster.html

php code
<?php
//begin member league table
$memroster = "SELECT inf_league.game, inf_league.type, inf_member.user_name, inf_member.rank, " .
            "inf_member.country, inf_member.email " .
            "FROM inf_league " .
"INNER JOIN inf_memberleague ON inf_league.gid = inf_memberleague.l_id " . "INNER JOIN inf_member ON inf_member.user_id = inf_memberleague.m_id";
$memrosterresults = mysql_query($memroster)
 or die(mysql_error());
 while ($row = mysql_fetch_array($memrosterresults)) {

foreach ($row as $game => $type) {
echo "<p>";
echo "$type";
 foreach ($row as $type => $user_name) {
echo "$user_name" . " - " . "$rank" . " - " . "$country" . " - " . "$email"; }
print '</p>';
}
}
//end member league table
?>








mysql


CREATE TABLE `inf_league` ( `gid` int(11) NOT NULL auto_increment, `game` varchar(255) NOT NULL, `type` varchar(255) NOT NULL, `league` varchar(255) NOT NULL, `season` varchar(255) NOT NULL, PRIMARY KEY (`gid`)) TYPE=MyISAM AUTO_INCREMENT=4 ;-- -- Dumping data for table `inf_league`-- INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF', 'TWL', '2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (3, 'CoD2', 'Search & Destroy', 'CAL', '2006 4th QTR');-- ---------------------------------------------------------- -- Table structure for table `inf_member`-- CREATE TABLE `inf_member` ( `user_id` int(11) NOT NULL auto_increment, `user_level` int(2) NOT NULL default '0', `list_order` int(3) NOT NULL default '0', `user_name` varchar(100) NOT NULL default '', `password` varchar(25) NOT NULL default '', `email` varchar(100) NOT NULL default '', `country` text NOT NULL, `game` text, `rank` varchar(40) default NULL, `qoute` longtext, `config` int(1) default '0', `map` varchar(100) default '', `gun` varchar(100) default '', `brand` varchar(100) default '', `cpu` varchar(20) default '', `ram` varchar(20) default '', `video` varchar(100) default '', `sound` varchar(100) default '', `monitor` varchar(100) default '', `mouse` varchar(100) default '', PRIMARY KEY (`user_id`)) TYPE=MyISAM AUTO_INCREMENT=3 ;-- -- Dumping data for table `inf_member`-- INSERT INTO `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox', 'test', '[EMAIL PROTECTED]', 'United States', 'CoD2', 'Founder', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 1, 'raze', 'itsme', '[EMAIL PROTECTED]', 'United States', NULL, 'Leader', NULL, 0, '', '', '', '', '', '', '', '', '');-- ---------------------------------------------------------- -- Table structure for table `inf_memberleague`-- CREATE TABLE `inf_memberleague` ( `l_id` int(4) NOT NULL, `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for table `inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 1);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 1);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 2);

_________________________________________________________________
Get live scores and news about your team: Add the Live.com Football Page www.live.com/?addtemplate=football&icid=T001MSN30A0701


--- End Message ---
--- Begin Message --- I'm collecting data from a form and using it to write to a flat file like so:
Quote:
//this removes line breaks in an text field box and substitutes double breaks
$postbody = str_replace("\r\n", "<br/><br/>",$postbody);
$thepost = "$postitle | $postdate | $postbody | $author \r\n";
if ($posttype=="add") {
// the r+ flag reads and writes at the top of the file, "a" writes at the bottom
$file = fopen("../includes/news.txt", 'r+');
fwrite ($file, "$thepost\r\n");
fclose($file);
}
else { }
I can write to the bottom of the file, no problem, but if I want to put new entries at the top of the file I have problems:
the previous entry is partially overwritten and mangled..
like so: (this is the top line from the text file

Site Redesign | Jan 9, 07, 9:31 am | The site has a new look...etc

becomes

new look!...etc

a 20 character post overwrites 22
a 50 character post overwrites 62
61 character post overwrites 64
260 character post overwrites 260 characters.. it seems to be random, somewhat...
any ideas?


--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-13 17:32:00 -0500:
> I can write to the bottom of the file, no problem, but if I want to  
> put new entries at the top of the file I have problems:
> the previous entry is partially overwritten and mangled..
 
you cannot prepend to a file. to do that you need to create a new
file, write the new data in it, and append data from the old file.

class newLiner extends IteratorIterator
{
    function current()
    {
        return $this->getInnerIterator()->current() . "\n";
    }
}

$lines = array('line 1', 'line 2', 'line 3');
$data = new newLiner(new ArrayObject($lines));
$file = new SPLFileObject('file', 'r');
$temp = new SPLFileObject('temp', 'w');

$all = new AppendIterator;
$all->append($data);
$all->append($file);

foreach ($all as $line) {
    $temp->fwrite($line);
}

$file->fflush();
$temp->fflush();
unset($file); unset($temp);

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
At 8:05 PM +0200 1/13/07, Dotan Cohen wrote:


Hehehe... Good thing that I didn't post a picture of Gush:
http://dotancohen.com/gallery/img-122.html


I presume Gush is an advanced computer mouse?

     -----===== Bill =====-----

--

Jury: a panel of 12 men and women selected
to decide who has the better lawyer.

--- End Message ---
--- Begin Message ---
On 14/01/07, Bill Guion <[EMAIL PROTECTED]> wrote:
At 8:05 PM +0200 1/13/07, Dotan Cohen wrote:

>
>Hehehe... Good thing that I didn't post a picture of Gush:
>http://dotancohen.com/gallery/img-122.html
>

I presume Gush is an advanced computer mouse?

      -----===== Bill =====-----


First wireless model available!

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/464/stone_temple_pilots.html
http://easy-answers.org

--- End Message ---
--- Begin Message ---
On 1/14/07, Jürgen Wind <[EMAIL PROTECTED]> wrote:
Gert Cuykens wrote:
>
> It's a web based sql console that you can use instead of phpmyadmin.
>
nice idea,
but i got lots of js errors (i.e. resulting from an orphaned colon in almost
every .js file)
i tried db5c28.tar.bz2 from sf.net

it doesnt work in ie because of xmlhttprequest (ajax) please try
firefox 2 and it will work perfectly without any errors. Everything is
w3c validated.

IE uses activex instead of xmlhttprequest. First i would like to make
db5 stable for firefox2 and then IE.

--- End Message ---
--- Begin Message ---


Gert Cuykens wrote:
> 
> On 1/14/07, Jürgen Wind <[EMAIL PROTECTED]> wrote:
>> Gert Cuykens wrote:
>> >
>> > It's a web based sql console that you can use instead of phpmyadmin.
>> >
>> nice idea,
>> but i got lots of js errors (i.e. resulting from an orphaned colon in
>> almost
>> every .js file)
>> i tried db5c28.tar.bz2 from sf.net
> 
> it doesnt work in ie because of xmlhttprequest (ajax) please try
> firefox 2 and it will work perfectly without any errors. Everything is
> w3c validated.
> 
> IE uses activex instead of xmlhttprequest. First i would like to make
> db5 stable for firefox2 and then IE.
> 
> 
I never use IE.
The errors trigger the error console in FF2 and Opera as well.

here are the last lines from edit.js for example:

  server.send('function',false,f,'sha1='+v)
  window.close()
 },  //<-- offending colon

}

-- 
View this message in context: 
http://www.nabble.com/Anyone-would-like-to-test-my-open-source-application-http%3A--sourceforge.net-projects-dfo----tf2971271.html#a8327318
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
On 1/14/07, Jürgen Wind <[EMAIL PROTECTED]> wrote:
Gert Cuykens wrote:
>
> On 1/14/07, Jürgen Wind <[EMAIL PROTECTED]> wrote:
>> Gert Cuykens wrote:
>> >
>> > It's a web based sql console that you can use instead of phpmyadmin.
>> >
>> nice idea,
>> but i got lots of js errors (i.e. resulting from an orphaned colon in
>> almost
>> every .js file)
>> i tried db5c28.tar.bz2 from sf.net
>
> it doesnt work in ie because of xmlhttprequest (ajax) please try
> firefox 2 and it will work perfectly without any errors. Everything is
> w3c validated.
>
> IE uses activex instead of xmlhttprequest. First i would like to make
> db5 stable for firefox2 and then IE.
>
>
I never use IE.
The errors trigger the error console in FF2 and Opera as well.

here are the last lines from edit.js for example:

  server.send('function',false,f,'sha1='+v)
  window.close()
 },  //<-- offending colon

}

ah ok i am sorry, you can just remove the , (the offending colon)
somehow my ff2 setup on ubuntu doesnt make a fuss about it not even a
warning ? I only put it there to make my json code look nicer lol :)

I will change all }, } into } } in next release. Thanks anything else ?

--- End Message ---
--- Begin Message ---
Hi,

Anyone know how I can strip slashes from $_POST variables. I have tried
about a hundred different ways of doing this and nothing works.

i.e.

if(!empty($_POST)){
foreach($_POST as $x => $y){
$_POST[$x] = stripslashes($y);
}
}

This came about after someone tried to enter O'Toole in a form, and it
appeared as O\'Toole.

Thanks

--- End Message ---
--- Begin Message ---
Beauford wrote:
Hi,

Anyone know how I can strip slashes from $_POST variables. I have tried
about a hundred different ways of doing this and nothing works.

i.e.

if(!empty($_POST)){
foreach($_POST as $x => $y){
$_POST[$x] = stripslashes($y);
}
}

This came about after someone tried to enter O'Toole in a form, and it
appeared as O\'Toole.

Thanks

This is what I use, and it has worked ever time.

if ( get_magic_quotes_gpc() ) {
 $_POST = array_map("stripslashes", $_POST);
}

Jim Lucas

--- End Message ---
--- Begin Message ---
On Sunday 14 January 2007 12:01 am, Jim Lucas wrote:

> This is what I use, and it has worked ever time.
>
> if ( get_magic_quotes_gpc() ) {
>   $_POST = array_map("stripslashes", $_POST);
> }
>
> Jim Lucas

That will break as soon as you submit an array back through a POST request, 
which I do rather often. :-)  You need to iterate over the array, and if an 
item is an array, iterate over it recursively.  array_walk() can be useful 
here.

Of course, the real answer is to disable magic quotes in the first place as 
they are spawn of Satan.  If you're using a web host that doesn't let you do 
so, get a real web host.  

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Larry Garfield wrote:
On Sunday 14 January 2007 12:01 am, Jim Lucas wrote:

This is what I use, and it has worked ever time.

if ( get_magic_quotes_gpc() ) {
  $_POST = array_map("stripslashes", $_POST);
}

Jim Lucas

That will break as soon as you submit an array back through a POST request, which I do rather often. :-) You need to iterate over the array, and if an item is an array, iterate over it recursively. array_walk() can be useful here.

Of course, the real answer is to disable magic quotes in the first place as they are spawn of Satan. If you're using a web host that doesn't let you do so, get a real web host.
Had to think about that one and test, but you are right.
Up until this point, I have not had a project that I had to submit arrays via POST. Just happens that next week, I would have started my first project that does require me to submit via POST with arrays and I would have found it then, but anyways, it is fixed now.

on my dev server I have PHP 4.3.11 so I had to build my own work around for array_walk_recursive, since it is only in PHP5 and newer :(

I am pretty sure that it does what the function does in PHP5

Try this

<plaintext><?PHP
//stripslashes test

function array_walk_recursive(&$a, $b, $c=null) {
   foreach ( $a AS $k => $v ) {
       if ( is_array($v) ) {
           array_walk_recursive($v, $b, $c);
           $a[$k] = $v;
       } else {
           $a[$k] = $b($v, $k, $c);
       }
   }
   return true;
}

function my_stripslashes($a, $b, $c='') {
   return stripslashes($a);
}

$data[] = addslashes("Jim's new list");
$data[] = addslashes("Tom's new list");
$data[] = array(addslashes("bill's"), addslashes("Tracy's"));

var_dump($data);

array_walk_recursive($data, "my_stripslashes");

var_dump($data);

?>


Jim Lucas

--- End Message ---
--- Begin Message ---
That book is so cool! =P

Anyways, it said that browsers with Javascript, but not a recent
enough Javascript would not display the Noscript.

On 1/13/07, tedd <[EMAIL PROTECTED]> wrote:
At 9:32 PM -0800 1/11/07, Jürgen Wind wrote:
>tedd wrote:
>>index.php, jstest110.php) , make it one.
>ok
>---8<---
>>It would be cool if I could send js value via a
>>POST instead of GET-- can that be done?
>have a look http://149.222.235.16/jstest/70112/index.php ( POST version )
>
>>tedd
>
>>PS: I read somewhere that using <noscript> is not recommended.
>any info?

Yes, I knew I read it somewhere (my memory is not as good as it used to be).

In the book "PPK on Javascript" (most excellent
book btw http://www.quirksmode.org/book/), on
page 57 he says "Therefore, it's best not to use
the <noscript> tag at all."

I leave it to you to buy the book to find out
why. But basically, browsers that don't use
javascript don't see that tag and those that do,
don't use it. As such, the tag has no real use.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



--- End Message ---
--- Begin Message ---
I am not sure about this but the requirement is that even the links
associated with the image changes with the image. Like an image of
restaurant links to restaurants page and image for pubs links to pubs page.
Is this achievable through this code. I could not test it coz it was not
working. Can you help!!!

Thanks,


Jochem Maas wrote:
> 
> Chris Carter wrote:
>> Hi,
>> 
>> I have used this file in my index file. When I run this file separately
>> it
>> shows the random image but not when I include on my index.php.
> 
> your image script shouldn't be included in your [index] page.
> instead it should be referenced by the src attribute of an img
> tag that your [index] page outputs e.g. in your [index] page
> have a line something like:
> 
> echo ' /randomimage.php ';
> 
>> 
>> Thanks in advance,
>> 
>> 
>> João Cândido de Souza Neto wrote:
>>> Is it the whole code of your file, or is there any other html code?
>>>
>>> "Chris Carter" <[EMAIL PROTECTED]> escreveu na mensagem 
>>> news:[EMAIL PROTECTED]
>>>> Hi,
>>>>
>>>> Here is code that I got from the internet for random image. This file 
>>>> works
>>>> perfect if I try it independently but not on any existing file. I think 
>>>> the
>>>> error that I am getting is quite common on the net but its new for me.
>>>>
>>>> I am getting this error:
>>>>
>>>> Warning: Cannot modify header information - headers already sent by 
>>>> (output
>>>> started at /folder/test.php:12) in /folder/randomimage.php on line 19
>>>>
>>>> the code that I got from net:
>>>>
>>>> <?
>>>> $folder = 'images/';
>>>> $exts = 'jpg jpeg png gif';
>>>> $files = array(); $i = -1;
>>>> if ('' == $folder) $folder = './';
>>>> $handle = opendir($folder);
>>>> $exts = explode(' ', $exts);
>>>> while (false !== ($file = readdir($handle))) {
>>>>    foreach($exts as $ext) {
>>>>        if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
>>>>            $files[] = $file;
>>>>            ++$i;
>>>>            }
>>>>        }
>>>>    }
>>>> closedir($handle);
>>>> mt_srand((double)microtime()*1000000);
>>>> $rand = mt_rand(0, $i);
>>>>
>>>>
>>>> Line 19 is below:
>>>>
>>>> header('Location: '.$folder.$files[$rand]);
>>>> ?>
>>>>
>>>> Thanks a bunch.
>>>> Chris
>>>> -- 
>>>> View this message in context: 
>>>> http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8316202
>>>> Sent from the PHP - General mailing list archive at Nabble.com. 
>>> -- 
>>> 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
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Include-file-error%2C-common-one-I-think-tf2971907.html#a8331510
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-13 18:59:10 -0800:
>  },  //<-- offending colon

# [EMAIL PROTECTED] / 2007-01-14 04:49:10 +0100:
> ah ok i am sorry, you can just remove the , (the offending colon)

Guyes, what were you doing during your biology classes? ;)

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-13 18:59:10 -0800:
>>  },  //<-- offending colon
> 
> # [EMAIL PROTECTED] / 2007-01-14 04:49:10 +0100:
>> ah ok i am sorry, you can just remove the , (the offending colon)
> 
> Guyes, what were you doing during your biology classes? ;)

LOL @ biology.... very good :)

I suppose you could call it a semi-semi-colon?

Col.

--- End Message ---

Reply via email to