Jump to content

Alignment running,and how to write highlight and delete for this data grid?


Recommended Posts

<?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 "    &nbsp ";
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,

 

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>";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.