-4

when the below code works I get the above mentioned error , what should i do ? please help me ...

<?php
 //session_start();
 include("dbconnect_database.php");
 $tname=$_GET['tn'];
 $cname=$_GET['cn'];
 $des=mysql_query("desc `$tname` `$cname`");
 $row=mysql_fetch_array($des);
 list($type, $b) = explode('[(]',$row[1]);
 list($size) = explode('[)]',$b);
 ?> 

2 Answers2

0

Try changing this:

list($type, $b) = explode('[(]',$row[1]);

to this:

list($type, $b) = explode('[(]',$row[0]);

UPDATE

The error is telling you that 1 is not a valid index for $row, so that is the problem. Just before that line, try var_dump($row). This will tell what the valid indexes for $row are, and you should be able to use that to fix your code.

Mark Miller
  • 7,442
  • 2
  • 16
  • 22
  • Thanks for your suggestion , but iam still getting the error message "Notice: Undefined offset: 1 in E:\xampp\htdocs\WPTC-PMS5-5-14\edit_column.php on line 12" – user3614697 May 08 '14 at 04:54
-1

there is no ' around table and column name

$des=mysql_query("desc $tname $cname");

sidenote: use mysqli_query instead of mysql because use of mysql is been deprecated

BenMorel
  • 34,448
  • 50
  • 182
  • 322
ashishmaurya
  • 1,196
  • 10
  • 18