How is this possible?
am 28.07.2003 00:38:56 von Ryan A
Hi,
I am trying to get my data into a very similar layout as this:
http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=54 6&IntVal3=605
see the table with the plans...how is he getting that in one table? what
kind of logic is that? the best I can do is for each column I have to use
another table (nested tables) but he has somehow managed to get all in
one... is this a special ASP thing?
This is my implemption of it:
http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
%5D=5&id%5B%5D=13&type=1
Its much slower, because it uses more tables and nested tables...but its in
php :-)
I just cant understand it...any ideas?
Cheers,
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 00:44:31 von Robert Cummings
ASP merely outputs HTML. His table is basic HTML dynamically rendered
perhaps by an ASP component. This is also trivial to do in PHP.
Cheers,
Rob.
On Sun, 2003-07-27 at 18:38, Ryan A wrote:
> Hi,
> I am trying to get my data into a very similar layout as this:
> http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=54 6&IntVal3=605
> see the table with the plans...how is he getting that in one table? what
> kind of logic is that? the best I can do is for each column I have to use
> another table (nested tables) but he has somehow managed to get all in
> one... is this a special ASP thing?
>
> This is my implemption of it:
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1
>
> Its much slower, because it uses more tables and nested tables...but its in
> php :-)
>
>
> I just cant understand it...any ideas?
>
> Cheers,
> -Ryan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
..---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 00:57:15 von Curt Zirzow
* Thus wrote Ryan A (ryan@jumac.com):
> Hi,
> I am trying to get my data into a very similar layout as this:
> http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=54 6&IntVal3=605
> see the table with the plans...how is he getting that in one table? what
> kind of logic is that? the best I can do is for each column I have to use
> another table (nested tables) but he has somehow managed to get all in
> one... is this a special ASP thing?
Nothing special html wise.
>
> This is my implemption of it:
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1
I get an notice and and error when I go there:
Notice: Undefined variable: p5 in
/home/bestweb/public_html/compare.php on line 65
Query failed, ryan queryYou have an error in your SQL syntax. Check
the manual that corresponds to your MySQL server version for the
right syntax to use near 'order by plan_id' at line 1
>
> I just cant understand it...any ideas?
There are different ways you can do this it could help to know what
kind of data structure you have.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 01:09:34 von Ryan A
Hi,
Thanks for replying.
You say: Nothing special html wise.
then can you tell me how its done?
The content is dynamic being pulled from the database..how do i get it in
one table in that layout?
> There are different ways you can do this it could help to know what
> kind of data structure you have.
Heres the link again, you can see the datastructure (hopefully)
http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
%5D=5&id%5B%5D=13&type=1
Kindly reply,
-Ryan
> * Thus wrote Ryan A (ryan@jumac.com):
> > Hi,
> > I am trying to get my data into a very similar layout as this:
> >
http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=54 6&IntVal3=605
> > see the table with the plans...how is he getting that in one table? what
> > kind of logic is that? the best I can do is for each column I have to
use
> > another table (nested tables) but he has somehow managed to get all in
> > one... is this a special ASP thing?
>
> Nothing special html wise.
>
> >
> > This is my implemption of it:
> >
http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
> > %5D=5&id%5B%5D=13&type=1
> I get an notice and and error when I go there:
> Notice: Undefined variable: p5 in
> /home/bestweb/public_html/compare.php on line 65
>
> Query failed, ryan queryYou have an error in your SQL syntax. Check
> the manual that corresponds to your MySQL server version for the
> right syntax to use near 'order by plan_id' at line 1
>
> >
> > I just cant understand it...any ideas?
>
> There are different ways you can do this it could help to know what
> kind of data structure you have.
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 01:54:02 von Curt Zirzow
* Thus wrote Ryan A (ryan@jumac.com):
> Hi,
> Thanks for replying.
>
> You say: Nothing special html wise.
> then can you tell me how its done?
>
> The content is dynamic being pulled from the database..how do i get it in
> one table in that layout?
>
> > There are different ways you can do this it could help to know what
> > kind of data structure you have.
>
> Heres the link again, you can see the datastructure (hopefully)
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1
I had to add a &p5=1 to the thing to make it work.
What I was wondering about structure was do you have the data set
up with a many to many relationship? or is it just one big table
where you have all the attributes set for the one company?
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 02:25:15 von skate
> You say: Nothing special html wise.
> then can you tell me how its done?
there's some nice simple CSS behind it to give the nice border and colour
changes, but yes, nothing special HTML wise. it's a simple table
>
> The content is dynamic being pulled from the database..how do i get it in
> one table in that layout?
the best way is gonna be to put all your db content into an array and then
sort through it from there. if you use an associative array, you can put
each table row together...
display[setupfee][] = $result[0][0];
display[setupfee][] = $result[0][1];
display[monthlyfee][] = $result[1][0];
display[monthlyfee][] = $result[1][1];
.... and so on.
not sure if i'm explaining this very well, or with the greatest syntax, but
hopefully you get the idea...
-skate-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 03:25:30 von skate
> Hi,
> Thanks for replying.
no probs...
>
> I have not worked with arrays much other than simple arrays like the $_get
> or $_post and the database ones...can you give me a another emample on how
> to do this please?
> like how to put my db into an array and then call each part....
>
sorry, i'm probably not the best person to give a full working example. my
code works for me, but it's a little sloppy. check the php manual. look-up
associative arrays.
lets see if i can't give you a quick example tho...
$n = 0;
$result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY date
DESC" );
while ($rows = mysql_fetch_array($result)) {
if( $rows == "" ){
continue;
}
extract( $rows ); ///extract our result into variables named after our
fields
$content[id][$n] = $id;
$content[title][$n] = $title;
$content[text][$n] = $text;
$content[date][$n] = $date;
$n++; //increment our number for next time...
}
//this next bit is sloppy coz i'm just gonna make it up for an example
print "
"
for( $c=0; $c<4; $c++ ) //4 coz there's 4 key fields
{
//print the id's
print "";
print "ID | ";
for( $i=0; $i<$n; $i++ )
print "".$content[id][$i]." | ";
print "
";
//print the titles
print "";
print "TITLE | ";
for( $i=0; $i<$n; $i++ )
print "".$content[title][$i]." | ";
print "
";
//print the text
print "";
print "TEXT | ";
for( $i=0; $i<$n; $i++ )
print "".$content[text][$i]." | ";
print "
";
//print the date
print "";
print "DATE | ";
for( $i=0; $i<$n; $i++ )
print "".$content[date][$i]." | ";
print "
";
}
print "
";
?>
like i said, this isn't the most glamorous way of doing it, and you really
should look this all up in the manual before trying it out. but if you run
this code (and you have a db to back it up) you should get a table with the
format i think your after...
>
> Thanks,
> -Ryan
>
no probs, hope my sloppy code helps you a little ;)
-skate-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 03:33:35 von Ryan A
Hey,
Thanks again.
It should take me around an hour or two just to figure out what you
wrote...:-D
I guess i have to hit the manual quite a bit.
Thanks,
-Ryan
> > Hi,
> > Thanks for replying.
>
> no probs...
>
> >
> > I have not worked with arrays much other than simple arrays like the
$_get
> > or $_post and the database ones...can you give me a another emample on
how
> > to do this please?
> > like how to put my db into an array and then call each part....
> >
>
> sorry, i'm probably not the best person to give a full working example. my
> code works for me, but it's a little sloppy. check the php manual. look-up
> associative arrays.
>
> lets see if i can't give you a quick example tho...
>
>
>
> $n = 0;
> $result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY
date
> DESC" );
> while ($rows = mysql_fetch_array($result)) {
> if( $rows == "" ){
> continue;
> }
> extract( $rows ); ///extract our result into variables named after our
> fields
> $content[id][$n] = $id;
> $content[title][$n] = $title;
> $content[text][$n] = $text;
> $content[date][$n] = $date;
> $n++; //increment our number for next time...
> }
>
> //this next bit is sloppy coz i'm just gonna make it up for an example
>
> print "
"
> for( $c=0; $c<4; $c++ ) //4 coz there's 4 key fields
> {
> //print the id's
> print "";
> print "ID | ";
> for( $i=0; $i<$n; $i++ )
> print "".$content[id][$i]." | ";
> print "
";
> //print the titles
> print "";
> print "TITLE | ";
> for( $i=0; $i<$n; $i++ )
> print "".$content[title][$i]." | ";
> print "
";
> //print the text
> print "";
> print "TEXT | ";
> for( $i=0; $i<$n; $i++ )
> print "".$content[text][$i]." | ";
> print "
";
> //print the date
> print "";
> print "DATE | ";
> for( $i=0; $i<$n; $i++ )
> print "".$content[date][$i]." | ";
> print "
";
> }
> print "
";
>
> ?>
>
> like i said, this isn't the most glamorous way of doing it, and you really
> should look this all up in the manual before trying it out. but if you run
> this code (and you have a db to back it up) you should get a table with
the
> format i think your after...
>
>
> >
> > Thanks,
> > -Ryan
> >
>
> no probs, hope my sloppy code helps you a little ;)
>
> -skate-
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.07.2003 04:05:29 von Curt Zirzow
* Thus wrote Ryan A (ryan@jumac.com):
> Hi,
> Thanks for replying.
>
> You say: Nothing special html wise.
> then can you tell me how its done?
The basic logic is like this:
foreach option_of_hosting_service
name_of_service |
foreach hosting_company_service
hosting_value_of_service |
Now how you fetch your data is where it gets a little tricky. I
can't really help you there cause I'm not sure how you store the
data for the hosting services.
HTH at least a little.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 29.07.2003 03:20:05 von Simon Fredriksson
Ryan A wrote:
> Hi,
> I am trying to get my data into a very similar layout as this:
> http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=54 6&IntVal3=605
> see the table with the plans...how is he getting that in one table? what
> kind of logic is that? the best I can do is for each column I have to use
> another table (nested tables) but he has somehow managed to get all in
> one... is this a special ASP thing?
>
> This is my implemption of it:
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1
>
> Its much slower, because it uses more tables and nested tables...but its in
> php :-)
>
>
> I just cant understand it...any ideas?
>
> Cheers,
> -Ryan
>
That's acutally a quite easy procedure if your table is structured
correctly. My suggestion is that you simply make the SQL table like you
the HTML table look.
Columns:
title : lp1 : lp2 : lp3......
Values:
ssh : 1 : 1 : 1
php : 1 : 1 : 0
ssi : 1 : 0 : 0
Just structure the table like that. It's not the wisest thing to do if
you're gonna have loads of columns, but it's an easy solution.
//Laban
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 29.07.2003 04:11:57 von Simon Fredriksson
Just solved your problem and made a better solution for my previous answer.
The code is available at http://mirror27.sytes.net/~webhost/
//Simon
Ryan A wrote:
> Hi,
> I am trying to get my data into a very similar layout as this:
> http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=54 6&IntVal3=605
> see the table with the plans...how is he getting that in one table? what
> kind of logic is that? the best I can do is for each column I have to use
> another table (nested tables) but he has somehow managed to get all in
> one... is this a special ASP thing?
>
> This is my implemption of it:
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2& id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1
>
> Its much slower, because it uses more tables and nested tables...but its in
> php :-)
>
>
> I just cant understand it...any ideas?
>
> Cheers,
> -Ryan
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.10.2009 18:29:39 von David Otton
2009/10/28 tedd :
>
> Hi gang:
>
http://php.net/manual/en/security.globals.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.10.2009 18:43:03 von Adam Randall
I don't do this personally, but you can probably get your script
working by doing something like this:
foreach( $_GET as $k => $v ) $$k = $v;
You would put that at the top of your page, but be aware that it
allows other people to set variables on your page (just like register
globals does).
If you want to do basic sanitization to your incoming values, such as
trimming them, you can do something like this too:
foreach( $_GET as $k => $v ) $$k = trim( $v );
None of this is best practices, FYI.
Adam.
On Wed, Oct 28, 2009 at 10:29 AM, David Otton
wrote:
> 2009/10/28 tedd :
>>
>> Hi gang:
>>
>
> http://php.net/manual/en/security.globals.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Adam Randall
http://www.xaren.net
AIM: blitz574
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.10.2009 18:47:14 von Andrew Ballard
On Wed, Oct 28, 2009 at 1:27 PM, tedd wrote:
> Hi gang:
>
> I am reviewing some old code (circa 2003) where the programmer had one
> script call another and placed variable values in the URL, like so:
>
> Â Â
>
> That seems innocent enough. However, in the called script (i.e.,
> "user_edit.php") there are no:
>
> Â Â $user_id =3D $_GET['user_id'];
> Â Â $action =3D $_GET['action'];
>
> statements to populate the variables, yet the variables get populated wit=
h
> the values sent!?!
>
> How did he do that?
>
> Incidentally, he did have in the .htaccess file the statement:
>
> Â php_flag register_globals 1
>
> So I figure that Globals have something to do with it, but I never use
> Globals. And if I print_r $GLOBALS, I find that user_id and action are
> listed (many times), but I don't see how that works.
>
> Furthermore, something got changed and the entire script no longer works.=
So
> I'm in a quandary to figure this out -- any ideas, suggestions, reference=
s?
>
> Thanks,
>
> tedd
>
That's exactly what register_globals does. It's analogous to
prepending your scripts with this:
extract($_GET);
extract($_POST);
extract($_COOKIE);
extract($_SESSION);
?>
(The order would be determined by the ini directive variables_order)
Andrew
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible?
am 28.10.2009 18:48:51 von Ashley Sheridan
--=-fMMJmpVcIhKWb9D2av16
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Wed, 2009-10-28 at 13:47 -0400, Andrew Ballard wrote:
> On Wed, Oct 28, 2009 at 1:27 PM, tedd wrote:
> > Hi gang:
> >
> > I am reviewing some old code (circa 2003) where the programmer had one
> > script call another and placed variable values in the URL, like so:
> >
> >
> >
> > That seems innocent enough. However, in the called script (i.e.,
> > "user_edit.php") there are no:
> >
> > $user_id = $_GET['user_id'];
> > $action = $_GET['action'];
> >
> > statements to populate the variables, yet the variables get populated with
> > the values sent!?!
> >
> > How did he do that?
> >
> > Incidentally, he did have in the .htaccess file the statement:
> >
> > php_flag register_globals 1
> >
> > So I figure that Globals have something to do with it, but I never use
> > Globals. And if I print_r $GLOBALS, I find that user_id and action are
> > listed (many times), but I don't see how that works.
> >
> > Furthermore, something got changed and the entire script no longer works. So
> > I'm in a quandary to figure this out -- any ideas, suggestions, references?
> >
> > Thanks,
> >
> > tedd
> >
>
> That's exactly what register_globals does. It's analogous to
> prepending your scripts with this:
>
>
>
> extract($_GET);
> extract($_POST);
> extract($_COOKIE);
> extract($_SESSION);
>
> ?>
>
> (The order would be determined by the ini directive variables_order)
>
> Andrew
>
Register globals is evil; somewhere between M$ and the chocolate that
are always left over in the Xmas tin that nobody likes. Best bet is to
try and steer the system away from it's dependency on this old
directive.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-fMMJmpVcIhKWb9D2av16--
Re: How is this possible? [Solved]
am 28.10.2009 19:35:32 von TedD
To all:
I found the problem, which basically was that I had declared a
variable in a preceding script with the same name, namely $user_id.
When I changed my script to $u_id, everything worked as before.
Clearly, Globals are evil.
It's a bitch to have to work with code you can't change unless you
are willing to edit over 1500 files.
Many thanks for all input and suggestions.
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
RE: How is this possible? [Solved]
am 28.10.2009 19:41:02 von Bob McConnell
From: tedd
> I found the problem, which basically was that I had declared a=20
> variable in a preceding script with the same name, namely $user_id.
>=20
> When I changed my script to $u_id, everything worked as before.=20
> Clearly, Globals are evil.
>=20
> It's a bitch to have to work with code you can't change unless you=20
> are willing to edit over 1500 files.
Just keep in mind that register_globals is deprecated and will be going
away in a future release of PHP. You might want to start thinking about
a strategy to update those files before that happens.
Bob McConnell
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible? [Solved]
am 28.10.2009 19:48:50 von Robert Cummings
Bob McConnell wrote:
> From: tedd
>
>> I found the problem, which basically was that I had declared a
>> variable in a preceding script with the same name, namely $user_id.
>>
>> When I changed my script to $u_id, everything worked as before.
>> Clearly, Globals are evil.
>>
>> It's a bitch to have to work with code you can't change unless you
>> are willing to edit over 1500 files.
>
> Just keep in mind that register_globals is deprecated and will be going
> away in a future release of PHP. You might want to start thinking about
> a strategy to update those files before that happens.
>
> Bob McConnell
I don't think his problem was register_globals, I think it was the other
problem of globals... namely variable naming collision causing value
clobber.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: How is this possible? [Solved]
am 28.10.2009 20:19:40 von TedD
At 2:48 PM -0400 10/28/09, Robert Cummings wrote:
>Bob McConnell wrote:
>>From: tedd
>>
>>>I found the problem, which basically was that I had declared a
>>>variable in a preceding script with the same name, namely $user_id.
>>>
>>>When I changed my script to $u_id, everything worked as before.
>>>Clearly, Globals are evil.
>>>
>>>It's a bitch to have to work with code you can't change unless you
>>>are willing to edit over 1500 files.
>>
>>Just keep in mind that register_globals is deprecated and will be going
>>away in a future release of PHP. You might want to start thinking about
>>a strategy to update those files before that happens.
>>
>>Bob McConnell
>
>I don't think his problem was register_globals, I think it was the
>other problem of globals... namely variable naming collision causing
>value clobber.
>
>Cheers,
>Rob.
Rob:
You were exactly right -- it was a collision.
Now, if I can only find out why header("location:.."); stopped working.
Sometimes old code presents a lot of problems to solve.
Thanks,
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
Re: How is this possible? [Solved]
am 29.10.2009 00:04:34 von List Manager
tedd wrote:
> At 2:48 PM -0400 10/28/09, Robert Cummings wrote:
>> Bob McConnell wrote:
>>> From: tedd
>>>
>>>> I found the problem, which basically was that I had declared a
>>>> variable in a preceding script with the same name, namely $user_id.
>>>>
>>>> When I changed my script to $u_id, everything worked as before.
>>>> Clearly, Globals are evil.
>>>>
>>>> It's a bitch to have to work with code you can't change unless you
>>>> are willing to edit over 1500 files.
>>>
>>> Just keep in mind that register_globals is deprecated and will be going
>>> away in a future release of PHP. You might want to start thinking about
>>> a strategy to update those files before that happens.
>>>
>>> Bob McConnell
>>
>> I don't think his problem was register_globals, I think it was the
>> other problem of globals... namely variable naming collision causing
>> value clobber.
>>
>> Cheers,
>> Rob.
>
>
> Rob:
>
> You were exactly right -- it was a collision.
>
> Now, if I can only find out why header("location:.."); stopped working.
>
> Sometimes old code presents a lot of problems to solve.
>
> Thanks,
>
> tedd
>
I would use headers_sent() to find out if the headers have been sent before
calling header()
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php