Jump to content

Problem Looping to Write Multiple Web Pages


silveradogirl45

Recommended Posts

I am a slight beginner at php and am totally stuck. So sorry, if this is a rookie question, but I couldn't find any solutions in the forums.

 

Situation: I have 3 individual web pages (test, test1, test2), which are in a DB each in it's own row, with it's own information.

 

Solution Needed: A code that can take out the info for "test", write it to a page, and upload the page to the server. Then repeat for "test1", then "test2".

 

Problem: "test" page is writing correctly, but "test1" page is a combination of "test" and "test1". Then, "test2" page is a combination of "test", "test1", and "test2". I've tried all different loops and in different areas of page and either has the same problem or makes the looping worse.

 

Code: (Note**$dfile is the file name of the page [test, test1, test2])

 

$dgallresult3 = mysql_query("SELECT * FROM pageDetail WHERE dmanufacturer = 'Tester'");

while ($drowID3 = mysql_fetch_array($dgallresult3)) {

 

//create variables from the table data:

 

$keyID = $drowID3[0];

$dfile = $drowID3[1];

$dmanufacturer = $drowID3[2];

$model = $drowID3[3];

$model1 = $drowID3[4];

$model2 = $drowID3[5];

$dtitle = $drowID3[6];

$type = $drowID3[7];

$other = $drowID3[8];

$industry = $drowID3[9];

$industry2 = $drowID3[10];

$ddescription = urldecode($drowID3[11]);

$feature1 = $drowID3[12];

$feature2 = $drowID3[13];

$feature3 = $drowID3[14];

$feature4 = $drowID3[15];

$feature5 = $drowID3[16];

$feature6 = $drowID3[17];

$spec1 = $drowID3[18];

$spec2 = $drowID3[19];

$spec3 = $drowID3[20];

$spec4 = $drowID3[21];

$spec5 = $drowID3[22];

$detail1 = $drowID3[23];

$detail2 = $drowID3[24];

$detail3 = $drowID3[25];

$detail4 = $drowID3[26];

$detail5 = $drowID3[27];

$weight = $drowID3[28];

$dimage = $drowID3[29];

$dalttag = $drowID3[30];

$price = $drowID3[31];

$clearance = $drowID3[32];

$dmetadesc = urldecode($drowID3[33]);

$keyword1 = $drowID3[34];

$keyword2 = $drowID3[35];

$keyword3 = $drowID3[36];

$keyword4 = $drowID3[37];

$dateCreated = $drowID3[38];

 

//writes layout of page here.

 

//include file to save page here.

 

}

 

mysql_close();

 

---- Any help would be greatly appreciated!! ---

When I run the code...

First page ("test"): comes out correctly (shows "test" and all it's information)

2nd page ("test1"): puts first and 2nd page layouts together then writes and uploads. (shows "test" and "test1" combined)

3rd page("test2"): puts first, 2nd, and 3rd page layouts together then writes and uploads. (shows "test", "test1", and "test2" combined).

 

What I need to happen...

first page ("test"): to show only "test" and all it's information.

2nd page("test1"): to show only "test1" and all it's information.

3rd page("test2"): to show only "test2" and all it's information.

 

I hope that makes sense.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.