no table creation in information_schema
[phpmyadmin/crack.git] / tbl_properties_operations.php
blob42805049604e3f02fdb74623abef3b0d64998ae5
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Runs common work
7 */
8 require('./tbl_properties_common.php');
9 //$err_url = 'tbl_properties_operations.php' . $err_url;
10 $url_query .= '&amp;goto=tbl_properties_operations.php&amp;back=tbl_properties_operations.php';
13 /**
14 * Gets relation settings
16 require_once('./libraries/relation.lib.php');
17 $cfgRelation = PMA_getRelationsParam();
19 /**
20 * Gets available MySQL charsets and storage engines
22 require_once('./libraries/mysql_charsets.lib.php');
23 require_once('./libraries/storage_engines.lib.php');
25 // reselect current db (needed in some cases probably due to
26 // the calling of relation.lib.php)
27 PMA_DBI_select_db($db);
29 /**
30 * Updates table comment, type and options if required
32 if (isset($submitcomment)) {
33 if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
34 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
35 $result = PMA_DBI_query($sql_query);
36 $message = $strSuccess;
39 if (isset($submittype)) {
40 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $new_tbl_type;
41 $result = PMA_DBI_query($sql_query);
42 $message = $strSuccess;
44 if (isset($submitcollation)) {
45 // since something modifies $tbl_collation between the moment it is
46 // set from $_POST and this point, need to restore it
47 // (bug seen in MySQL 5.0.4)
48 $tbl_collation = $_POST['tbl_collation'];
49 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' DEFAULT' . PMA_generateCharsetQueryPart($tbl_collation);
50 $result = PMA_DBI_query($sql_query);
51 $message = $strSuccess;
52 unset($tbl_collation);
54 if (isset($submitoptions)) {
55 $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
56 . (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
57 . (isset($checksum) ? ' checksum=1': ' checksum=0')
58 . (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0')
59 . (!empty($auto_increment) ? ' auto_increment=' . PMA_sqlAddslashes($auto_increment) : '');
60 $result = PMA_DBI_query($sql_query);
61 $message = $strSuccess;
64 /**
65 * Reordering the table has been requested by the user
67 if (isset($submitorderby) && !empty($order_field)) {
68 $sql_query = 'ALTER TABLE ' . PMA_backquote($table)
69 . ' ORDER BY ' . PMA_backquote(urldecode($order_field));
70 if (isset($order_order) && $order_order == 'desc') {
71 $sql_query .= ' DESC';
73 $result = PMA_DBI_query($sql_query);
74 $message = $result ? $strSuccess : $strFailed;
75 } // end if
77 /**
78 * Gets tables informations
80 require('./tbl_properties_table_info.php');
82 /**
83 * Displays top menu links
85 require('./tbl_properties_links.php');
87 /**
88 * Get columns names
90 $local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
91 $result = PMA_DBI_query($local_query);
92 for ($i = 0; $row = PMA_DBI_fetch_assoc($result); $i++) {
93 $columns[$i] = $row['Field'];
95 PMA_DBI_free_result($result);
96 unset($result);
99 <table border="0" align="left" cellpadding="3" cellspacing="0">
100 <?php
103 * Displays the page
106 if (PMA_MYSQL_INT_VERSION >= 32334) {
108 <!-- Order the table -->
110 <form method="post" action="tbl_properties_operations.php">
111 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
112 <tr>
113 <th class="tblHeaders" colspan="2" align="left"><?php echo $strAlterOrderBy; ?>:&nbsp;</th></tr>
114 <tr>
115 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
116 <select name="order_field" style="vertical-align: middle">
117 <?php
118 echo "\n";
119 foreach ($columns AS $junk => $fieldname) {
120 echo ' <option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
122 unset($columns);
124 </select>&nbsp;<?php echo $strSingly . "\n"; ?>
125 <select name="order_order" style="vertical-align: middle">
126 <option value="asc"><?php echo $strAscending; ?></option>
127 <option value="desc"><?php echo $strDescending; ?></option>
128 </select>
129 </td>
130 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
131 <input type="submit" name="submitorderby" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
132 </td>
133 </tr>
134 </form>
135 <tr><td colspan="2" height="5"></td></tr>
136 <?php
138 echo "\n";
140 <!-- Change table name -->
141 <form method="post" action="tbl_rename.php" onsubmit="return emptyFormElements(this, 'new_name')">
142 <tr>
143 <th class="tblHeaders" colspan="2" align="left">
144 <?php echo $strRenameTable; ?>:&nbsp;
145 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
146 <input type="hidden" name="reload" value="1" />
147 </th>
148 </tr>
149 <tr>
150 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
151 <input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" />&nbsp;
152 </td>
153 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
154 <input type="submit" value="<?php echo $strGo; ?>" />
155 </td>
156 </tr>
157 </form>
158 <tr><td colspan="2" height="5"></td></tr>
159 <!-- Move table -->
160 <form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')">
161 <tr>
162 <th class="tblHeaders" colspan="2" align="left">
163 <?php echo $strMoveTable . "\n"; ?>
164 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
165 <input type="hidden" name="reload" value="1" />
166 <input type="hidden" name="what" value="data" />
167 </th>
168 </tr>
169 <tr>
170 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" nowrap="nowrap">
171 <select name="target_db">
172 <?php
173 // The function used below is defined in "common.lib.php"
174 PMA_availableDatabases('main.php?' . PMA_generate_common_url());
175 for ($i = 0; $i < $num_dbs; $i++) {
176 echo ' ';
177 echo '<option value="' . htmlspecialchars($dblist[$i]) . '">' . htmlspecialchars($dblist[$i]) . '</option>';
178 echo "\n";
179 } // end for
181 </select>
182 &nbsp;<b>.</b>&nbsp;
183 <input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" />
184 </td>
185 <td align="<?php echo $cell_align_right; ?>" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
186 <input type="submit" name="submit_move" value="<?php echo $strGo; ?>" />
187 </td>
188 </tr>
189 </form>
190 <tr><td colspan="2" height="5"></td></tr>
191 <!-- Copy table -->
192 <form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')">
193 <tr>
194 <th class="tblHeaders" colspan="2" align="left">
195 <?php echo $strCopyTable . "\n"; ?>
196 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
197 <input type="hidden" name="reload" value="1" />
198 </th>
199 </tr>
200 <tr>
201 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2" nowrap="nowrap">
202 <select name="target_db">
203 <?php
204 for ($i = 0; $i < $num_dbs; $i++) {
205 echo ' ';
206 echo '<option value="' . htmlspecialchars($dblist[$i]) . '"';
207 if ($dblist[$i] == $db) {
208 echo ' selected="selected"';
210 echo '>' . htmlspecialchars($dblist[$i]) . '</option>';
211 echo "\n";
212 } // end for
214 </select>
215 &nbsp;<b>.</b>&nbsp;
216 <input type="text" size="20" name="new_name" class="textfield" onfocus="this.select()" />
217 </td>
218 </tr>
219 <tr>
220 <td nowrap="nowrap" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
221 <input type="radio" name="what" value="structure" id="radio_copy_structure" style="vertical-align: middle" /><label for="radio_copy_structure"><?php echo $strStrucOnly; ?></label>&nbsp;&nbsp;<br />
222 <input type="radio" name="what" value="data" id="radio_copy_data" checked="checked" style="vertical-align: middle" /><label for="radio_copy_data"><?php echo $strStrucData; ?></label>&nbsp;&nbsp;<br />
223 <input type="radio" name="what" value="dataonly" id="radio_copy_dataonly" style="vertical-align: middle" /><label for="radio_copy_dataonly"><?php echo $strDataOnly; ?></label>&nbsp;&nbsp;<br />
225 <input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" style="vertical-align: middle" /><label for="checkbox_drop"><?php echo $strStrucDrop; ?></label>&nbsp;&nbsp;<br />
226 <input type="checkbox" name="auto_increment" value="1" id="checkbox_auto_increment" style="vertical-align: middle" /><label for="checkbox_auto_increment"><?php echo $strAddAutoIncrement; ?></label><br />
227 <?php
228 // display "Add constraints" choice only if there are
229 // foreign keys
230 if (PMA_getForeigners($db, $table, '', 'innodb')) {
232 <input type="checkbox" name="constraints" value="1" id="checkbox_constraints" style="vertical-align: middle" /><label for="checkbox_constraints"><?php echo $strAddConstraints; ?></label><br />
233 <?php
234 } // endif
235 if (isset($_COOKIE) && isset($_COOKIE['pma_switch_to_new']) && $_COOKIE['pma_switch_to_new'] == 'true') {
236 $pma_switch_to_new = 'true';
239 <input type="checkbox" name="switch_to_new" value="true" id="checkbox_switch"<?php echo ((isset($pma_switch_to_new) && $pma_switch_to_new == 'true') ? ' checked="checked"' : ''); ?> style="vertical-align: middle" /><label for="checkbox_switch"><?php echo $strSwitchToTable; ?></label>&nbsp;&nbsp;
240 </td>
241 <td align="<?php echo $cell_align_right; ?>" valign="bottom" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
242 <input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" />
243 </td>
244 </tr>
245 </form>
246 <tr><td colspan="2" height="5"></td></tr>
247 <?php
250 * Displays form controls
253 <!-- Table comments -->
254 <form method="post" action="tbl_properties_operations.php">
255 <tr>
256 <th colspan="2" class="tblHeaders" align="left">
257 <?php
258 echo PMA_generate_common_hidden_inputs($db, $table);
259 echo $strTableComments . '&nbsp;';
260 if (strstr($show_comment, '; InnoDB free') === FALSE) {
261 if (strstr($show_comment, 'InnoDB free') === FALSE) {
262 // only user entered comment
263 $comment = $show_comment;
264 } else {
265 // here we have just InnoDB generated part
266 $comment = '';
268 } else {
269 // remove InnoDB comment from end, just the minimal part (*? is non greedy)
270 $comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment);
273 <input type="hidden" name="prev_comment" value="<?php echo urlencode($comment); ?>" />&nbsp;
274 </th>
275 <tr>
276 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
277 <input type="text" name="comment" maxlength="60" size="30" value="<?php echo htmlspecialchars($comment); ?>" class="textfield" style="vertical-align: middle" onfocus="this.select()" />&nbsp;
278 </td>
279 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
280 <input type="submit" name="submitcomment" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
281 </td>
282 </tr>
283 </form>
284 <tr><td colspan="2" height="5"></td></tr>
285 <!-- Table type -->
286 <?php
287 // modify robbat2 code - staybyte - 11. June 2001
288 $result = PMA_DBI_query('SHOW VARIABLES LIKE \'have_%\';');
289 if ($result) {
290 while ($tmp = PMA_DBI_fetch_assoc($result)) {
291 if (isset($tmp['Variable_name'])) {
292 switch ($tmp['Variable_name']) {
293 case 'have_bdb':
294 if ($tmp['Value'] == 'YES') {
295 $tbl_bdb = TRUE;
297 break;
298 case 'have_gemini':
299 if ($tmp['Value'] == 'YES') {
300 $tbl_gemini = TRUE;
302 break;
303 case 'have_innodb':
304 if ($tmp['Value'] == 'YES') {
305 $tbl_innodb = TRUE;
307 break;
308 case 'have_isam':
309 if ($tmp['Value'] == 'YES') {
310 $tbl_isam = TRUE;
312 break;
313 } // end switch
314 } // end if isset($tmp['Variable_name'])
315 } // end while
316 } // end if $result
318 PMA_DBI_free_result($result);
319 echo "\n";
321 <form method="post" action="tbl_properties_operations.php">
322 <tr>
323 <th colspan="2" class="tblHeaders" align="left">
324 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
325 <?php echo $strTableType; ?>:&nbsp;
326 <?php echo PMA_showMySQLDocu('Table_types', 'Table_types') . "\n"; ?>
327 </th>
328 </tr>
329 <tr>
330 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
331 <?php echo PMA_generateEnginesDropdown('new_tbl_type', NULL, FALSE, $tbl_type, 4); ?>
332 </td>
333 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
334 <input type="submit" name="submittype" value="<?php echo $strGo; ?>" />
335 </td>
336 </tr>
337 </form>
338 <tr><td colspan="2" height="5"></td></tr>
339 <?php
341 if (PMA_MYSQL_INT_VERSION >= 40100) {
342 echo "\n"
343 . '<!-- Table character set -->' . "\n"
344 . ' <form method="post" action="tbl_properties_operations.php">' . "\n"
345 . ' <tr>' . "\n"
346 . ' <th colspan="2" class="tblHeaders" align="left">' . "\n"
347 . PMA_generate_common_hidden_inputs($db, $table, 3)
348 . ' ' . $strCollation . ':&nbsp;' . "\n"
349 . ' </th>' . "\n"
350 . ' </tr>' . "\n"
351 . ' <tr>' . "\n"
352 . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
353 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, $tbl_collation, FALSE, 3)
354 . ' </td>' . "\n"
355 . ' <td bgcolor="' . $cfg['BgcolorOne'] . '" align="right">' . "\n"
356 . ' <input type="submit" name="submitcollation" value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
357 . ' </td>' . "\n"
358 . ' </tr>' . "\n"
359 . ' </form>' . "\n"
360 . ' <tr><td colspan="2" height="5"></td></tr>' . "\n";
362 // PACK_KEYS: MyISAM or ISAM
363 // DELAY_KEY_WRITE, CHECKSUM, AUTO_INCREMENT: MyISAM only
365 if ($tbl_type == 'MYISAM' || $tbl_type == 'ISAM') {
367 <!-- Table options -->
368 <form method="post" action="tbl_properties_operations.php">
369 <tr>
370 <th colspan="2" class="tblHeaders" align="left">
371 <?php echo $strTableOptions; ?>:&nbsp;
372 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
373 </th>
374 </tr>
375 <tr>
376 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
377 <input type="checkbox" name="pack_keys" id="pack_keys_opt"
378 <?php echo (isset($pack_keys) && $pack_keys == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="pack_keys_opt">pack_keys</label><br />
379 <?php
380 if ($tbl_type == 'MYISAM') {
382 <input type="checkbox" name="checksum" id="checksum_opt"
383 <?php echo (isset($checksum) && $checksum == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="checksum_opt">checksum</label><br />
385 <input type="checkbox" name="delay_key_write" id="delay_key_write_opt"
386 <?php echo (isset($delay_key_write) && $delay_key_write == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="delay_key_write_opt">delay_key_write</label><br />
388 <input type="text" name="auto_increment" id="auto_increment_opt" class="textfield"
389 <?php echo (isset($auto_increment) && !empty($auto_increment) ? ' value="' . $auto_increment . '"' : ''); ?> style="width: 30px; vertical-align: middle" />&nbsp;<label for="auto_increment_opt">auto_increment</label>
390 </td>
391 <?php
392 } // end if (MYISAM)
394 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" valign="bottom">
395 <input type="submit" name="submitoptions" value="<?php echo $strGo; ?>" />
396 </td>
397 </tr>
398 </form>
399 <?php
400 } // end if (MYISAM or ISAM)
402 </table>
403 <img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="25" height="1" border="0" align="left" />
404 <!----->
405 <table border="0" cellpadding="3" cellspacing="0">
406 <tr>
407 <th class="tblHeaders" colspan="2" align="left">
408 <?php echo $strTableMaintenance; ?>
409 </th>
410 </tr>
411 <?php
412 if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB' || $tbl_type == 'INNODB') {
413 echo "\n";
414 if ($tbl_type == 'MYISAM' || $tbl_type == 'INNODB') {
416 <tr>
417 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
418 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('CHECK TABLE ' . PMA_backquote($table)); ?>">
419 <?php echo $strCheckTable; ?></a>&nbsp;
420 </td>
421 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
422 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE') . "\n"; ?>
423 </td>
424 </tr>
425 <?php
427 echo "\n";
428 if ($tbl_type == 'INNODB') {
430 <tr>
431 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
432 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' TYPE=InnoDB'); ?>">
433 <?php echo $strDefragment; ?></a>&nbsp;
434 </td>
435 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
436 <?php echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting') . "\n"; ?>
437 </td>
438 </tr>
439 <?php
441 echo "\n";
442 if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
444 <tr>
445 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
446 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ANALYZE TABLE ' . PMA_backquote($table)); ?>">
447 <?php echo $strAnalyzeTable; ?></a>&nbsp;
448 </td>
449 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
450 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE') . "\n";?>
451 </td>
452 </tr>
453 <?php
455 echo "\n";
456 if ($tbl_type == 'MYISAM') {
458 <tr>
459 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
460 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('REPAIR TABLE ' . PMA_backquote($table)); ?>">
461 <?php echo $strRepairTable; ?></a>&nbsp;
462 </td>
463 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
464 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE') . "\n"; ?>
465 </td>
466 </tr>
467 <?php
469 echo "\n";
470 if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
472 <tr>
473 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
474 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>">
475 <?php echo $strOptimizeTable; ?></a>&nbsp;
476 </td>
477 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
478 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE') . "\n"; ?>
479 </td>
480 </tr>
481 <?php
483 echo "\n";
485 <?php
486 } // end MYISAM or BERKELEYDB case
487 echo "\n";
489 <tr>
490 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
491 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('FLUSH TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenFlushed, htmlspecialchars($table))); if ($cfg['ShowTooltip']) echo '&amp;reload=1'; ?>">
492 <?php echo $strFlushTable; ?></a>&nbsp;
493 </td>
494 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
495 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?>
496 </td>
497 </tr>
499 <?php
500 // Referential integrity check
501 // The Referential integrity check was intended for the non-InnoDB
502 // tables for which the relations are defined in pmadb
503 // so I assume that if the current table is InnoDB, I don't display
504 // this choice (InnoDB maintains integrity by itself)
506 if ($cfgRelation['relwork'] && $tbl_type != "INNODB") {
508 // we need this PMA_DBI_select_db if the user has access to more than one db
509 // and $db is not the last of the list, because PMA_availableDatabases()
510 // has made a PMA_DBI_select_db() on the last one
511 PMA_DBI_select_db($db);
512 $foreign = PMA_getForeigners($db, $table);
514 if ($foreign) {
516 <!-- Referential integrity check -->
517 <tr>
518 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2">
519 <?php echo $strReferentialIntegrity; ?><br />
520 <?php
521 echo "\n";
522 foreach ($foreign AS $master => $arr) {
523 $join_query = 'SELECT ' . PMA_backquote($table) . '.* FROM '
524 . PMA_backquote($table) . ' LEFT JOIN '
525 . PMA_backquote($arr['foreign_table']);
526 if ($arr['foreign_table'] == $table) {
527 $foreign_table = $table . '1';
528 $join_query .= ' AS ' . PMA_backquote($foreign_table);
529 } else {
530 $foreign_table = $arr['foreign_table'];
532 $join_query .= ' ON '
533 . PMA_backquote($table) . '.' . PMA_backquote($master)
534 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
535 . ' WHERE '
536 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
537 . ' IS NULL AND '
538 . PMA_backquote($table) . '.' . PMA_backquote($master)
539 . ' IS NOT NULL';
540 echo ' '
541 . '<a href="sql.php?' . $url_query
542 . '&amp;sql_query='
543 . urlencode($join_query)
544 . '">' . $master . '&nbsp;->&nbsp;' . $arr['foreign_table'] . '.' . $arr['foreign_field']
545 . '</a><br />' . "\n";
546 unset($foreign_table);
547 unset($join_query);
548 } // end while
550 </td>
551 </tr>
552 <?php
553 } // end if ($result)
554 echo "\n";
556 } // end if (!empty($cfg['Server']['relation']))
558 </table>
559 <?php
562 * Displays the footer
564 echo "\n";
565 require_once('./footer.inc.php');