[PHP-DB] Array Trouble
Hi, I e-mailed this before, but the attachments didnt go through. I am designing something that my tech team can use to track the maintenancing of our school district computers. I have a table of data (formitems) that contains tasks that must be completed for that computer depending on the platform. I loaded the results from the apple.php form into an array ($item). I need to make a row ($makerow) then, assuming all of the proper columns are there, load each value in the array into its corresponding column in the database. For some reason, PHP is not returning the current value of the array, it is handing MySQL the whole array. Any help would be appreciated. -Tyler Web and Database Administrator East Valley School District function checkAll() { $sql = "SELECT * FROM FORMITEMS WHERE PLATFORM LIKE '%mac%' ORDER BY ID;"; $result = mysql_query($sql); while($list = mysql_fetch_array($result)) { echo "if(document.form.item$list[id].value == \"1\")\n{\ndocument.$list[id].value = \"2\";\n}\n"; } ?> } Apple - "; echo $id; echo "Location: "; echo odbc_result($row, "location"); echo " - "; echo odbc_result($row, "roomNo"); echo "Teacher: "; echo odbc_result($row, "teacher"); echo "Model: "; echo odbc_result($row, "modelNo"); echo "Serial: "; echo odbc_result($row, "serialNo"); echo "Mac Address: "; echo odbc_result($row, "macAddress"); echo "Drop: "; echo odbc_result($row, "dropID"); echo "OS: "; echo odbc_result($row, "OS"); echo "Processor: "; echo odbc_result($row, "processor"); echo ""; echo "Edit This Info"; ?> NotDone N/A Done $list[item]\n"; } ?> This computer is complete. Comments: "; if(odbc_result($row,"deviceType") != "1") { echo "This device is not a computer."; } else { //Make the row $makeRow = mysql_query("insert into maintenanceditems (id,comments,complete,user) values ('$id','$comments','$done','$LOGON_USER');") or die(mysql_error()); //If the computer was completed, insert the date. if($complete == "DONE") { mysql_query("update maintenanceditems set date = \"$today\""); } else { // echo "history.back(1);"; } //Update the row with the data from the radio buttons for(end($item);$item >= 0;prev($item)) { $current = current($item); mysql_query("update maintenanceditems set \"$current\" = \"$current\" where id = \"$id\";") or die(mysql_error()); } } echo "Computer Successfully Maintenanced"; include 'index.php'; ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Array trouble
On Friday 24 January 2003 14:18, Tyler Whitesides wrote: > I have been having a lot of trouble getting an array into the MySQL table > like I want it. This is supposed to take the current maintenance tasks > from a table in the database on apple.php each of these is given a name > $item[autoNo] where autoNo is the auto_increment id that task is associated > with. This is passed to data.php where it is supposed to make a row in the > maintenanceditems table, then in a loop directly below that it is supposed > to run the array and place each array value into its associated column in > the database. Considering all of the columns exist, I think the problem > just has to do with how I am pulling the array values out and placing them > into their column. Any help would be appreciated. Thanks in advance, Please post your code and DB schema. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Don't worry if you're a kleptomaniac; you can always take something for it. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Array trouble
Hi, I have been having a lot of trouble getting an array into the MySQL table like I want it. This is supposed to take the current maintenance tasks from a table in the database on apple.php each of these is given a name $item[autoNo] where autoNo is the auto_increment id that task is associated with. This is passed to data.php where it is supposed to make a row in the maintenanceditems table, then in a loop directly below that it is supposed to run the array and place each array value into its associated column in the database. Considering all of the columns exist, I think the problem just has to do with how I am pulling the array values out and placing them into their column. Any help would be appreciated. Thanks in advance, Tyler -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Array trouble
Hi, I have been having a lot of trouble getting an array into the MySQL table like I want it. This is supposed to take the current maintenance tasks from a table in the database on apple.php each of these is given a name $item[autoNo] where autoNo is the auto_increment id that task is associated with. This is passed to data.php where it is supposed to make a row in the maintenanceditems table, then in a loop directly below that it is supposed to run the array and place each array value into its associated column in the database. Considering all of the columns exist, I think the problem just has to do with how I am pulling the array values out and placing them into their column. Any help would be appreciated. Thanks in advance, Tyler -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php