You are here: Array problem (MySQL/PHP) « All PHP « IT news, forums, messages
Array problem (MySQL/PHP)

Posted by BlackSpider on 10/04/06 00:25

<--PHP
function TableData($slot)
{
global $row_Recordset1, $colour_FREE, $colour_TOOK;

$slotuser = $row_Recordset1[$slot];
if ($slotuser == "") {
return ($colour_FREE.'" class="timeslot"><div
align="center">'.$slotuser );
}
else {
return ($colour_TOOK . '" class="timeslot"><div align="center">' .
$row_Recordset1[ $slot ]);
}

}
PHP-->

The $row_Recordset1 array is set by mysql_fetch_assoc to get some table
data, and I call this function with the table-row name (In this case
"date"), like this: TableData('date')

However, when trying to get the data of the row 'date' from the Record using
$slot, it returns a null string, regardless of what data is actually there.
If I replace $slot with 'date' in the code, it returns the correct value, so
the connection between php/Mysql is fine, but when trying to get the data by
using a String as the Key, it simply doesn' twork. Any ideas?

 

Navigation:

[Reply to this 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

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