Reply to Re: Notice: Undefined index: Error

Your name:

Reply:


Posted by Jerry Stuckle on 04/25/07 12:03

jsgoodrich@gmail.com wrote:
> I am looking for some help if anyone can lend a hand.
>
> I have a simple php website that displays a table from my mysql
> database.
>
> To prep for my MCSE I moved my home server to Windows 2003 Standard, I
> installed mysql and php 5 to run some of my databases and websites.
>
> Under Linux the site worked fine, under windows I keep getting Notice
> Undefined Index error on line 67
>
> I have went back to the basics just pull the data then display and
> still get the same error.
>
> 60 $sql = "SELECT * from newschool ORDER BY State, CollNam";
> 61
> 62 $result = mysql_query($sql, $dbcnx) or die(mysql_error());
> 63 $number_of_rows = mysql_num_rows($result);
> 64
> 65 while ($newArray = mysql_fetch_array($result)) {
> 66
> 67 $id = $newArray['id'];
> 68 $testField = $newArray['testField'];
> 69
> 70 echo "The ID is $id and the text is $testField <br>";
>
>
> Anyone have any thoughts?
>

Don't worry about those who are telling you to use mysql_fetch_assoc().
Your code is just fine; the default for mysql_fetch_array() is to
fetch both numeric and associative indicies. It may just be a little
slower than mysql_fetch_assoc(), but you'll never notice the difference.

As for your problem - it looks like you don't have a column named 'id'
in the `newschool` table. Perhaps when you created the database here
you named it something else (or had a finger check)?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация