Forum Moderators: coopster

Message Too Old, No Replies

converting mySQL 'text' type to PHP 'string'

when I try to call for this, I get a string in php that shows nothing

         

ghsrocketman

12:17 pm on Apr 8, 2009 (gmt 0)

10+ Year Member



I call for 'text' type in my mySQL database, save it as a variable. When I check to see how long the value is I get something less than 4 (goes through 'else' loop below). However, when I use the 'print' method, I see "Group001" in my internet browser. Any ideas?

$result = mysql_query("SELECT * FROM `room` WHERE RoomNumber = '3435'");

$row = mysql_fetch_array($result,MYSQL_ASSOC);
$groupID = $row{'GroupID'};
$groupID = (string)$groupID;
if (strlen($groupID) > 4){

header ("Location: [127.0.0.1:8800...] . "&text=" . urlencode("honk ".$groupID." honk"));
}
else{
header ("Location: [127.0.0.1:8800...] . "&text=" . urlencode("no value"));

}

I appreciate the help!
Thanks,
Matt

[edited by: coopster at 12:36 pm (utc) on April 8, 2009]
[edit reason] used loopback ip for example [/edit]

barns101

1:02 pm on Apr 8, 2009 (gmt 0)

10+ Year Member



I think you're using curly braces when square brackets should be used: $groupID = $row{'GroupID'}; should be $groupID = $row['GroupID'];