zgkhoo Posted October 22, 2007 Share Posted October 22, 2007 <?php session_start(); include 'config.php'; include 'opendb.php'; function space($max_len){ for ($count = 1; $count <= $max_len; $count ++){ echo " "; } } $result = mysql_query("SELECT * FROM gamecard") or die('Query failed: ' . mysql_error()); $numrows=mysql_num_rows($result); echo "numrows=".$numrows; echo "y"; echo "<select name='test_list[]' size='"; echo $numrows; echo " ' multiple>"; //can't test the echo command fr here as start fr here is in a list, to echo something, need to start with <option> while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ //echo "serial".$_SESSION["serial"]; /*$_SESSION["serial"]=$row['Serialnum']; $_SESSION["acode"]=$row['Activatecode']; $_SESSION["crd_status"]=$row['Status']; $_SESSION["crd_point"]=$row['Point']; $_SESSION["expire"]=$row['Expireddate']; $_SESSION["owner"]=$row['Ownerid']; $_SESSION["left"]=$row['Downleft']; $_SESSION["right"]=$row['Downright']; $_SESSION["upline"]=$row['Upline']; $_SESSION["create"]=$row['Createdate']; $_SESSION["golden"]=$row['Golden'];*/ $serial=$row['Serialnum']; $serial=strval($serial); $serial_len=strlen($serial); if($serial_len<=10){ $serial_len=10-$serial_len; } $owner=$row['Ownerid']; if (empty($owner)) $owner="Null"; $owner=strval($owner); $owner_len=strlen($owner); if($owner_len<=10){ $owner_len=10-$owner_len; } $acode=$row['Activatecode']; $acode=strval($acode); $acode_len=strlen($acode); if($acode_len<=13){ $acode_len=13-$acode_len; } $crd_status=$row['Status']; if (empty($crd_status)) $crd_status="Null"; $crd_status=strval($crd_status); $status_len=strlen($crd_status); if($status_len<=10) $status_len=10-$status_len; $crd_point=$row['Point']; // if(empty($crd_point)) // $crd_point="Null"; $crd_point=strval($crd_point); $point_len=strlen($crd_point); if($point_len<=6) $point_len=6-$point_len; //assume that the len shld be same for any date $create=$row['Createdate']; $expire=$row['Expireddate']; $left=$row['Downleft']; if(empty($left)) $left="Null"; $left=strval($left); $left_len=strlen($left); if($left_len<=10){ $left_len=10-$left_len; } $right=$row['Downright']; if(empty($right)) $right="Null"; $right=strval($right); $right_len=strlen($right); if($right_len<=10){ $right_len=10-$right_len; } $upline=$row['Upline']; if(empty($upline)) $upline="Null"; $upline=strval($upline); $upline_len=strlen($upline); if($upline_len<=10){ $upline_len=10-$upline_len; } $golden=$row['Golden']; $golden=strval($golden); $golden_len=strlen($golden); if($golden_len<=10){ $golden_len=10-$golden_len; } echo"<tr>";//testing echo "<td>"; echo "<option>"; echo $serial; echo " "; space($serial_len); echo $owner; echo "   "; space($owner_len); echo "</td>"; echo"</tr>";//testing echo $crd_status; echo " "; space($status_len); echo $crd_point; echo " "; space($point_len); echo $create; echo " "; echo $expire; echo " "; echo $upline; echo " "; space($upline_len); /*for ($count = 1; $count <= $upline_len; $count ++){ echo "nbsp;nbsp;"; }*/ echo $left; echo " "; space($left_len); echo $right; echo " "; space($right_len); echo $golden; echo " "; space($golden_len); echo $acode; // echo " "; echo "</option><br>"; } echo "</select>"; ?> Alignment running the record wont show in correct alignment way. ,and how to write highlight and delete for this data grid? eg when user click the record in the list, then can click"delete" button to delete the record and also click "edit" then can edit the record in the list. any tutorial available for this? thanks n regards, Quote Link to comment https://forums.phpfreaks.com/topic/74301-alignment-runningand-how-to-write-highlight-and-delete-for-this-data-grid/ Share on other sites More sharing options...
zgkhoo Posted October 22, 2007 Author Share Posted October 22, 2007 the screen of sample ...alignment not accurate Quote Link to comment https://forums.phpfreaks.com/topic/74301-alignment-runningand-how-to-write-highlight-and-delete-for-this-data-grid/#findComment-375467 Share on other sites More sharing options...
zgkhoo Posted October 22, 2007 Author Share Posted October 22, 2007 *bump* Quote Link to comment https://forums.phpfreaks.com/topic/74301-alignment-runningand-how-to-write-highlight-and-delete-for-this-data-grid/#findComment-375835 Share on other sites More sharing options...
dbo Posted October 22, 2007 Share Posted October 22, 2007 Why would you try to write a function to set spaces instead of putting the thing inside of a table? Something like... $query = "SELECT * FROM sometable"; $result = mysql_query($query); $rows = mysql_num_rows($result); $fields = mysql_num_fields($result); echo "<table>"; for( $i = 0; $i < $rows; ++$i ) { $row = mysql_fetch_assoc($result); echo "<tr>"; for( $j = 0; $j < $fields; ++$j ) { echo "<td>"; echo $row[$j]; echo "</td>"; } echo "</tr>"; } echo "</table>"; Quote Link to comment https://forums.phpfreaks.com/topic/74301-alignment-runningand-how-to-write-highlight-and-delete-for-this-data-grid/#findComment-375838 Share on other sites More sharing options...
zgkhoo Posted October 23, 2007 Author Share Posted October 23, 2007 cos i wanna "CLICK and HIGHLIGHT" the row of record,and later on "CLICK HIGHLIGHT and DELETE" if i put inside <table></table> then how to "CLICK and HIGHLIGHT", thanks Quote Link to comment https://forums.phpfreaks.com/topic/74301-alignment-runningand-how-to-write-highlight-and-delete-for-this-data-grid/#findComment-375864 Share on other sites More sharing options...
zgkhoo Posted October 24, 2007 Author Share Posted October 24, 2007 *bump* Quote Link to comment https://forums.phpfreaks.com/topic/74301-alignment-runningand-how-to-write-highlight-and-delete-for-this-data-grid/#findComment-377034 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.