-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
  • 15
  • 21
-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
  • 31,815
  • 47
  • 169
  • 296
ashishmaurya
  • 1,186
  • 9
  • 17