mc136
-
Posts
12 -
Joined
-
Last visited
Never
Posts posted by mc136
-
-
Hi I seem to manage to produce the info i need when not using a database. Being new to mysql could someone help in telling me how i should enter the following data into db.
$section['servicedesk']['batch'] = 8;
$section['servicedesk']['promo'] = 22;
$section['servicedesk']['ens'] = 2;
$section['status']['fmr'] = 16.00;
$section['status']['odw'] = 16.00;
print_r ($section);
returns the following:
Array ( [servicedesk] => Array ( [batch] => 8 [promo] => 22 [ens] => 2 ) [status] => Array ( [fmr] => 16 [odw] => 16 ) )
-
Hi thanks but when I run it it deleted oe of the columns (no big deal).
Need i do anything with the formpart <input.....>
$check = $_POST[$value_of_parent['qName']][$key_of_child]
cheers
-
hi nudie
what you asking??
the code you mentioned is part of a form.
-
Have used the following code but when coming to create the form i'm stuck as to what
to put into the S_POST
e.g. have tried $check = $_POST[$value_of_parent['qName'] . $key_of_child]
but this will not post anything to the database. Please help
echo "<td><input type='text' name='" . $value_of_parent['qName'] . "[" . $key_of_child . "]' size='1'></td>";
-
Hi I have the following piece of code which enters all data into a table and if all data entered will show green image or blue (and text box) if not. My problem is with creating a form basically don't know where to start. Ive tried but will only update the last text box. Any help please!! ???
while($Array = mysql_fetch_array($result, MYSQL_ASSOC)){
$arr[] = $Array;
}
echo "<pre style=\"text-align: left; font-size: 10px;\">";
print_r( $arr );
echo "</pre>";
foreach($arr as $key => $value){
echo "<tr><td><H1>" . $value['qName'] . "</td>";
foreach($value as $chk => $num){
if(preg_match("/^chk/",$chk) && $num >= "0"){
echo "<td><p>" . $num . "</td>";
}elseif(preg_match("/^chk/",$chk) && $num == ""){
echo "<td><input type='text' name='check1' size='1'></td>";
}
}
//----------test-works---------
if($value[chk1] == ""){
print "<td align='center'><img src=\"blue.jpg\" width=\"15\" height=\"15\" alt=\"description of the photo\"></img></td>";
}elseif($value[chk2] == ""){
print "<td align='center'><img src=\"blue.jpg\" width=\"15\" height=\"15\" alt=\"description of the photo\"></img></td>";
}else{
print "<td align='center'><img src=\"green.jpg\" width=\"15\" height=\"15\" alt=\"description of the photo\"></img></td>";
}
//----------end test------
}
-
hi
I have a table which pulls back info from db and populates table. I would like input boxes at the end of the rows to be able to input new data and then for the input boxes to move to the next column once the info has been entered.
e.g.
qName chk1 chk2 chk3 chk4 chk5
name1 8 7 3 input box
name2 23 5 1 input box
Currently pull back all info from db then have it print as follows:
print "<tr><td><H1>{$Array[qName]}</td>
<td align='center'><p>{$Array[chk1]} </td>
<td align='center'><p>{$Array[chk2]} </td>
</tr>";
Can i maybe expand on this to include the input boxes??
Any help would be grateful
chears
mc
-
and finally..
<?php
include("db_connect.inc");
$numfields = mysql_num_fields($result);
for ($i=0;$i<$numfields;$i++)
{
echo "<td>".mysql_field_name($result, $i).":</td>";
}
?> -
<?php
include ("db_connect.inc");
$result=@mysql_query("SELECT * FROM `test`");
$row=mysql_fetch_array($result,MYSQL_ASSOC);
print_r($row);
foreach($row as $key => $val)
{
echo $key;
echo "<br>";
}
echo $row[0];
-
note to self:
To do this, you should use mysql_fetch_array, or in many cases, mysql_fetch_assoc. The first one obtains an array where you can either use the column name, or a row number. Since I don't think in numbers, I use the second one, which only obtains an array of the column names. More info: -
thanks for the input. when trying this it pulls back what is in the row (nice to know) but i need something simpler to pull back the field names first i.e.
Date: Name
then to pull back the rows under each column (thanks).
cheers
mc136
will check out your site also andlet you know -
Hi guys
brand new to php. Ive created a mysql database containing fields e.g. name, description etc.
Question is how can I display these fields using loop system. Currently using :
foreach (array("name", "description") as $v) {
echo "$v\n";
}
would much prefer to query the database and pull back this info.
Rgds
mc136
create db with following
in MySQL Help
Posted
hi servicedesk and status represent sections (headings) and for each i need to be able to enter approp info
i.e. servicedesk contains sub directory batch, promo and these contain the values whatever 6, 7, etc
e.g. Servicedesk
batch - 8
promo - 2
status
fmr - 3
odw - 5