Help! Major array issues...
Posted: Fri Feb 28, 2003 12:43 pm
So I've been trying to get this array working for a few days and I'm not having any luck at all. I'm a cold fusion programmer discovering PHP and I haven't been able to find a good resource on arrays for PHP. Does anyone have any good sources. The php.net explnations seem to be a little to cryptic for me.
The code I'm using is below if anyone has any other ideas. Im trying to load a sort order variable into an array so i can loop through the update statement when new values have been selected from the sort drop downs...
I hope that makes sense...thanks
The code I'm using is below if anyone has any other ideas. Im trying to load a sort order variable into an array so i can loop through the update statement when new values have been selected from the sort drop downs...
Code: Select all
<?php if ($update == "true") echo print_r($sortlist);
//array loop will go here and update the database once i figure it out
//mysql_query("UPDATE PAGE_CONTENT SET
// SORT = '$sort'
// WHERE CONTENT_ID=$content_id")
// or die ('could not update');
?>
<form action="index.php?fuseaction=admin_company.sort&page_id=<?php echo "$page_id";?>&update=true" method="post">
<?php
//grab the content and loop through order by the sort column
$Result = mysql_query("SELECT * FROM PAGE_CONTENT WHERE PAGE_ID=$page_id order by SORT");
while ($Row = mysql_fetch_row($Result))
//output the content
{
if (strlen($Rowї2]) > 0 ) echo "<h1>$Rowї2]</h1>";
if (strlen($Rowї3]) > 0 ) echo "<h2>$Rowї3]</h2>";
if (strlen($Rowї4]) > 0 ) echo "<p>$Rowї4]</p>";
if (strlen($Rowї5]) > 0 ) echo"<img src="uploads/$Rowї5]" border=0 alt="Rowї8]"></a><br><br>";
if ($Rowї6] <> "") echo "<a href="$Rowї6]" target="_new"><font class=boxtext>more >></font></a><br>";
if ($Rowї7] <> "") echo "<a mailto="$Rowї7]"><font class=boxtext>$Rowї7]</font></a><br>";
echo"<input type="hidden" name="content_id" value="$Rowї0]">";
$sort=$Rowї14];
$mylist=$Rowї0];
//load the sort order drop down
echo "<font class=data>sorted as:</font>
<select name="sort">";
$Result2 = mysql_query("SELECT SORT FROM PAGE_CONTENT WHERE PAGE_ID=$page_id");
while ($Row = mysql_fetch_row($Result2))
{
print"<option value="$Rowї0]" "; if ($Rowї0] == $sort) echo "selected"; echo">$Rowї0]</option>";
}
echo"</select> <br><br>";
//load the array to pass to the update statement
$sortlistї]= array($sort);
//output the array for testing purposes as it is being loadded
echo print_r($sortlist);
}
//load the hidden field with array values
echo "<input type="hidden" name="real_list" value="";echo $sortlist; echo"">";
?>