peehaichpee Posted February 2, 2012 Share Posted February 2, 2012 if I'm outputting from mysql with this: // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("test") or die(mysql_error()) ; //Retrieves data from MySQL $data = mysql_query("SELECT * FROM tickets") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<b>asset number:</b> ".$info['AssetNumber'] . "<br> "; Echo "<b>subject:</b> ".$info['subject'] . " <br>"; Echo "<b>notes:</b> ".$info['Notes'] . " <hr>"; } can I base the record it outputs somehow on this: $value=""; $value = ProcessLargeText(GetData($data,"Asset Number", ""),"","",MODE_VIEW); if($mainTableOwnerID=="Asset Number") $ownerIdValue=$value; $xt->assign("Asset_Number_value",$value); if(!$pageObject->isAppearOnTabs("Asset Number")) $xt->assign("Asset_Number_fieldblock",true); else $xt->assign("Asset_Number_tabfieldblock",true); It's kind of like a job history so its getting records of job history from one table while the second piece of code is getting the asset details from a main table Quote Link to comment https://forums.phpfreaks.com/topic/256234-basing-one-mysql-output-from-current-table/ Share on other sites More sharing options...
trq Posted February 2, 2012 Share Posted February 2, 2012 You could do it that way, but it isn't how it should be done. You should read this: http://www.phpfreaks.com/tutorial/data-joins-unions Quote Link to comment https://forums.phpfreaks.com/topic/256234-basing-one-mysql-output-from-current-table/#findComment-1313630 Share on other sites More sharing options...
peehaichpee Posted February 2, 2012 Author Share Posted February 2, 2012 the trouble is I'm modifying existing code and the array has been arranged like so: $fieldsArr = array(); $arr = array(); $arr['fName'] = "Asset Number"; $arr['viewFormat'] = ViewFormat("Asset Number", $strTableName); $fieldsArr[] = $arr; $arr = array(); $arr['fName'] = "Asset Description"; $arr['viewFormat'] = ViewFormat("Asset Description", $strTableName); so what I want to do is add a table at the bottom with my SQL statement to only show matching records based on that asset number on this page.... is that possible with the way the array has been done? Quote Link to comment https://forums.phpfreaks.com/topic/256234-basing-one-mysql-output-from-current-table/#findComment-1313793 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.