mum4d
-
Posts
10 -
Joined
-
Last visited
Never
Posts posted by mum4d
-
-
I have a page that displays info from a database in a "Repeating Region" table that is filtered by a MySql WHERE statement. I want to insert some extra data into the database only on the entry's displayed (filtered) leaving all other info in the database untouched. I can do this by creating an UPDATE form in the table and this gives me a "Submit" button in each row to update that row only.
OK Here's the problem....
I want to update all the filtered items with the same data in one coloum but leave all the other coloums as they were and threrefore I only want ONE SUBMIT BUTTON to update all entry's in one go.
It's like a shopping basket listing all the items a user has ordered, and when they press the confirm (Submit) button it add's a unique order number to their items.
Can this be Done??
The code for my SELECT statement is:
[code]$id4 = $_SESSION['kt_login_id'];
mysql_select_db($database_vistion, $vistion);
$query_basket = "SELECT * FROM vistion_basket WHERE id_copy ='$id4'";
$basket = mysql_query($query_basket, $vistion) or die(mysql_error());
$row_basket = mysql_fetch_assoc($basket);
$totalRows_basket = mysql_num_rows($basket);[/code]
the code for my Update statement is:
[code]if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE vistion_basket SET id_copy=%s, imagefile=%s, catagory=%s, code=%s, description=%s, basket_prodname=%s, quantity=%s, complete=%s, order_date=%s, location_code=%s, files_id=%s order_number=%s WHERE id_copy ='$id4'",
GetSQLValueString($_POST['id_copy'], "int"),
GetSQLValueString($_POST['imagefile'], "text"),
GetSQLValueString($_POST['catagory'], "text"),
GetSQLValueString($_POST['code'], "text"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['basket_prodname'], "text"),
GetSQLValueString($_POST['quantity'], "int"),
GetSQLValueString($_POST['complete'], "text"),
GetSQLValueString($_POST['order_date'], "text"),
GetSQLValueString($_POST['location_code'], "text"),
GetSQLValueString($_POST['files_id'], "int"),
GetSQLValueString($_POST['order_umber'], "int"),
GetSQLValueString($_POST['basket_id'], "int"));
mysql_select_db($database_vistion, $vistion);
$Result1 = mysql_query($updateSQL, $vistion) or die(mysql_error());
}[/code]
The code for my repeating table is:
[code]<?php do { ?>
<table width="100%" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="<?php
if($SSAdv_m1%$SSAdv_change_every1==0 && $SSAdv_m1>0){
$SSAdv_k1++;
}
print $SSAdv_colors1[$SSAdv_k1%count($SSAdv_colors1)];
$SSAdv_m1++;
?>" valign="middle">
<td><span class="style5">
<form method="post" name="form2" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Basket_id:</td>
<td><?php echo $row_basket['basket_id']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Id_copy:</td>
<td><?php echo $row_basket['id_copy']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Imagefile:</td>
<td><?php echo $row_basket['imagefile']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Catagory:</td>
<td><?php echo $row_basket['catagory']; ?>></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Code:</td>
<td><?php echo $row_basket['code']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Description:</td>
<td><?php echo $row_basket['description']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Basket_prodname:</td>
<td><?php echo $row_basket['basket_prodname']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Quantity:</td>
<td><?php echo $row_basket['quantity']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Complete:</td>
<td><?php echo $row_basket['complete']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Order_date:</td>
<td><?php echo $row_basket['order_date']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Location_code:</td>
<td><?php echo $row_basket['location_code']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Files_id:</td>
<td><?php echo $row_basket['files_id']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Order Number </td>
<td><input type="text" name="order_number" value="<?php echo $num; ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Update record"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form2">
<input type="hidden" name="basket_id" value="<?php echo $row_basket['basket_id']; ?>">
</form>
<p> </p>
</span></td>
</tr>
</table>
<?php } while ($row_basket = mysql_fetch_assoc($basket)); ?>[/code] -
Anyone?
-
[!--quoteo(post=368771:date=Apr 26 2006, 09:30 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 26 2006, 09:30 AM) [snapback]368771[/snapback][/div][div class=\'quotemain\'][!--quotec--]
It doesn't really matter if your your ISP is running PHP4 as you are not using any PHP5 specific functions. What I think is the problem is die to your ISP having register_globals turned on. Which means that any use of superglobal arrays will not work, i e($_POSt, $_GET, $_SERVER variables).
To see whether Register_globals is on run the following scipt:
[code]<?php
// remove the space between the p and the h in the code below:
p hpinfo();
?>[/code]
Now run that on your ISPs server and find where it says register_globals if it says On in both coloumns this is the reason why your script isn't working.
[/quote]
Thanks for a quick reply,
I have PhpMyAdmin installed on their server. form there I clicked the "show PHP Information" link and that states that register_globals are both OFF
any other solutions??
Thanks again! -
I have created a site in dreamweaver. I created a page that inserts data into a MySql database and then re-directs to a new page using the wizzard in dreamweaver. this works fine on my local machine but not on my ISP's server. I think i's because my ISP is only on PHP version 4 (i'm on PHP5).
The code created by Dreamweaver is:[code]if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO vistion_orders (x) VALUES (%s)",
GetSQLValueString($_POST['x'], "int"));
mysql_select_db($database_vistion, $vistion);
$Result1 = mysql_query($insertSQL, $vistion) or die(mysql_error());
$insertGoTo = "userholder.php?page=update.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
[/code]
how can I change this to run on PHP4?
This site needs to go live ASAP so I need a quick answer PLEASE!!!! -
Is it posable to update/insert into 2 database tables (with the same information) at the same time. I want one table to be used as a "shopping basket" and the other as "stock control" so I need the same data in each but when the shopping basket is emptied by the user the data remains in a second table for stock control.
Thanks in advance
-
I have created a List Menu in a form that makes a selection from a database. But I have had to put a button next to it to activate the selection. ie: 1)select an item from the menu, 2)then click the select button to make the selection and display the data from the database.
How do I make it so I do not need to click the select button??
ie: 1) select an item from a menu and as soon as you release the mouse the data from the database is displayed??
My form code looks like this[code]<form id="form1" name="form1" method="post" action="">
<select name="select">
<option>Choose a Catagory</option>
<option value="form">form</option>
<option value="NCR">NCR</option>
<option value="Tags">Tags</option>
</select>
<input type="submit" name="Submit" value="Select" />
</form>[/code]
Thanks in advance! -
[!--quoteo(post=355888:date=Mar 17 2006, 10:44 AM:name=webwiese)--][div class=\'quotetop\']QUOTE(webwiese @ Mar 17 2006, 10:44 AM) [snapback]355888[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi,
nl2br($yourtext) transaltes linebreaks into <br>.
[/quote]
Thanks Webwiese, works exactly how I want.
Thanks again!
-
I have a form that puts text into a MySql database. The text can contain carrage returns to create paragraphs.
When I echo the text into a text area, all looks OK.
BUT
When I echo the text direct, the line breaks do not work and everything appears in one line.
How do I echo the text so it appears correctly, including line breaks, without placing in in a text area tag???
Example:-
this works
[code]<textarea name="textfield" cols="70" rows="12"><?php echo $row_Recordset1['Description']; ?></textarea>[/code]
this don't work
[code]<?php echo $row_Recordset1['Description']; ?>[/code]
Thanks in advance -
Ok Guy's I have got a tricky one for you.
I have a page that contains a table with a repeating region. Within that repeating region is an input (update) field that reads and writes to a MYSQL data base. this all works fine. The problem is I want to email the contents of the table, in HTML format when the user completes any changes made. I have set up a 'mail()' function and this works fine all but only the first row of the table appears in the email. Clearly the PHP repeating region script will not work in a HTML email. Any ideas how I can get this to work?
Cheers
Update database in repeating region?
in PHP Coding Help
Posted
Yes, indeed it is very possible.
if we fiddle about with your select statement we can work it out....
When the user submits we run the script below.
[code]
$id4 = $_SESSION['kt_login_id'];
mysql_select_db($database_vistion, $vistion);
$update_basket = "UPDATE vistion_basket SET unique_number = $UN WHERE id_copy ='$id4'";
query($update_basket);
[code]
Is this too simplistic?
[/quote]
This is FANTASTIC
Many Thanks