| |

VerySource

 Forgot password?
 Register
Search
View: 9|Reply: 9

SOS, hurry, let's help find out how to solve it! Masters

[Copy link]

1

Threads

6

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-3-12 12:30:01
| Show all posts |Read mode
I retrieved records from the database and iteratively showed:
while ($ data = mysql_fetch_array ($ query)) {
 printf ("<tr bgcolor = # FFFFFF> <td>% s <td>", $ data [0]);
 printf ("<td nowrap>% s </ font> </ td>", $ data [1]);
 printf ("<td nowrap>% s </ font> </ td>", $ data [2]);
 printf ("<td nowrap>% s </ font> </ td> </ tr>", $ data [3]);
}
Now it is required to add a superlink to each TD to pass the value. The problem: Now the requirement is that the tdata connection of $ data [0] is not only passed the value of $ data [0], but all the values ​​in this tr Pass it!
Reply

Use magic Report

1

Threads

6

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-6-6 15:30:01
| Show all posts
I know that it might be said to pass $data[$i],$data[$i+1]....this is OK for the $data[0] connection, but the next td connection will not work. It is the point of which td's hyper link must bring the value in the entire tr!
Reply

Use magic Report

1

Threads

6

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-6-6 23:00:01
| Show all posts
To add: the above td is looped out, this is the difficulty

for($i=0;$i<$count_num;$i++){
               printf("<td nowrap>%s<font></td>",$data[$i]);
        }
Reply

Use magic Report

1

Threads

6

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-6-12 09:15:02
| Show all posts
Let me be clear:
I read the data from the database and display it circularly:
while($data = mysql_fetch_array($query)){
        printf("<tr>");
        for($i=0;$i<$count_num;$i++){
                 $format = "<a href=\"javascript: window.open('ViewCache.php?$id=$data[$i],'_blank');void(0);\">%s</a> ";
                        printf("<td nowrap>$format</font></td>",$data[$i]);
        }
}
td is displayed cyclically according to the condition, adding a connection to each TD to pass the value, the problem: passing the value to which this TD belongs is no problem, the above is OK, and now the TD that is displayed in a loop is required to connect no matter which point. Passing the value of the entire TR, not just the value of the TD, I don’t know how to do it, please master it!
Reply

Use magic Report

1

Threads

6

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-6-12 14:15:01
| Show all posts
example:
Connection 1 connection 2 connection 3
test test2 test3

When you click test, you must pass the three values ​​of test, test2, and test3. Similarly, when you click test2, you must pass these three values.
This is clear enough!
Reply

Use magic Report

0

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-6-13 09:15:01
| Show all posts
implode(',',$data);
explode(',',$data);
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-6-14 20:00:01
| Show all posts
for($i=0;$i<$count_num;$i++){
     $link="id$i=".$data[$i];
        }
for($i=0;$i<$count_num;$i++){
   
$format = "<a href=\"javascript: window.open('ViewCache.php?$link,'_blank');void(0);\">%s</a>";
  printf("<td nowrap>$format</font></td>",$data[$i]);
        }
}
I don't know if this is possible
Reply

Use magic Report

0

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-6-14 22:45:02
| Show all posts
1.php
------
while($data = mysql_fetch_array($query))
{
  $dataStr = implode(',',$data);
  printf("<tr>");
  for($i=0;$i<$count_num;$i++){
  $format = "<a href=\"javascript:
  window.open('ViewCache.php?id=$dataStr,'_blank');void(0);\">%s</a>";
  printf("<td nowrap>$format</font></td>",$data[$i]);
}
}

ViewCache.php:
-----------------------
print_r(explode(',',$_GET['id']));
Reply

Use magic Report

1

Threads

6

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

 Author| Post time: 2020-6-16 17:45:01
| Show all posts
Not good, I tried the code ofbabydidi, when count_num=2, it is two TDs, but only one value is passed
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-6-18 18:15:01
| Show all posts
Do you need to change your receiving code?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list