Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Define constants

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Define constants

Postby Joli » Sat Sep 28, 2002 3:12 am

I got this problem after changing code to work with global variables off.

Notice: Use of undefined constant text1 - assumed 'text1'

while ($row = mysql_fetch_array($sql)) {
$row[text1]=ereg_replace("/(\015\012)|(\015)|(\012)/","<br>",$row[text1]);

How to define constants so I wont get that warning msg all the time..

/joli
Joli
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Sep 21, 2002 6:26 am

Postby Jay » Sat Sep 28, 2002 3:50 am

You don't need to know how constants work, PHP just thinks you're using a constant (and then can't find it).

Change every instance of $row[text1] to $row['text1'] and that should work!
Jay
 

thanks

Postby Joli » Sat Sep 28, 2002 4:31 am

:d silly me

works great
Thanks
Joli
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Sep 21, 2002 6:26 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.