Error Buddy
Do you have an error message from your application? Then find the answer with Error Buddy. You can search over 40000 source code files and troubleshooting documents using our beta lucene/nutch search interface or if you prefer, search as normal using google. With LXR technology you can drill right down into the line of source code where it came from with full cross-referencing.
If after searching you didn't get your ideal answer, or you are still unclear what the error means, you can choose to post that question to the community forums following the link included in the search results.
[1.6]001 <?php 002 /* $Id: db_datadict.php,v 2.15 2004/10/08 11:14:06 garvinhicking Exp $ */ 003 004 005 /** 006 * Gets the variables sent or posted to this script, then displays headers 007 */ 008 if (!isset($selected_tbl)) { 009 require_once('./libraries/grab_globals.lib.php'); 010 require_once('./header.inc.php'); 011 } 012 013 014 /** 015 * Gets the relations settings 016 */ 017 require_once('./libraries/relation.lib.php'); 018 require_once('./libraries/transformations.lib.php'); 019 020 $cfgRelation = PMA_getRelationsParam(); 021 022 /** 023 * Check parameters 024 */ 025 PMA_checkParameters(array('db')); 026 027 /** 028 * Defines the url to return to in case of error in a sql statement 029 */ 030 if (isset($table)) { 031 $err_url = 'tbl_properties.php?' . PMA_generate_common_url($db, $table); 032 } else { 033 $err_url = 'db_details.php?' . PMA_generate_common_url($db); 034 } 035 036 if ($cfgRelation['commwork']) { 037 $comment = PMA_getComments($db); 038 039 /** 040 * Displays DB comment 041 */ 042 if (is_array($comment)) { 043 ?> 044 <!-- DB comment --> 045 <p><?php echo $strDBComment; ?> <i> 046 <?php echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?> 047 </i></p> 048 <?php 049 } // end if 050 } 051 052 /** 053 * Selects the database and gets tables names 054 */ 055 PMA_DBI_select_db($db); 056 $rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE); 057 058 $count = 0; 059 while ($row = PMA_DBI_fetch_assoc($rowset)) { 060 $myfieldname = 'Tables_in_' . htmlspecialchars($db); 061 $table = $row[$myfieldname]; 062 if ($cfgRelation['commwork']) { 063 $comments = PMA_getComments($db, $table); 064 } 065 066 if ($count != 0) { 067 echo '<div style="page-break-before: always;">' . "\n"; 068 } else { 069 echo '<div>' . "\n"; 070 } 071 072 echo '<h2>' . $table . '</h2>' . "\n"; 073 074 /** 075 * Gets table informations 076 */ 077 // The 'show table' statement works correct since 3.23.03 078 $result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE); 079 $showtable = PMA_DBI_fetch_assoc($result); 080 $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); 081 $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); 082 PMA_DBI_free_result($result); 083 084 085 /** 086 * Gets table keys and retains them 087 */ 088 089 PMA_DBI_select_db($db); 090 $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';'); 091 $primary = ''; 092 $indexes = array(); 093 $lastIndex = ''; 094 $indexes_info = array(); 095 $indexes_data = array(); 096 $pk_array = array(); // will be use to emphasis prim. keys in the table 097 // view 098 while ($row = PMA_DBI_fetch_assoc($result)) { 099 // Backups the list of primary keys 100 if ($row['Key_name'] == 'PRIMARY') { 101 $primary .= $row['Column_name'] . ', '; 102 $pk_array[$row['Column_name']] = 1; 103 } 104 // Retains keys informations 105 if ($row['Key_name'] != $lastIndex ){ 106 $indexes[] = $row['Key_name']; 107 $lastIndex = $row['Key_name']; 108 } 109 $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index']; 110 $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique']; 111 if (isset($row['Cardinality'])) { 112 $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality']; 113 } 114 // I don't know what does following column mean.... 115 // $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; 116 117 $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; 118 119 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; 120 if (isset($row['Sub_part'])) { 121 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part']; 122 } 123 124 } // end while 125 if ($result) { 126 PMA_DBI_free_result($result); 127 } 128 129 130 /** 131 * Gets fields properties 132 */ 133 $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE); 134 $fields_cnt = PMA_DBI_num_rows($result); 135 // Check if we can use Relations (Mike Beck) 136 if (!empty($cfgRelation['relation'])) { 137 // Find which tables are related with the current one and write it in 138 // an array 139 $res_rel = PMA_getForeigners($db, $table); 140 141 if (count($res_rel) > 0) { 142 $have_rel = TRUE; 143 } else { 144 $have_rel = FALSE; 145 } 146 } 147 else { 148 $have_rel = FALSE; 149 } // end if 150 151 152 /** 153 * Displays the comments of the table if MySQL >= 3.23 154 */ 155 if (!empty($show_comment)) { 156 echo $strTableComments . ': ' . $show_comment . '<br /><br />'; 157 } 158 159 /** 160 * Displays the table structure 161 */ 162 ?> 163 164 <!-- TABLE INFORMATIONS --> 165 <table width="100%" style="border: 1px solid black; border-collapse: collapse; background-color: white;"> 166 <tr> 167 <th width="50"><?php echo $strField; ?></th> 168 <th width="80"><?php echo $strType; ?></th> 169 <!--<th width="50"><?php echo $strAttr; ?></th>--> 170 <th width="40"><?php echo $strNull; ?></th> 171 <th width="70"><?php echo $strDefault; ?></th> 172 <!--<th width="50"><?php echo $strExtra; ?></th>--> 173 <?php 174 echo "\n"; 175 if ($have_rel) { 176 echo ' <th>' . $strLinksTo . '</th>' . "\n"; 177 } 178 if ($cfgRelation['commwork']) { 179 echo ' <th>' . $strComments . '</th>' . "\n"; 180 } 181 if ($cfgRelation['mimework']) { 182 echo ' <th>MIME</th>' . "\n"; 183 } 184 ?> 185 </tr> 186 187 <?php 188 $i = 0; 189 while ($row = PMA_DBI_fetch_assoc($result)) { 190 $bgcolor = ($i % 2) ?$cfg['BgcolorOne'] : $cfg['BgcolorTwo']; 191 $i++; 192 193 $type = $row['Type']; 194 // reformat mysql query output - staybyte - 9. June 2001 195 // loic1: set or enum types: slashes single quotes inside options 196 if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) { 197 $tmp[2] = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1); 198 $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; 199 $type_nowrap = ''; 200 201 $binary = 0; 202 $unsigned = 0; 203 $zerofill = 0; 204 } else { 205 $binary = stristr($row['Type'], 'binary'); 206 $unsigned = stristr($row['Type'], 'unsigned'); 207 $zerofill = stristr($row['Type'], 'zerofill'); 208 $type_nowrap = ' nowrap="nowrap"'; 209 $type = preg_replace('@BINARY@i', '', $type); 210 $type = preg_replace('@ZEROFILL@i', '', $type); 211 $type = preg_replace('@UNSIGNED@i', '', $type); 212 if (empty($type)) { 213 $type = ' '; 214 } 215 } 216 $strAttribute = ' '; 217 if ($binary) { 218 $strAttribute = 'BINARY'; 219 } 220 if ($unsigned) { 221 $strAttribute = 'UNSIGNED'; 222 } 223 if ($zerofill) { 224 $strAttribute = 'UNSIGNED ZEROFILL'; 225 } 226 if (!isset($row['Default'])) { 227 if ($row['Null'] != '') { 228 $row['Default'] = '<i>NULL</i>'; 229 } 230 } else { 231 $row['Default'] = htmlspecialchars($row['Default']); 232 } 233 $field_name = htmlspecialchars($row['Field']); 234 echo "\n"; 235 ?> 236 <tr> 237 <td width=50 class='print' nowrap="nowrap"> 238 <?php 239 echo "\n"; 240 if (isset($pk_array[$row['Field']])) { 241 echo ' <u>' . $field_name . '</u> ' . "\n"; 242 } else { 243 echo ' ' . $field_name . ' ' . "\n"; 244 } 245 ?> 246 </td> 247 <td width="80" class="print"<?php echo $type_nowrap; ?>><?php echo $type; ?><bdo dir="ltr"></bdo></td> 248 <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>--> 249 <td width="40" class="print"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?> </td> 250 <td width="70" class="print" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?> </td> 251 <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?> </td>--> 252 <?php 253 echo "\n"; 254 if ($have_rel) { 255 echo ' <td class="print">'; 256 if (isset($res_rel[$field_name])) { 257 echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']); 258 } 259 echo ' </td>' . "\n"; 260 } 261 if ($cfgRelation['commwork']) { 262 echo ' <td class="print">'; 263 if (isset($comments[$field_name])) { 264 echo htmlspecialchars($comments[$field_name]); 265 } 266 echo ' </td>' . "\n"; 267 } 268 if ($cfgRelation['mimework']) { 269 $mime_map = PMA_getMIME($db, $table, true); 270 271 echo ' <td class="print">'; 272 if (isset($mime_map[$field_name])) { 273 echo htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])); 274 } 275 echo ' </td>' . "\n"; 276 } 277 ?> 278 </tr> 279 <?php 280 } // end while 281 PMA_DBI_free_result($result); 282 283 echo "\n"; 284 ?> 285 </table> 286 287 <?php 288 echo '</div>' . "\n"; 289 290 $count++; 291 } //ends main while 292 293 294 /** 295 * Displays the footer 296 */ 297 echo "\n"; 298 ?> 299 <script type="text/javascript" language="javascript1.2"> 300 <!-- 301 function printPage() 302 { 303 document.getElementById('print').style.visibility = 'hidden'; 304 // Do print the page 305 if (typeof(window.print) != 'undefined') { 306 window.print(); 307 } 308 document.getElementById('print').style.visibility = ''; 309 } 310 //--> 311 </script> 312 <?php 313 echo '<br /><br /> <input type="button" style="width: 100px; height: 25px;" id="print" value="' . $strPrint . '" onclick="printPage()">' . "\n"; 314 315 require_once('./footer.inc.php'); 316 ?> 317 <?php 318 /* $Id: db_datadict.php,v 2.15 2004/10/08 11:14:06 garvinhicking Exp $ */ 319 320 321 /** 322 * Gets the variables sent or posted to this script, then displays headers 323 */ 324 if (!isset($selected_tbl)) { 325 require_once('./libraries/grab_globals.lib.php'); 326 require_once('./header.inc.php'); 327 } 328 329 330 /** 331 * Gets the relations settings 332 */ 333 require_once('./libraries/relation.lib.php'); 334 require_once('./libraries/transformations.lib.php'); 335 336 $cfgRelation = PMA_getRelationsParam(); 337 338 /** 339 * Check parameters 340 */ 341 PMA_checkParameters(array('db')); 342 343 /** 344 * Defines the url to return to in case of error in a sql statement 345 */ 346 if (isset($table)) { 347 $err_url = 'tbl_properties.php?' . PMA_generate_common_url($db, $table); 348 } else { 349 $err_url = 'db_details.php?' . PMA_generate_common_url($db); 350 } 351 352 if ($cfgRelation['commwork']) { 353 $comment = PMA_getComments($db); 354 355 /** 356 * Displays DB comment 357 */ 358 if (is_array($comment)) { 359 ?> 360 <!-- DB comment --> 361 <p><?php echo $strDBComment; ?> <i> 362 <?php echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?> 363 </i></p> 364 <?php 365 } // end if 366 } 367 368 /** 369 * Selects the database and gets tables names 370 */ 371 PMA_DBI_select_db($db); 372 $rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE); 373 374 $count = 0; 375 while ($row = PMA_DBI_fetch_assoc($rowset)) { 376 $myfieldname = 'Tables_in_' . htmlspecialchars($db); 377 $table = $row[$myfieldname]; 378 if ($cfgRelation['commwork']) { 379 $comments = PMA_getComments($db, $table); 380 } 381 382 if ($count != 0) { 383 echo '<div style="page-break-before: always;">' . "\n"; 384 } else { 385 echo '<div>' . "\n"; 386 } 387 388 echo '<h2>' . $table . '</h2>' . "\n"; 389 390 /** 391 * Gets table informations 392 */ 393 // The 'show table' statement works correct since 3.23.03 394 $result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE); 395 $showtable = PMA_DBI_fetch_assoc($result); 396 $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); 397 $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); 398 PMA_DBI_free_result($result); 399 400 401 /** 402 * Gets table keys and retains them 403 */ 404 405 PMA_DBI_select_db($db); 406 $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';'); 407 $primary = ''; 408 $indexes = array(); 409 $lastIndex = ''; 410 $indexes_info = array(); 411 $indexes_data = array(); 412 $pk_array = array(); // will be use to emphasis prim. keys in the table 413 // view 414 while ($row = PMA_DBI_fetch_assoc($result)) { 415 // Backups the list of primary keys 416 if ($row['Key_name'] == 'PRIMARY') { 417 $primary .= $row['Column_name'] . ', '; 418 $pk_array[$row['Column_name']] = 1; 419 } 420 // Retains keys informations 421 if ($row['Key_name'] != $lastIndex ){ 422 $indexes[] = $row['Key_name']; 423 $lastIndex = $row['Key_name']; 424 } 425 $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index']; 426 $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique']; 427 if (isset($row['Cardinality'])) { 428 $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality']; 429 } 430 // I don't know what does following column mean.... 431 // $indexes_info[$row['Key_name']]['Packed'] = $row['Packed']; 432 433 $indexes_info[$row['Key_name']]['Comment'] = $row['Comment']; 434 435 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name']; 436 if (isset($row['Sub_part'])) { 437 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part']; 438 } 439 440 } // end while 441 if ($result) { 442 PMA_DBI_free_result($result); 443 } 444 445 446 /** 447 * Gets fields properties 448 */ 449 $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE); 450 $fields_cnt = PMA_DBI_num_rows($result); 451 // Check if we can use Relations (Mike Beck) 452 if (!empty($cfgRelation['relation'])) { 453 // Find which tables are related with the current one and write it in 454 // an array 455 $res_rel = PMA_getForeigners($db, $table); 456 457 if (count($res_rel) > 0) { 458 $have_rel = TRUE; 459 } else { 460 $have_rel = FALSE; 461 } 462 } 463 else { 464 $have_rel = FALSE; 465 } // end if 466 467 468 /** 469 * Displays the comments of the table if MySQL >= 3.23 470 */ 471 if (!empty($show_comment)) { 472 echo $strTableComments . ': ' . $show_comment . '<br /><br />'; 473 } 474 475 /** 476 * Displays the table structure 477 */ 478 ?> 479 480 <!-- TABLE INFORMATIONS --> 481 <table width="100%" style="border: 1px solid black; border-collapse: collapse; background-color: white;"> 482 <tr> 483 <th width="50"><?php echo $strField; ?></th> 484 <th width="80"><?php echo $strType; ?></th> 485 <!--<th width="50"><?php echo $strAttr; ?></th>--> 486 <th width="40"><?php echo $strNull; ?></th> 487 <th width="70"><?php echo $strDefault; ?></th> 488 <!--<th width="50"><?php echo $strExtra; ?></th>--> 489 <?php 490 echo "\n"; 491 if ($have_rel) { 492 echo ' <th>' . $strLinksTo . '</th>' . "\n"; 493 } 494 if ($cfgRelation['commwork']) { 495 echo ' <th>' . $strComments . '</th>' . "\n"; 496 } 497 if ($cfgRelation['mimework']) { 498 echo ' <th>MIME</th>' . "\n"; 499 } 500 ?> 501 </tr> 502 503 <?php 504 $i = 0; 505 while ($row = PMA_DBI_fetch_assoc($result)) { 506 $bgcolor = ($i % 2) ?$cfg['BgcolorOne'] : $cfg['BgcolorTwo']; 507 $i++; 508 509 $type = $row['Type']; 510 // reformat mysql query output - staybyte - 9. June 2001 511 // loic1: set or enum types: slashes single quotes inside options 512 if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) { 513 $tmp[2] = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1); 514 $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')'; 515 $type_nowrap = ''; 516 517 $binary = 0; 518 $unsigned = 0; 519 $zerofill = 0; 520 } else { 521 $binary = stristr($row['Type'], 'binary'); 522 $unsigned = stristr($row['Type'], 'unsigned'); 523 $zerofill = stristr($row['Type'], 'zerofill'); 524 $type_nowrap = ' nowrap="nowrap"'; 525 $type = preg_replace('@BINARY@i', '', $type); 526 $type = preg_replace('@ZEROFILL@i', '', $type); 527 $type = preg_replace('@UNSIGNED@i', '', $type); 528 if (empty($type)) { 529 $type = ' '; 530 } 531 } 532 $strAttribute = ' '; 533 if ($binary) { 534 $strAttribute = 'BINARY'; 535 } 536 if ($unsigned) { 537 $strAttribute = 'UNSIGNED'; 538 } 539 if ($zerofill) { 540 $strAttribute = 'UNSIGNED ZEROFILL'; 541 } 542 if (!isset($row['Default'])) { 543 if ($row['Null'] != '') { 544 $row['Default'] = '<i>NULL</i>'; 545 } 546 } else { 547 $row['Default'] = htmlspecialchars($row['Default']); 548 } 549 $field_name = htmlspecialchars($row['Field']); 550 echo "\n"; 551 ?> 552 <tr> 553 <td width=50 class='print' nowrap="nowrap"> 554 <?php 555 echo "\n"; 556 if (isset($pk_array[$row['Field']])) { 557 echo ' <u>' . $field_name . '</u> ' . "\n"; 558 } else { 559 echo ' ' . $field_name . ' ' . "\n"; 560 } 561 ?> 562 </td> 563 <td width="80" class="print"<?php echo $type_nowrap; ?>><?php echo $type; ?><bdo dir="ltr"></bdo></td> 564 <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>--> 565 <td width="40" class="print"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?> </td> 566 <td width="70" class="print" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?> </td> 567 <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?> </td>--> 568 <?php 569 echo "\n"; 570 if ($have_rel) { 571 echo ' <td class="print">'; 572 if (isset($res_rel[$field_name])) { 573 echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']); 574 } 575 echo ' </td>' . "\n"; 576 } 577 if ($cfgRelation['commwork']) { 578 echo ' <td class="print">'; 579 if (isset($comments[$field_name])) { 580 echo htmlspecialchars($comments[$field_name]); 581 } 582 echo ' </td>' . "\n"; 583 } 584 if ($cfgRelation['mimework']) { 585 $mime_map = PMA_getMIME($db, $table, true); 586 587 echo ' <td class="print">'; 588 if (isset($mime_map[$field_name])) { 589 echo htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])); 590 } 591 echo ' </td>' . "\n"; 592 } 593 ?> 594 </tr> 595 <?php 596 } // end while 597 PMA_DBI_free_result($result); 598 599 echo "\n"; 600 ?> 601 </table> 602 603 <?php 604 echo '</div>' . "\n"; 605 606 $count++; 607 } //ends main while 608 609 610 /** 611 * Displays the footer 612 */ 613 echo "\n"; 614 ?> 615 <script type="text/javascript" language="javascript1.2"> 616 <!-- 617 function printPage() 618 { 619 document.getElementById('print').style.visibility = 'hidden'; 620 // Do print the page 621 if (typeof(window.print) != 'undefined') { 622 window.print(); 623 } 624 document.getElementById('print').style.visibility = ''; 625 } 626 //--> 627 </script> 628 <?php 629 echo '<br /><br /> <input type="button" style="width: 100px; height: 25px;" id="print" value="' . $strPrint . '" onclick="printPage()">' . "\n"; 630 631 require_once('./footer.inc.php'); 632 ?> 633
Testing
