[PHP] illegal string index

2001-02-28 Thread E. Uytterhoeven

Hi,

I made a site that uses the following code:

$id = base64_decode($go);// decoding ID
$DataBaseNaam = "teller";// name of DB
include('connect.inc.php3');// connection to DB
$query = "select * from kl".$id;//query
$result = mysql_db_query($DataBaseNaam, $query);// getting ResultSet
$t=0;
while ($waarden = mysql_fetch_array($result))// extracting ata from RS
   {
   $ip[$t] = $waarden[ip];// IP value (varchar) --
This line generates the problem..?
   $datum[$t] = $waarden[datum];// date value (integer)
   $urlprov[$t] = $waarden[urlprov];// URL value (varchar)
   $t++;
   }

On a locale machine (using PHP4) I didn't have any problems, but on internet
(using PHP 3.0.16) I got the warning "illegal string index on line ..." I
only get this warning if I want to extract IP numbers from my DB. Does
anyone knows why I get this warning ?

Thanks,

Eelco



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] illegal string index

2001-02-28 Thread Chris Lee

I usually put '' around my indexs if they are not numeric, sometimes I dont have to 
sometimes I do, so I allways do.

$ip[$t] = $waarden['ip'];

another note is check if there are any NULL entries in the 'ip' field in your db. if a 
field is NULL then php does not create that index. and you will get an undefined index 
error.

mysql alter table TABLE_NAME change VAR_NAME VAR_NAME varchar(255) NOT NULL ;

please email me if you have more questions or comments, I am interested in knowing how 
this works for you


-- 

 Chris Lee
 Mediawaveonline.com

 ph. 250.377.1095
 ph. 250.376.2690
 fx. 250.554.1120

 [EMAIL PROTECTED]



""E. Uytterhoeven"" [EMAIL PROTECTED] wrote in message 
97ir7c$e8v$[EMAIL PROTECTED]">news:97ir7c$e8v$[EMAIL PROTECTED]...
Hi,

I made a site that uses the following code:

$id = base64_decode($go);// decoding ID
$DataBaseNaam = "teller";// name of DB
include('connect.inc.php3');// connection to DB
$query = "select * from kl".$id;//query
$result = mysql_db_query($DataBaseNaam, $query);// getting ResultSet
$t=0;
while ($waarden = mysql_fetch_array($result))// extracting ata from RS
   {
   $ip[$t] = $waarden[ip];// IP value (varchar) --
This line generates the problem..?
   $datum[$t] = $waarden[datum];// date value (integer)
   $urlprov[$t] = $waarden[urlprov];// URL value (varchar)
   $t++;
   }

On a locale machine (using PHP4) I didn't have any problems, but on internet
(using PHP 3.0.16) I got the warning "illegal string index on line ..." I
only get this warning if I want to extract IP numbers from my DB. Does
anyone knows why I get this warning ?

Thanks,

Eelco



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]