PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old January 3rd, 2003, 12:44 AM
subduck subduck is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 subduck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP Notice Problem

Why do I get this notice? And is there any way to get rid of it?

Notice: Use of undefined constant option - assumed 'option' in c:\...etc

Here is the code:
Code:
<?php

$sql = MYSQL_QUERY('SELECT `option` FROM `settings` WHERE `type` = \ 'window\ ' ');
$p_window = MYSQL_FETCH_ARRAY($sql);

if ($p_window[option] == 1)  //error is on this line
{
  echo "window option is 1";
}

?>

Thanks for any help

Last edited by subduck : January 3rd, 2003 at 12:49 AM.

Reply With Quote
  #2  
Old January 3rd, 2003, 02:02 AM
hadley hadley is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 63 hadley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Use correct syntax: $p_window['option'], associative arrays are indexed by strings.

Hadley

Reply With Quote
  #3  
Old January 3rd, 2003, 05:18 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
you must be running your server on windows.

On windows servers when you have an array name, you must encase it in either ' or "

echo $array['name'];

on a linux server you dont need the ' or " but to be on the safe side, its still used.

when you dont have the ' or " it asumes, its either a number, variable or constant.

Reply With Quote
  #4  
Old January 3rd, 2003, 10:49 AM
subduck subduck is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 subduck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks guys that worked perfect

Last edited by subduck : January 3rd, 2003 at 11:57 AM.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP Notice Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway