Hi i need help coding...
Posted: Fri Nov 06, 2009 12:58 pm
i got this datatable where i want to pick stuffs from diffrent rows and to put them into strings
with everything ive tried sofar it dont work however ill post my recent code:
here im trying to get the diffrent rows within the datatable. there are currently 3 rows and in those rows i got 6 cells ( minus one being the id at start).
its the first opening of a datatable that i cant get to work maybe someone can see where the problem is?
- and the "error" that i got is that this comes up after the 4 first "cells"($Units1=$row1['Units']."' WHERE saved=1";$AtkArm1=$row1['AtkArm']."' WHERE saved=1";$Buyfor1=$row1['Buyfor']."' WHERE saved=1";$Sellfor1=$row1['Sellfor']."' WHERE saved=1";) i got this after that the content of the datatable is shown...' WHERE saved=1
the rest of them aint even showing only got this "error" message:
Notice: Undefined variable: Units2 in C:\Program Files\wamp\www\www\Projektarbete\sidor\Infanteries.php on line 117
but at line 117 i got this code
Dont even know if u can do this "open 2 datatables at the same time...
thanks in advance for any help i get
with everything ive tried sofar it dont work however ill post my recent code:
here im trying to get the diffrent rows within the datatable. there are currently 3 rows and in those rows i got 6 cells ( minus one being the id at start).
its the first opening of a datatable that i cant get to work maybe someone can see where the problem is?
- and the "error" that i got is that this comes up after the 4 first "cells"($Units1=$row1['Units']."' WHERE saved=1";$AtkArm1=$row1['AtkArm']."' WHERE saved=1";$Buyfor1=$row1['Buyfor']."' WHERE saved=1";$Sellfor1=$row1['Sellfor']."' WHERE saved=1";) i got this after that the content of the datatable is shown...' WHERE saved=1
the rest of them aint even showing only got this "error" message:
Notice: Undefined variable: Units2 in C:\Program Files\wamp\www\www\Projektarbete\sidor\Infanteries.php on line 117
but at line 117 i got this code
Code: Select all
<?php echo $Units2; ?>
Code: Select all
//first datatable (database)
<?php
include "../login/database.php"; //page to where the database setting is
$sql1="SELECT * FROM units"; //selecting all from DB "units" where saved_id is the same as in the array $id
$result1 = mysql_query($sql1) or die(mysql_error());//Välj all info i tall. //hämtar all info från tabell
while($row1 = mysql_fetch_array( $result1 )) //hämtar info från tabell.
{
$Units1=$row1['Units']."' WHERE saved=1";
$AtkArm1=$row1['AtkArm']."' WHERE saved=1";
$Buyfor1=$row1['Buyfor']."' WHERE saved=1";
$Sellfor1=$row1['Sellfor']."' WHERE saved=1";
}
while($row1 = mysql_fetch_array( $result1 )) //hämtar info från tabell.
{
$Units2=$row1['Units']."' WHERE saved=2";
$AtkArm2=$row1['AtkArm']."' WHERE saved=2";
$Buyfor2=$row1['Buyfor']."' WHERE saved=2";
$Sellfor2=$row1['Sellfor']."' WHERE saved=2";
}
while($row1 = mysql_fetch_array( $result1 )) //hämtar info från tabell.
{
$Units3=$row1['Units']."' WHERE saved=3";
$AtkArm3=$row1['AtkArm']."' WHERE saved=3";
$Buyfor3=$row1['Buyfor']."' WHERE saved=3";
$Sellfor3=$row1['Sellfor']."' WHERE saved=3";
}
?>
//new datatable (database)
<?php
$id =(isset($_GET['saved_id'])) ? (int)$_GET['saved_id'] : false;
if($id !== false) {
$sql="SELECT * FROM inventory WHERE saved_id=$id"; //selecting all from DB "Konto" where saved_id is the same as in the array $id
}
else
{
echo "NO saved_id!";
}
$result = mysql_query($sql) or die(mysql_error());//Välj all info i tall. //hämtar all info från tabell
while($row = mysql_fetch_array( $result )) //hämtar info från tabell.
{
$namn=$row['namn'];
}
?>