RE: [PHP] Generating populated variables from component/content pairs in a database

2002-02-01 Thread Rick Emery

$sql = SELECT * FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

$result = mysql_query($sql) or die(Error: .mysql_error().$sqlBR);
while ( link($component,$content) = mysql_fetch_array($result) )
{
...do stuff...
}

The filed values will be in the $component and $content.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Generating populated variables from component/content
pairs in a database


I've got a fairly basic website content management system I'm working on,
and I've got the data split up in MySQL by the following: a few columns for
identifiers like language, section and unique keyname, a column for a
component name and a column for the relevant content for that component.  As
follows:


|  component  |   content  |

| foo |   123456   |

| bar |   654321   |


Assuming I've got the right sql statement here (it just looks for the rows
that match the section and subsection provided earlier in the script):

$sql = SELECT FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

What can I do to end up with a variable for each component/content pair,
with the variable named with the value of the component, and assigned the
value of the content?:

$foo = 123456;
$bar = 654321;

Is there a simple way to do this?

Thanks,

James Hallam


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Generating populated variables from component/content pairs in a database

2002-02-01 Thread James Hallam

Thanks for your reply..  I guess I should have mentioned my platform:
iPlanet/NT..  The manual says that link() isn't available for Windows
users..  Is there another function I could use?

My second question concerns the .. do stuff here .. portion..  I'm not sure
what I'd actually put there.  My goal is to have a variable for each
component/content pair, regardless of how many pairs there are returned by
the SQL statement, and then to have those variables available for display
later on in the page.  Do you have any suggestions?

James

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:18 PM
To: 'James Hallam'; [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


$sql = SELECT * FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

$result = mysql_query($sql) or die(Error: .mysql_error().$sqlBR);
while ( link($component,$content) = mysql_fetch_array($result) )
{
...do stuff...
}

The filed values will be in the $component and $content.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Generating populated variables from component/content
pairs in a database


I've got a fairly basic website content management system I'm working on,
and I've got the data split up in MySQL by the following: a few columns for
identifiers like language, section and unique keyname, a column for a
component name and a column for the relevant content for that component.  As
follows:


|  component  |   content  |

| foo |   123456   |

| bar |   654321   |


Assuming I've got the right sql statement here (it just looks for the rows
that match the section and subsection provided earlier in the script):

$sql = SELECT FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

What can I do to end up with a variable for each component/content pair,
with the variable named with the value of the component, and assigned the
value of the content?:

$foo = 123456;
$bar = 654321;

Is there a simple way to do this?

Thanks,

James Hallam


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Generating populated variables from component/content pairs in a database

2002-02-01 Thread Rick Emery

MEA CULPA...Big-Time typo on my part.  I am sorry...  I meant list() not
link():

while ( list($component,$content) = mysql_fetch_array($result) )

This statement will return the number of component/content pairs, regardless
of number that are in the database.

In the place where I say do stuff, that would be where you would use the
variables, such as displaying them or using them in tables, combo boxes,
etc.


If you wanted to store them in an associated array, you could:

while ( list($component,$content) = mysql_fetch_array($result) )
{
myarray[$component] = $content;
}

Hence, the component is the key.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:36 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


Thanks for your reply..  I guess I should have mentioned my platform:
iPlanet/NT..  The manual says that link() isn't available for Windows
users..  Is there another function I could use?

My second question concerns the .. do stuff here .. portion..  I'm not sure
what I'd actually put there.  My goal is to have a variable for each
component/content pair, regardless of how many pairs there are returned by
the SQL statement, and then to have those variables available for display
later on in the page.  Do you have any suggestions?

James

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:18 PM
To: 'James Hallam'; [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


$sql = SELECT * FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

$result = mysql_query($sql) or die(Error: .mysql_error().$sqlBR);
while ( link($component,$content) = mysql_fetch_array($result) )
{
...do stuff...
}

The filed values will be in the $component and $content.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Generating populated variables from component/content
pairs in a database


I've got a fairly basic website content management system I'm working on,
and I've got the data split up in MySQL by the following: a few columns for
identifiers like language, section and unique keyname, a column for a
component name and a column for the relevant content for that component.  As
follows:


|  component  |   content  |

| foo |   123456   |

| bar |   654321   |


Assuming I've got the right sql statement here (it just looks for the rows
that match the section and subsection provided earlier in the script):

$sql = SELECT FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

What can I do to end up with a variable for each component/content pair,
with the variable named with the value of the component, and assigned the
value of the content?:

$foo = 123456;
$bar = 654321;

Is there a simple way to do this?

Thanks,

James Hallam


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Generating populated variables from component/content pairs in a database

2002-02-01 Thread James Hallam

Okay, I stripped the SQL statement down to just select all, as there is only
one set of test data in the DB right now.  $component is renamed as $comp in
the new code, as that is the actual name of the table column.  I've got the
code in as follows, but I'm just getting a blank HTML page with nothing in
the body tag:

//  Connecting Stuff up here

$sql = SELECT * FROM en_na;  //This is the right table

$result = @mysql_query($sql,$connection)
or die(Couldn't execute query.);

while ( list($comp,$content) = mysql_fetch_array($result) )
{
compDisplay[$comp] = $content;
}

?

// HTML Stuff in here ..

?

echo $compDisplay['headline'];  //headline is the first component..

?


Grr.  I'm stumped..

James



-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:45 PM
To: 'James Hallam'; [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


MEA CULPA...Big-Time typo on my part.  I am sorry...  I meant list() not
link():

while ( list($component,$content) = mysql_fetch_array($result) )

This statement will return the number of component/content pairs, regardless
of number that are in the database.

In the place where I say do stuff, that would be where you would use the
variables, such as displaying them or using them in tables, combo boxes,
etc.


If you wanted to store them in an associated array, you could:

while ( list($component,$content) = mysql_fetch_array($result) )
{
myarray[$component] = $content;
}

Hence, the component is the key.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:36 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


Thanks for your reply..  I guess I should have mentioned my platform:
iPlanet/NT..  The manual says that link() isn't available for Windows
users..  Is there another function I could use?

My second question concerns the .. do stuff here .. portion..  I'm not sure
what I'd actually put there.  My goal is to have a variable for each
component/content pair, regardless of how many pairs there are returned by
the SQL statement, and then to have those variables available for display
later on in the page.  Do you have any suggestions?

James

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:18 PM
To: 'James Hallam'; [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


$sql = SELECT * FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

$result = mysql_query($sql) or die(Error: .mysql_error().$sqlBR);
while ( link($component,$content) = mysql_fetch_array($result) )
{
...do stuff...
}

The filed values will be in the $component and $content.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Generating populated variables from component/content
pairs in a database


I've got a fairly basic website content management system I'm working on,
and I've got the data split up in MySQL by the following: a few columns for
identifiers like language, section and unique keyname, a column for a
component name and a column for the relevant content for that component.  As
follows:


|  component  |   content  |

| foo |   123456   |

| bar |   654321   |


Assuming I've got the right sql statement here (it just looks for the rows
that match the section and subsection provided earlier in the script):

$sql = SELECT FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

What can I do to end up with a variable for each component/content pair,
with the variable named with the value of the component, and assigned the
value of the content?:

$foo = 123456;
$bar = 654321;

Is there a simple way to do this?

Thanks,

James Hallam


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General

RE: [PHP] Generating populated variables from component/content pairs in a database

2002-02-01 Thread Rick Emery

Place $ in front of compDisplay:  $compDisplay[$comp] = $content;

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 5:02 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


Okay, I stripped the SQL statement down to just select all, as there is only
one set of test data in the DB right now.  $component is renamed as $comp in
the new code, as that is the actual name of the table column.  I've got the
code in as follows, but I'm just getting a blank HTML page with nothing in
the body tag:

//  Connecting Stuff up here

$sql = SELECT * FROM en_na;  //This is the right table

$result = @mysql_query($sql,$connection)
or die(Couldn't execute query.);

while ( list($comp,$content) = mysql_fetch_array($result) )
{
$compDisplay[$comp] = $content;
}

?

// HTML Stuff in here ..

?

echo $compDisplay['headline'];  //headline is the first component..

?


Grr.  I'm stumped..

James



-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:45 PM
To: 'James Hallam'; [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


MEA CULPA...Big-Time typo on my part.  I am sorry...  I meant list() not
link():

while ( list($component,$content) = mysql_fetch_array($result) )

This statement will return the number of component/content pairs, regardless
of number that are in the database.

In the place where I say do stuff, that would be where you would use the
variables, such as displaying them or using them in tables, combo boxes,
etc.


If you wanted to store them in an associated array, you could:

while ( list($component,$content) = mysql_fetch_array($result) )
{
$myarray[$component] = $content;
}

Hence, the component is the key.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:36 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


Thanks for your reply..  I guess I should have mentioned my platform:
iPlanet/NT..  The manual says that link() isn't available for Windows
users..  Is there another function I could use?

My second question concerns the .. do stuff here .. portion..  I'm not sure
what I'd actually put there.  My goal is to have a variable for each
component/content pair, regardless of how many pairs there are returned by
the SQL statement, and then to have those variables available for display
later on in the page.  Do you have any suggestions?

James

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 2:18 PM
To: 'James Hallam'; [EMAIL PROTECTED]
Subject: RE: [PHP] Generating populated variables from component/content
pairs in a database


$sql = SELECT * FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

$result = mysql_query($sql) or die(Error: .mysql_error().$sqlBR);
while ( link($component,$content) = mysql_fetch_array($result) )
{
...do stuff...
}

The filed values will be in the $component and $content.

-Original Message-
From: James Hallam [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 3:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Generating populated variables from component/content
pairs in a database


I've got a fairly basic website content management system I'm working on,
and I've got the data split up in MySQL by the following: a few columns for
identifiers like language, section and unique keyname, a column for a
component name and a column for the relevant content for that component.  As
follows:


|  component  |   content  |

| foo |   123456   |

| bar |   654321   |


Assuming I've got the right sql statement here (it just looks for the rows
that match the section and subsection provided earlier in the script):

$sql = SELECT FROM $table_name
WHERE sec = '$sec' AND
WHERE subsec = '$subsec' AND
WHERE name = '$name'
ORDER BY component
;

What can I do to end up with a variable for each component/content pair,
with the variable named with the value of the component, and assigned the
value of the content?:

$foo = 123456;
$bar = 654321;

Is there a simple way to do this?

Thanks,

James Hallam


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail