I want the form to be in the first row but the table is using while loop so how do I make the form in the first row
$count = 0;
while($count < $queryRow){
while($infoRow = tep_fetch_object($qryRow)){
$p = 1;
echo '<tr><td>';
if($infoRow->axle_tire_count == 4){
echo'<div id="fourTire" style="display: flex;">';
if($infoRow->axle_tire_one == 0){
echo'
<div id="tirechange1'.$p.'" data-tire="tirechange1'.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_one."'"));
echo '<div id="tirechange1'.$p.'" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange1'.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
}else {
echo'<div id="twoTire" style="display: flex;">';
if($infoRow->axle_tire_one == 0){
echo '
<div id="tirechange1'.$p.$p.'" style="margin-left:50px;" data-tire="tirechange1'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_one."'"));
echo '<div id="tirechange1'.$p.$p.'" style="margin-left:50px;" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange1'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
if($infoRow->axle_tire_four == 0){
echo '
<div id="tirechange2'.$p.$p.'" style="margin-left:170px;" data-tire="tirechange2'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire4\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_four."'"));
echo'
<div id="tirechange2'.$p.$p.'" style="margin-left:170px;" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange2'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire4\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
}
echo '</td>';
$count ;
}
echo '
<td style="text-align:center;">
<label style="margin-top:20px;width:30%;">Serial Number:<span style="color: red;">*</span></label><input type="text" oninput="this.value = this.value.toUpperCase()" id="create_serial_number" name="create_serial_number" required style="width:40%;"> <br> <br>
<label style="width:30%;">Tire Condition:</label><select name="create_tire_condition" id="create_tire_condition" required disabled="disabled" style="background-color:lightyellow;width:40%;"><option value="" disabled selected hidden>- Please Select Condition -</option></select> <br> <br>
<label style="margin-left:44px;width:22%;">Brand:</label><select name="create_tire_brand" id="create_tire_brand" required disabled="disabled" style="background-color:lightyellow;width:40%;"><option value="" disabled selected hidden>- Please Select Brand -</option></select> <br> <br>
<label style="margin-left:44px;width:22%;">Model:</label><input type="text" id="create_model" name="create_model" required disabled="disabled" style="background-color:lightyellow;width:40%;"> <br> <br>
<label style="margin-left:47px;width:22%;">Price:</label><input type="number" id="create_price" name="create_price" required disabled="disabled" style="background-color:lightyellow;width:40%;" step="0.01" placeholder="0.00"> <br> <br>
<label style="margin-left:-36px;width:37%;">Manufacturing Date:</label><input type="week" id="create_manufacturing" name="create_manufacturing" disabled="disabled" required style="background-color:lightyellow;width:40%;"> <br> <br>
<label style="margin-left:-35px;width:37%;">Thread Depth Date:</label><input type="date" id="create_tread" name="create_tread" required disabled="disabled" style="background-color:lightyellow;width:40%;"> <br> <br>
<a data-toggle=\'modal\' data-id=\''.$infoRow->branch_id.'\' style="margin-left:50px;margin-top:10px;margin-bottom:5px;" href=\'#frmEdit\' class=\'btn frmEdit btn-default btn-sm header-btn\'>Update</a>
</td>
';
CodePudding user response:
just move it inside your while and check if it's your first iteration (if ($count == 0) hard to help w/o a working example.
$count = 0;
while($count < $queryRow){
while($infoRow = tep_fetch_object($qryRow)){
$p = 1;
echo '<tr><td>';
if($infoRow->axle_tire_count == 4){
echo'<div id="fourTire" style="display: flex;">';
if($infoRow->axle_tire_one == 0){
echo'
<div id="tirechange1'.$p.'" data-tire="tirechange1'.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_one."'"));
echo '<div id="tirechange1'.$p.'" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange1'.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
}else {
echo'<div id="twoTire" style="display: flex;">';
if($infoRow->axle_tire_one == 0){
echo '
<div id="tirechange1'.$p.$p.'" style="margin-left:50px;" data-tire="tirechange1'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_one."'"));
echo '<div id="tirechange1'.$p.$p.'" style="margin-left:50px;" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange1'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
if($infoRow->axle_tire_four == 0){
echo '
<div id="tirechange2'.$p.$p.'" style="margin-left:170px;" data-tire="tirechange2'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire4\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_four."'"));
echo'
<div id="tirechange2'.$p.$p.'" style="margin-left:170px;" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange2'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire4\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
}
if ($count == 0) {
echo '
<td style="text-align:center;">
<label style="margin-top:20px;width:30%;">Serial Number:<span style="color: red;">*</span></label><input type="text" oninput="this.value = this.value.toUpperCase()" id="create_serial_number" name="create_serial_number" required style="width:40%;"> <br> <br>
<label style="width:30%;">Tire Condition:</label><select name="create_tire_condition" id="create_tire_condition" required disabled="disabled" style="background-color:lightyellow;width:40%;"><option value="" disabled selected hidden>- Please Select Condition -</option></select> <br> <br>
<label style="margin-left:44px;width:22%;">Brand:</label><select name="create_tire_brand" id="create_tire_brand" required disabled="disabled" style="background-color:lightyellow;width:40%;"><option value="" disabled selected hidden>- Please Select Brand -</option></select> <br> <br>
<label style="margin-left:44px;width:22%;">Model:</label><input type="text" id="create_model" name="create_model" required disabled="disabled" style="background-color:lightyellow;width:40%;"> <br> <br>
<label style="margin-left:47px;width:22%;">Price:</label><input type="number" id="create_price" name="create_price" required disabled="disabled" style="background-color:lightyellow;width:40%;" step="0.01" placeholder="0.00"> <br> <br>
<label style="margin-left:-36px;width:37%;">Manufacturing Date:</label><input type="week" id="create_manufacturing" name="create_manufacturing" disabled="disabled" required style="background-color:lightyellow;width:40%;"> <br> <br>
<label style="margin-left:-35px;width:37%;">Thread Depth Date:</label><input type="date" id="create_tread" name="create_tread" required disabled="disabled" style="background-color:lightyellow;width:40%;"> <br> <br>
<a data-toggle=\'modal\' data-id=\''.$infoRow->branch_id.'\' style="margin-left:50px;margin-top:10px;margin-bottom:5px;" href=\'#frmEdit\' class=\'btn frmEdit btn-default btn-sm header-btn\'>Update</a>
</td>
';
}
echo '</td>';
$count ;
}
CodePudding user response:
try this:
$count = 0;
while($count < $queryRow){
while($infoRow = tep_fetch_object($qryRow)){
$p = 1;
echo '<tr><td>';
if($infoRow->axle_tire_count == 4){
echo'<div id="fourTire" style="display: flex;">';
if($infoRow->axle_tire_one == 0){
echo'
<div id="tirechange1'.$p.'" data-tire="tirechange1'.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_one."'"));
echo '<div id="tirechange1'.$p.'" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange1'.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
}else {
echo'<div id="twoTire" style="display: flex;">';
if($infoRow->axle_tire_one == 0){
echo '
<div id="tirechange1'.$p.$p.'" style="margin-left:50px;" data-tire="tirechange1'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_one."'"));
echo '<div id="tirechange1'.$p.$p.'" style="margin-left:50px;" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange1'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire1\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
if($infoRow->axle_tire_four == 0){
echo '
<div id="tirechange2'.$p.$p.'" style="margin-left:170px;" data-tire="tirechange2'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-tire-num= \'tire4\' data-toggle=\'modal\' href=\'#SearchList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
else{
$query3 = tep_fetch_object(tep_query("SELECT * FROM nano_tire WHERE tire_id = '".$infoRow->axle_tire_four."'"));
echo'
<div id="tirechange2'.$p.$p.'" style="margin-left:170px;" data-serial="'.$query3->tire_serial_number.'" data-condition="'.$query3->tire_condition.'" data-brand="'.$query3->tire_brand.'" data-size="'.$query3->tire_size.'" data-model="'.$query3->tire_model.'" data-tire="tirechange2'.$p.$p.'" data-axle-id="'.$infoRow->axle_id.'" data-price="'.$query3->tire_price.'" data-manufacturing="'.$query3->tire_manufacturing.'" data-tread="'.$query3->tire_tread.'" data-tire-num= \'tire4\' data-toggle=\'modal\' href=\'#TireList\'"><br><br><br><br><br><br><br><br></div>
<br><br><br><br><br><br><br><br>';
}
}
echo '</td>';
if($count === 0){
echo '
<td style="text-align:center;">
<label style="margin-top:20px;width:30%;">Serial Number:<span style="color: red;">*</span></label><input type="text" oninput="this.value = this.value.toUpperCase()" id="create_serial_number" name="create_serial_number" required style="width:40%;"> <br> <br>
<label style="width:30%;">Tire Condition:</label><select name="create_tire_condition" id="create_tire_condition" required disabled="disabled" style="background-color:lightyellow;width:40%;"><option value="" disabled selected hidden>- Please Select Condition -</option></select> <br> <br>
<label style="margin-left:44px;width:22%;">Brand:</label><select name="create_tire_brand" id="create_tire_brand" required disabled="disabled" style="background-color:lightyellow;width:40%;"><option value="" disabled selected hidden>- Please Select Brand -</option></select> <br> <br>
<label style="margin-left:44px;width:22%;">Model:</label><input type="text" id="create_model" name="create_model" required disabled="disabled" style="background-color:lightyellow;width:40%;"> <br> <br>
<label style="margin-left:47px;width:22%;">Price:</label><input type="number" id="create_price" name="create_price" required disabled="disabled" style="background-color:lightyellow;width:40%;" step="0.01" placeholder="0.00"> <br> <br>
<label style="margin-left:-36px;width:37%;">Manufacturing Date:</label><input type="week" id="create_manufacturing" name="create_manufacturing" disabled="disabled" required style="background-color:lightyellow;width:40%;"> <br> <br>
<label style="margin-left:-35px;width:37%;">Thread Depth Date:</label><input type="date" id="create_tread" name="create_tread" required disabled="disabled" style="background-color:lightyellow;width:40%;"> <br> <br>
<a data-toggle=\'modal\' data-id=\''.$infoRow->branch_id.'\' style="margin-left:50px;margin-top:10px;margin-bottom:5px;" href=\'#frmEdit\' class=\'btn frmEdit btn-default btn-sm header-btn\'>Update</a>
</td>
';
}
echo '</tr>';
$count ;
}