Advertisement

07.01.2008 at 02:35AM PDT, ID: 23529514
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

write data to file according to their filename

Asked by firekiller15 in PHP Scripting Language

Tags:

How to write data to file according to their filename


How to write data to file according to their filename
example is i have this table

Databasename: studentnation
Table: StudentNationality
nationalityID  nationality
1            USA
2            AUSTRALIA
3             BRAZIL

Databasename: studenttype
Table: StudentID
studentID   nationalityID
123            1      
124            3
125            1
126            2

Databasename: StudentInfo
Table: StudentAddress
studentAddress  StudentID
hillpark      123
downhill      124
cavestreet      125
burswood      126


output of my code:
#########################################
USA_TEXT.txt
|hillpark|downhill|cavestreet|burswood|

AUSTRALIA_TEXT.txt
|hillpark|downhill|cavestreet|burswood|      

BRAZIL_TEXT.txt
|hillpark|downhill|cavestreet|burswood|      
#########################################

it is not what i desired.
how to make it become as below

USA_TEXT.txt
|cavestreet|hillpark|

AUSTRALIA_TEXT.txt
|burswood|

BRAZIL_TEXT.txt
|downhill|

in code snippet is my code
pls helpStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
####config file#####
<?php
$File1 = USA_TEXT;
$File2 = AUSTRALIA_TEXT;
$File3 = BRAZIL_TEXT;
 
$nation1=USA;
$nation2=AUSTRALIA;
$nation3=BRAZIL;
 
$Nationality = "$nation1:$File1,$nation2:$File2,$nation3:$File3";
 
?>
 
 
####Student.php#####
<?php
//why all data print to all file?
//how to put USA to USA_TEXT file,AUSTRALIA to AUSTRALIA_TEXT and BRAZIL to BRAZIL_TEXT
 
class student
{
 
 
//get studentid from config file
function GetNationalityFromConfigFile()
 {
  require("config.php");
  $this->GetNationality = $Nationality;
 
  $this->GetNationality_array = split(",",$this->GetNationality);
  foreach($this->GetNationality_array as $GetNationality_value)
	{
	  list($GetStudentNationality, $GetStudentFilename) = split(":", $GetNationality_value);
      $this->StudentNationalityReturn[] = $GetStudentNationality;
     
	  $this->StudentFileReturn[] = $GetStudentFilename.".txt";
	 
	}
 }
 
 
 function GetStudentID()
 {
  // Connect to database
 
  $dbLink = mysql_connect("localhost","root" ,"");
  $i = 0; 
  $j = 0; 
  
  foreach ($this->StudentNationalityReturn as $StudentNationalityReturn_value)
   {
   	$result =  mysql_query("SELECT STUDENTTYPE.STUDENTID.STUDENTID AS STUDENTID,STUDENTTYPE.STUDENTID.NATIONALITYID AS  NATIONALITYID
	FROM STUDENTTYPE.STUDENTID JOIN  STUDENTTYPE.STUDENTNATION ON   STUDENTTYPE.STUDENTID.NATIONALITYID = STUDENTTYPE.STUDENTNATION.NATIONALITYID
	WHERE NATIONALITY =\"$StudentNationalityReturn_value\"");
    
	
	while($row = mysql_fetch_array($result))
    {
	 $this->GetNationalityIDReturn[$i] = $row['NATIONALITYID']; 
     $i++;
	 $this->GetStudentIDReturn[$j] = $row['STUDENTID']; 
     $j++;
    } 
   }
  mysql_close($dbLink);
 }
 
 
function GetStudentInformation()
 {
  // Connect to database
  $dbLink = mysql_connect("localhost","root" ,"");
  if(!$dbLink) die("Could not connect to database. " . mysql_error());
    
  foreach ( $this->GetStudentIDReturn as $StudentIDReturn_value)
   {
   	$result =  mysql_query("SELECT STUDENTINFO.STUDENTADDRESS.STUDENTADDRESS AS STUDENTADDRESS
	FROM STUDENTINFO.STUDENTADDRESS
	WHERE STUDENTID =\"$StudentIDReturn_value\"");
    if(!$result) die("Query didn't work. " . mysql_error());
	
	while($row = mysql_fetch_array($result))
    {
	 $this->GetNationalityIDReturn = $row['STUDENTADDRESS']; 
    } 
   $output = "|{$this->GetNationalityIDReturn}|"; 
   
   foreach($this->StudentFileReturn as $writetofile)
	   {
	    file_put_contents($writetofile,$output, FILE_APPEND); 
	   }
   }
  mysql_close($dbLink);
 }
 
 
}
?>
 
Keywords: write data to file according to their filen…
 
Loading Advertisement...
 
[+][-]07.01.2008 at 02:50AM PDT, ID: 21906115

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 05:25AM PDT, ID: 21906940

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 05:30AM PDT, ID: 21906993

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 08:29AM PDT, ID: 21908721

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 08:30AM PDT, ID: 21908733

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 08:36AM PDT, ID: 21908786

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 08:51AM PDT, ID: 21908904

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 08:56AM PDT, ID: 21908944

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:01AM PDT, ID: 21908993

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:15AM PDT, ID: 21909136

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:20AM PDT, ID: 21909189

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:37AM PDT, ID: 21909345

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:49AM PDT, ID: 21909434

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 10:26AM PDT, ID: 21909754

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2008 at 01:46AM PDT, ID: 21914453

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: PHP
Sign Up Now!
Solution Provided By: pdd
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628