|
|
 |
RE: FN-FORUM: PHP/MYsql Issue
date posted 4th January 2005 18:43
You ought to initialise your $array before you start populating it, as I
suspect that it is failing to add any values to it. If you don't initialise
is with
$array = array();
then it will not exist as an array type for your argument later on. If that
removes the error message then you can add some echo statements further up
to trace the population loop and see where the problem is.
Adam
-----Original Message-----
From: [EMAIL REMOVED] [EMAIL REMOVED] Behalf Of Gavin
Cotton
Sent: 04 January 2005 19:42
To: FN-FORUM / [EMAIL REMOVED]
Subject: FN-FORUM: PHP/MYsql Issue
My testing server is running the following:
Apache: 2.0.49 (Win32)
PHP: 4.3.7
MySql: 3.23.49
My host is running the following:
Apache: 1.3.28 (Unix)
PHP: 4.3.10
MySql: 4.0.12
The following works perfectly on my testing system, but on my host I get
the error below:
this is the code that gets the two sets of data from the database and
the second query populates that array:
mysql_select_db($database_neaconnect, $neaconnect);
$query_populate = "SELECT StyleID, Style FROM liststyles ORDER BY Style
ASC";
$populate = mysql_query($query_populate, $neaconnect) or die(mysql_error());
$row_populate = mysql_fetch_assoc($populate);
$totalRows_populate = mysql_num_rows($populate);
$colname_memberstyles = "1";
if (isset($HTTP_SESSION_VARS['memberid'])){
if (get_magic_quotes_gpc()){
$colname_memberstyles = $HTTP_SESSION_VARS['memberid'];
} else {
$colname_memberstyles = addslashes($HTTP_SESSION_VARS['memberid']);
}
}
mysql_select_db($database_neaconnect, $neaconnect);
$query = "SELECT * FROM `membersstyles` WHERE `memberid`='" .
$colname_memberstyles . "'";
$memberstyles = mysql_query($query, $neaconnect) or die (mysql_error());
$totalRows_memberstyles = mysql_num_rows($memberstyles);
while ($row_memberstyles = mysql_fetch_assoc($memberstyles)){
$array[] = $row_memberstyles['selstyles'];
}
$count = count($array);
The following code is in a loop further down the page that as you can
see displays several checkboxes with the values from the first database
query and then checks to see if that velue is in the array, if it is, it
cheks the box:
|
 |
|