PHP error  Notice Undefined offset

Posted on 2006-04-21
Last Modified: 2008-01-09

I have this code and it is working on a server from profider A, when I copy the files to an other profider it gives this error:
"Notice: Undefined offset: 1 in c:\hosting\webhost4life\member\netvanhagen\leasewebsite\sk_php\public_html\subcat.php on line 30"

Line 30 is:
$row[3] = $split[1];

This is a part of the script:
$cols = 3;
$rows = $num / $cols;
for ($i=0;$i<$rows;$i++) {
      echo "</tr>";
      for ($ie=0;$ie<$cols;$ie++) {
            echo "<td class=\"standard\">";
            if ($row = mysql_fetch_row($query)) {
                  if ($row[3] == "none") {
                        $img = "<img src=\"images/na.jpg\" border=\"0\">";
                  } else {
                        $split = explode("../", $row[3]);
                        $row[3] = $split[1];
                        $img = "<img src=\"$row[3]\" border=\"0\">";
                  echo "</tr><tr>";
                  echo '<td border="0" cellpadding="0" cellspacing="0" style="width:220px;height:25px;background-color:#FE9900;text-align:center; vertical-align:middle;" valign="middle"><a  href="articles.php?sid='.htmlspecialchars($row[0]).'" class="product">'.htmlspecialchars($row[2]).'</a><br>'."\n";
                  echo "<br>";
            } else {
                  echo "&nbsp;";
            echo "</td>\n";
      echo "<tr>";      

What is wronge???

Question by:WvR
    LVL 49

    Accepted Solution

    Isn't it easier to use:

    $split = explode("../", $row[3]);
                        $row[3] = $split[1];

    $row[3] = preg_replace('#^../#','',$row[3]);

    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
       $row[3] = $split[sizeof($split)];
    LVL 1

    Author Comment

    Thanks, this is it!!

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now