Re: Include Part 2

From: Date: Sun, 29 Sep 2002 06:36:07 +0000
Subject: Re: Include Part 2
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118059@lists.php.net to get a copy of this message
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

« previous php.general (#118059) next »