I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and works fine EXCEPT I want to add the strip slashes bit to it so it will save what I type in. However, I tried, and totally cleared 2 fields for all records on my db, so not happy. So here is the script, can anyone help me put the stripslashes bit where it should be please...
The stripslashes are important for 'item' and 'description' fields.
Code: <?php
"db connection area"
$sql="SELECT * FROM $tbl_name ORDER BY category ASC";
$result=mysql_query($sql);
// Count table rows
$count=mysql_num_rows($result);
?>
<!--
<FORM method="post" action="<?php echo $PHP_SELF?>">
-->
<p>
<table border='1' cellspacing='0' width='100%' style='border-collapse: collapse' bordercolor='#000000'>
<form name="form1" method="post" action="">
<tr>
<th>Category/Subcategory</th>
<th>Product/Code</th>
<th>Description</th>
<th>Qty/Price 1</th>
<th>Qty/Price 2 </th>
<th>Qty/Price 3 </th>
<th>Qty/Price 4 </th>
<th>Qty/Price 5 </th>
<th>Weight/Status</th>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<? $id[]=$rows['id']; ?>
<td><input name="category[]" type="text" id="category" value="<? echo $rows['category']; ?>" size="30"><br />
<input name="subcategory[]" type="text" id="subcategory" value="<? echo $rows['subcategory']; ?>" size="30" /></td>
<td><input name="item[]" type="text" id="item" value="<? echo $rows['item']; ?>" size="30"><br />
<input name="code[]" type="text" id="code" value="<? echo $rows['code']; ?>" size="30" /></td>
<td><textarea name="description[]" cols="40" rows="3" id="description" type="text"><? echo $rows['description']; ?></textarea></td>
<td><input name="qty1[]" type="text" id="qty1" value="<? echo $rows['qty1']; ?>" size="5"><br />
<input name="price1[]" type="text" id="price1" value="<? echo $rows['price1']; ?>" size="5" /></td>
<td><input name="qty2[]" type="text" id="qty2" value="<? echo $rows['qty2']; ?>" size="5"><br />
<input name="price2[]" type="text" id="price2" value="<? echo $rows['price2']; ?>" size="5" /></td>
<td><input name="qty3[]" type="text" id="qty3" value="<? echo $rows['qty3']; ?>" size="5"><br />
<input name="price3[]" type="text" id="price3" value="<? echo $rows['price3']; ?>" size="5" /></td>
<td><input name="qty4[]" type="text" id="qty4" value="<? echo $rows['qty4']; ?>" size="5"><br />
<input name="price4[]" type="text" id="price4" value="<? echo $rows['price4']; ?>" size="5" /></td>
<td><input name="qty5[]" type="text" id="qty5" value="<? echo $rows['qty5']; ?>" size="5"><br />
<input name="price5[]" type="text" id="price5" value="<? echo $rows['price5']; ?>" size="5" /></td>
<td><input name="weight[]" type="text" id="weight" value="<? echo $rows['weight']; ?>" size="5"><br />
<input name="status[]" type="text" id="status" value="<? echo $rows['status']; ?>" size="5" /></td>
</tr>
<?php
}
?>
</table>
<input type="submit" name="Submit" value="Submit" class="button1">
</form>
<?php
// Check if button name "Submit" is status, do this
if($Submit){
for($i=0;$i<$count;$i++){
$sql1="UPDATE $tbl_name SET status='$status[$i]', category='$category[$i]', subcategory='$subcategory[$i]', item='$item[$i]', description='$description[$i]', code='$code[$i]', qty1='$qty1[$i]', price1='$price1[$i]', qty2='$qty2[$i]', price2='$price2[$i]', qty3='$qty3[$i]', price3='$price3[$i]', qty4='$qty4[$i]', price4='$price4[$i]', qty5='$qty5[$i]', price5='$price5[$i]', weight='$weight[$i]' WHERE id='$id[$i]'";
$result1=mysql_query($sql1);
}
}
if($result1){
echo "<p>Records Updated</p>";
echo('<meta http-equiv="refresh" content="0">');
}
mysql_close();
?>
Thankyou in advance
How to copy a part of a vector in a raw memory
Hi,
Creating a db with a query
Hello everyone.I'm having troubles creating a db with a query.I'm reading a book called PHP Bibles from Tim Converse I get this errorFatal error: Call to undefined function mysql_create_db() in
Really need helps regarding Pagination with Sort
I need someone helps regarding pagination problem...i actually want to make my page limited to let say 50 so it will look like this page1=0-50page2=51-100Then i want to sort let say based on the name
PHP not creating file.
Its supposed to create a .ini file in the /scriptfiles/users/ with the name they entered into the field then its supposed to create a password in the file in md5 encryption like this
Script not running properly
Hello EveryoneThis is a basic script for posting to a database. I'm not sure why it doesn't work. Can anyone tell me why?Code: [Select]<?phprequire('config.php');if(isset($_GET['id']) == TRUE
PECL uploadprogress for php5.2
Hey, I just installed PHP5 via .htaccess on my 1and1 Shared Hosting Account.How would I exactly install the "PECL uploadprogress"?http://pecl.php.net/package/uploadprogress---There are
Parse Error
Hi Guys,I have a function in my class which returns a string link variable. The problem is it keeps giving me a parse error. See code below followed by error message:Code: function
rename the file
File.txtCode: ***DOCUMENT***..DN:000044255..CB:..SN:..PY:2009..ED:LA..ED:Home..ID:***DOCUMENT***..DN:000044254..CB:..SN:..PY:2009..ED:LA..ED:Edition..PT:ID:Code: <?php$file = fopen($argv[1],
mail() problem
Hi Guys,I've set up a contact email form. It sends the information fine, but it sends it to the junk folder.If I just use this command:$headers = "MIME-Version: 1.0 \n";It will send it to
Why is my row count 0?
Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.Here are things i know.1. The data passed is passed correctly, and is correct as far as data goes.2.