Re: [PHP] Include Part 2

2002-09-29 Thread Justin French

Is this to pull the rows out of a database??

You could start with a simple example, which is just a basic config setting,
and use the $myrow array in your sql while loop to do a lot of the work.

?
// set your column names
$colsToSelect = 'title, format, category';

// select
$sql = SELECT {$colsToSelect} FROM tablename LIMIT 2;
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
{
foreach($myrow as $key = $value)
{
echo {$key}: {$value}br /\n;
}
echo br /\n;
}
?

For the above query, this would echo something like:

title: contents of titlebr /
format: contents of format br /
category: contents of category br /
br /
title: contents of titlebr /
format: contents of format br /
category: contents of category br /
br /


The next from there, to get more control over your rows might be an array
with the columns you wish to query...


Justin French




on 29/09/02 4:06 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:

 What I was wanting to do was store the myrows under let say, db_info.inc
 file. So that I can add or delete what myrows I want to call on.
 
 I am thinking this what I need  to do...
 
 Function row ($row) { //These are the rows to call on...
 $title = $myrow[title];
 $format = myrow[format];
 $category =$myrow[category];
 }
 
 This way I can add more myrow to call upon at a later date or delete for
 that matter.
 
 I hope that helps...
 
 Chuck
 
 On 9/29/02 1:48 AM, Justin French [EMAIL PROTECTED] wrote:
 
 Not sure I fully understand, but usually this stuff calls for either a
 function, or an included file of code... in your case, sounds like a
 function is required, but I may not fully understand...
 
 Regards,
 
 Justin
 
 
 on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:
 
 Ok, I am trying to make my design a lot easier. I want to know if I can do
 this...
 
 I want to set up in my php page this...
 
 
 $rows;
 
 Under my db_info.inc I want to store this so that I can add delete from it.
 
 $row = $title = myrow[title]; $format = myrow[format]; $category =
 myrow[category];
 
 Am I wrong to try this way? Do I need to set it up as fuction to call on?
 
 Chuck Payne
 
 
 


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




Re: [PHP] Include Part 2

2002-09-29 Thread Chris Shiflett

Chuck PUP Payne wrote:

By the way I have time this but what is happen and maybe this will clear up
things.


That certainly made things clear. :-)

I only calling this first myrow call titles. It's not going on to
the other two. Now in my php page I have this...

$myrow = mysql_fetch_array($result);

$row;

Now this doesn't work.


No kidding. What is the line $row; supposed to do exactly?

But this does.

$myrow = mysql_fetch_array($result);

$title = $myrow[title];
$format = $myrow[format];
$category =$myrow[category];


Yes, this looks better. You should place your array keys in quotes, such 
as $myrow[title].

I don't see how this relates at all to your example above.

So want I wanted to do  but I am see you can was to make $row be called from
db_info.inc so that if lets say I wanted to add ratings I can add it to the
db_info.inc.


It's best to either include your code and reference file names or leave 
them out entirely. You sound like you assume we are looking at your 
screen and know what db_info.inc is.

The reasoning for this is about 50 pages and I am getting tried
of change each one I like to be able to change just one file. You know make
it easier. Better design.


I think you have the right idea. I really have no idea what the question 
is, but you should maybe consider the include() function to help you 
out. For example, you could have a script fetch_row.inc like this:

$myrow = mysql_fetch_array($result);
$title = $myrow[title];
$format = $myrow[format];
$category =$myrow[category];

Then every time you wanted to fetch a row from a result set consisting 
of these columns, you could just do this:

include(/path/to/fetch_row.inc);

Maybe that helps? I'm not really understanding what code you are 
repeating 50 times.

Happy hacking.

Chris


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




[PHP] Include Part 2

2002-09-28 Thread Chuck PUP Payne

Ok, I am trying to make my design a lot easier. I want to know if I can do
this...

I want to set up in my php page this...


$rows;

Under my db_info.inc I want to store this so that I can add delete from it.

$row = $title = myrow[title]; $format = myrow[format]; $category =
myrow[category];

Am I wrong to try this way? Do I need to set it up as fuction to call on?

Chuck Payne


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




Re: [PHP] Include Part 2

2002-09-28 Thread Justin French

Not sure I fully understand, but usually this stuff calls for either a
function, or an included file of code... in your case, sounds like a
function is required, but I may not fully understand...

Regards,

Justin


on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:

 Ok, I am trying to make my design a lot easier. I want to know if I can do
 this...
 
 I want to set up in my php page this...
 
 
 $rows;
 
 Under my db_info.inc I want to store this so that I can add delete from it.
 
 $row = $title = myrow[title]; $format = myrow[format]; $category =
 myrow[category];
 
 Am I wrong to try this way? Do I need to set it up as fuction to call on?
 
 Chuck Payne
 


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




RE: [PHP] Include Part 2

2002-09-28 Thread John W. Holmes

 -Original Message-
 From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 1:29 AM
 To: PHP General
 Subject: [PHP] Include Part 2
 
 Ok, I am trying to make my design a lot easier. I want to know if I
can do
 this...
 
 I want to set up in my php page this...
 
 
 $rows;
 
 Under my db_info.inc I want to store this so that I can add delete
from
 it.
 
 $row = $title = myrow[title]; $format = myrow[format]; $category =
 myrow[category];
 
 Am I wrong to try this way? Do I need to set it up as fuction to call
on?

Yes, you are wrong. How wrong you are, I cannot tell, because I have no
idea what you are saying...

---John Holmes...



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




Re: [PHP] Include Part 2

2002-09-28 Thread Chuck PUP Payne

What I was wanting to do was store the myrows under let say, db_info.inc
file. So that I can add or delete what myrows I want to call on.

I am thinking this what I need  to do...

Function row ($row) { //These are the rows to call on...
$title = $myrow[title];
$format = myrow[format];
$category =$myrow[category];
}

This way I can add more myrow to call upon at a later date or delete for
that matter.

I hope that helps...

Chuck

On 9/29/02 1:48 AM, Justin French [EMAIL PROTECTED] wrote:

 Not sure I fully understand, but usually this stuff calls for either a
 function, or an included file of code... in your case, sounds like a
 function is required, but I may not fully understand...
 
 Regards,
 
 Justin
 
 
 on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:
 
 Ok, I am trying to make my design a lot easier. I want to know if I can do
 this...
 
 I want to set up in my php page this...
 
 
 $rows;
 
 Under my db_info.inc I want to store this so that I can add delete from it.
 
 $row = $title = myrow[title]; $format = myrow[format]; $category =
 myrow[category];
 
 Am I wrong to try this way? Do I need to set it up as fuction to call on?
 
 Chuck Payne
 
 


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




Re: [PHP] Include Part 2

2002-09-28 Thread Chuck PUP Payne

By the way I have time this but what is happen and maybe this will clear up
things. I only calling this first myrow call titles. It's not going on to
the other two. Now in my php page I have this...

$myrow = mysql_fetch_array($result);

$row;

Now this doesn't work. But this does.

$myrow = mysql_fetch_array($result);

$title = $myrow[title];
$format = $myrow[format];
$category =$myrow[category];


So want I wanted to do  but I am see you can was to make $row be called from
db_info.inc so that if lets say I wanted to add ratings I can add it to the
db_info.inc. The reasoning for this is about 50 pages and I am getting tried
of change each one I like to be able to change just one file. You know make
it easier. Better design. Sorry it 2:30am and Jolt cola is not working and I
am LD. So sorry if this is not clear.

Chuck Payne


On 9/29/02 2:06 AM, Chuck PUP Payne [EMAIL PROTECTED] wrote:

 What I was wanting to do was store the myrows under let say, db_info.inc
 file. So that I can add or delete what myrows I want to call on.
 
 I am thinking this what I need  to do...
 
 Function row ($row) { //These are the rows to call on...
   $title = $myrow[title];
   $format = $myrow[format];
   $category =$myrow[category];
 }
 
 This way I can add more myrow to call upon at a later date or delete for
 that matter.
 
 I hope that helps...
 
 Chuck
 
 On 9/29/02 1:48 AM, Justin French [EMAIL PROTECTED] wrote:
 
 Not sure I fully understand, but usually this stuff calls for either a
 function, or an included file of code... in your case, sounds like a
 function is required, but I may not fully understand...
 
 Regards,
 
 Justin
 
 
 on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:
 
 Ok, I am trying to make my design a lot easier. I want to know if I can do
 this...
 
 I want to set up in my php page this...
 
 
 $rows;
 
 Under my db_info.inc I want to store this so that I can add delete from it.
 
 $row = $title = myrow[title]; $format = myrow[format]; $category =
 myrow[category];
 
 Am I wrong to try this way? Do I need to set it up as fuction to call on?
 
 Chuck Payne
 
 
 


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