Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Multi Entries Update To Mysql


Could someone help me to figure out how to upgrade multi entries to Mysql by using PHP?

Say, I have a table on Mysql

id Priority
1 Okay
2 wait
3 later
4 asap
5 hold

Now I want to upgrade that table to:

id priority
1 hold
2 asap
3 okay
4 wait
5 later

Is it possible to upgrade multi entries with one submitt button? If yes, could you tell me how it could be done.

I knew I could do it by each entry (submitt button).

Update priority set priority='$priority' where id = '$id'




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MYSQL Entries Won't Update
I am trying to update some entries in a mysql database that will append the filename to the end of a thumbnail directory entry. So for example /images/thumb/ would become /images/thumb/12345.jpg.

I am stumped because the below code gives no php or mysql errors but the entries are not updated in the mysql db! Code:

How To Update MYSQL From Multi Row Form
I'm trying to update rows in MySQL using a dynamically generated form. PHP Code:

Allow Users To Update Only Their Own Entries
I have three forms in my database, when each form is submitted the current username is automatically entered into the database, and I want the user to be able to edit only their entries. Everybody can view the entries but only them can update it.

Using Checkboxes To Update Multiple Database Entries
I have a query that shows a list of options that a user can toggle on
or off using a checkbox.

query...
form...
while($row = mysql_fetch_array($result))...
<input name="menu_show_attribute[]" type="checkbox"
class="checkbox"');
if ($row['menu_show_attribute'] == 1) {
echo (' value="'.$row[menu_id].'" checked />
} else {
echo (' value="'.$row[menu_id].'" />');
}

The list is generated from boolean values in a DB. This populates my
form with checkboxes, some are checked and others are not. I'm using
an if statement to sort it (checked). This works fine.

The problem is when the user un-checks a checkbox, the value does not
get passed and the DB does not update - set/change it to 0. The only
values that get passed are the checkboxes that are checked. Below is
the query / code after the submit button has been pressed. Are radio
buttons the answer? Any help / suggestions would be very much
appreciated.

//process form
for ($i = 0; $i < count($menu_show_attribute); $i++) {

if (isset($menu_id) == 'checked') {
$menu_show_attribute = 1;
} elseif ($menu_show_attribute != 'checked') {
$menu_show_attribute = 0;
}

$query = 'UPDATE menu SET menu_show_attribute = "'.
$menu_show_attribute.'" WHERE menu_id = "'.
$menu_show_attribute[$i].'"'
echo("<br>");
echo $query;
$result = mysql_query($query, $db) or die(mysql_error());
}

Deleting Entries From Mysql
I have business listings that I have pulled from a database(MySQL) and printed to the page, in an admin page, for review. I'm trying to write a script to add and one to delete the listing.

I get an SQL error, 'check the manual for blah blah near " on line 1'

Here is the 'delete script:

Get All Entries From Today (mysql)
I currently have a page that each time a user visits it, the pageid and timestamp is thrown into a mysql daabase.

so the database looks like so:
linkid time
3 2007-08-22 17:26:21
3 2007-08-20 17:26:21
3 2007-08-22 18:36:59
2 2007-08-22 18:37:21

What i need is for php to show the total amount of visits today as per a certain time zone (or if thats not possible, the past 24 hours)

soo..
Search for all occurrences where linkid = 3 today for a specific timezone (or 24 hours)

MORE SPECIFICALLY
User 1: Lives in New York (EST -5)
registers for my site and sends visitors to his linkid (3)

After two days, this is what the mysql table looks like:
linkid time
3 -=- 2007-08-22 17:26:21
3 -=- 2007-08-20 17:26:21
3 -=- 2007-08-22 18:36:59

But mysql time isn't Eastern time, its another timezone. So when a visitor comes to user1's page at 3pm EST, mysql registers the time as 2007-08-22 17:26:21

So... I want to first add/subtract the number of numbers in the mysql database depending upon the user, and then see the amount of visitors for the day.

Selecting 4 Random MySQL DB Entries?
I have a table set up in my MySQL database called 'features'. This table has 10 entries, but I only want to select 4 random rows and display them out in tables.

Limiting User Mysql Entries
I have a script i'm making which is going to be used to search for reciprocal links on different sites and I have user levels such as free, paid, ect... I want to make it so that if the person signs up as a free user they can only add like 2-3 domains to be searched for their links. How would I limit the number of domains allowed to be searched? Would I limit the number of mysql entries allowed in the table for the domains?

Populating Dropdown With Mysql Entries
I would like to create a combobox in Flash which is populated with mysql data and programmed with php. For example: There are 3 entries in database .ie. apple, bannana, peach. Now these I want in combobox in Flash MX/flash5.

Day View Calendar / Mysql Entries
I am trying to create a day view of a lab resource reservation system. So far, I've been able to generate a day view table with php, using variables for start time, end time and periods. Periods represent intervals on the day view.

I have two columns in the table:  the first one starts at the start time (say 8:00) and there is a row for every time until the end time, each row time being increased by the period, ie. 8:00, 8:30, 9:00 where the period is 30 minutes and the end time is 9:00.

My second column in the table is filled with unix timestamps representing the date for that particular row, so the 8:00 row on July 1, 2007 is represented by a timestamp of 1183291200. I then created variables to represent start and end times and date of a reserved lab resource. I did a little switch statement in my second column of my table saying, if that row's timestamp equals the start or end time of my reserved resource, than give it a certain style.

All well and good, except I need to tie this into a mysql database where the reservation details (start, end, date) are stored.  Where I am getting fuzzy is how to integrate the query results from the database into my little system.  I would like to have that second column pick up the results from my query and display the reservations, but I'm not sure now to do that. I'd like to post the code here, but I'm not sure how to post php code on these forums without getting yelled at for doing it wrong (I did that once, can you tell?)

Select All Unique Collumn Entries In Mysql
Can anyone tell me how you can query mysql for all unique entries into
a particular table collumn. Ive checked the manual but had no luck!

INSERT Into Mysql Alway Make Two Entries
I code some site and because Im a freak I made my own session-handling.
When a user open up my site it will check if there is a ssid in the url
if not generate one. this will be done by a function generate_ssid() and works fine.
next step is to register the ssid in the table session
this will be done by the following code:
******************************
function ssid_register($ssid,$login,$uid,$admin){

$connect = mysql_connect( $GLOBALS["db_host"],
$GLOBALS["db_user"],
$GLOBALS["db_password"])
or die($GLOBALS["db_error"]);
mysql_select_db($GLOBALS["db_name"],$connect) or die($GLOBALS["db_error"].'<br>ErrorCode s.001-con');
$result = mysql_query("INSERT INTO session SET ssid='$season',ip='$rip'",$connect);
echo ($rs);
return;
}
********************************
I redesigned the INSERT INTO part into all possible syntax but everytime I look into the db, there are two entries with two DIFFERENT ssids.
The only way it works correct is to dont use a variable on the first place.
Means if I use ssid='godhelpmetofindaworkingsolution' it works great but is not realy what I want.

As told above a "INSERT INTO session (ssid) VALUES ($ssid)" also has the effect of two new db-entries.

Populate MySQL With Multiple Text Box Entries
I have about 300 rows of mysql data which I have chosen to diplay with a text box at the end of each row, that is available for adding comments. I would like to be able to add comments to entries and then have an update scripte that would take the text box, named "MC" and place the data in its row identified by a hidden field which would corrrespond to the Primary Key of the MySQL Database. I've done something similar using check box arrays, ie. Checkbox name="MC[]"

My question is whether I can write a script that would test for a value in the corresponding text box, and update the MySQL data accordingly. I have also provided in my display script that if the MC column is already populated in MySQL it will not display in the form.

Number Of Identical Entries In MySQL DB Column
How do you display the number of times a particular entry appears in a column of a database?

Deleting Duplicate Entries From MySQL Database Table
The topic is related to MySQL database.

Suppose a table "address" contains the following records

-------------------------------------------------------
| name | address | phone |
-------------------------------------------------------
| mr x | 8th lane | 124364 |
| mr x | 6th lane | 435783 |
| mrs x | 6th lane | 435783 |
| mr x | 8th lane | 124364 |
-------------------------------------------------------

Quote:

Should I Add A Multi Column Index To MySQL?
I have a mysql table. Two columns in the table are used to pull out
stories from the table.

One of the columns stands for categories of the stories, and the other
column is the primary key and has the id for each story.

I am thinking of writing queries like this:

mysql_query("SELECT * FROM articles WHERE category='Science_Fiction'
AND story_id=&#3945;'");

I am wondering if I should create a multi column index that covers both
"categories" and "story_id" columns. -- INDEX (categories, story_id)

Would this increase performance?

Processing Data From Multiple Multi-line Textareas Into A Multi-dimensional Array
I know that this sounds like something overly complex - because it is.
However, if I can keep the user interface the way it is, my users will
be ultra happy! That is the goal...

In general, this is an inventory receiving piece of an overall larger
web-based ERP system.

What I have is a form in which I have a dynamic number of multline
textareas for inputting (possibly barcode scanning in) many serial
numbers per line item recieved.

For example:
lineitem01 = widget01; qtyReceived = 2;
lineitem02 = widget02; qtyReceived = 3;
lineitem03 = widget03; qtyReceived = 10;

This would display a form that will generate 3 textarea elements (1
per lineitem received). Inside each textarea element will be input the
serial numbers for each of the widgets received per lineitem. i.e. 2
serial numbers will be entered for widget01; 3 for widget02; and 10
for widget03;

So, what I am trying to do is pass this data over, possibly as a multi-
dimensional array to another form ( or possibly $_SERVER['PHP_SELF'] ) to update a MySQL database to store the widget/serial numbers.

Php / Mysql Multi User Concurrency Question
i have some multi user concurrency question.

my process:
- read from db
- process data (might take as long as few seconds)
- save to db

during the above process, there might be some overwriting due to concurency
problem in multi-user environment.

i know innodb table is able to lock row record. beside the using innodb type,
can anyone advise me on other possible suggestions.

Making Mysql Result Into Multi-dimensional Array
My php problem is I want to make the result of 3 tables linked through foreign keys into a 3-dimensional array that reflects their relationship without repetition and without having to call the database more three times.

I know I'm doing a couple of things wrong, one thing for instance is initializing a variable at the end of the loop to remember the previous value s that it does not repeat itself, surely there must be a more elegant way to go about this, but I'm lost and I've been stuck on this all day. Code:

Multi Language Site With PHP, Mysql And Cookies - How About Search Engines?
I need to make at multilanguage language site, and for that I need to
identify the users, and register there choice off language. For that i
imagine using cookies, since this is the only way to identify the
users. But from what I read search engines ignore cookies, and at the
same time I would like the users to be able to send links in there
choice of language to there friends, so I would like this sort of url
scheme.

www.site.com/en/
www.site.com/de/
www.site.com/fr/
.....

But I don´t like the idea of having a lot of duplicate files, with the
only difference being a reference to a specific column in my sql
database. What to do? How do others solve these problems

Insert Multi Rows With A Single Mysql Function Call?
For this table
---------------------------------------
| id | foo | bar |
--------------------------------------

I understand that we can insert a row to the table per call, like this
sql_query = "INSERT INTO `table` (`foo`, `bar`) VALUES ('$string_1',
'$string_2')";
mysql_query($sql_query, $db_handle);

if I want to insert multi rows(the following example inserts two rows)
at the same time, the following example works, but can I merge this
two insertion into a single mysql operation (to achieve efficiency)?

sql_query = "INSERT INTO `table` (`foo`, `bar`) VALUES ('$string_1',
'$string_2')";
mysql_query($sql_query, $db_handle);
sql_query = "INSERT INTO `table` (`foo`, `bar`) VALUES ('$string_1',
'$string_2')";
mysql_query($sql_query, $db_handle);

Pushing Data Into A Multi-dimensional Array From Mysql Results
First, A result array I'd want to get could look like this:

$chart['chart_data'] = array (
array ( "Region A", 10,12,11,15,20,22,21,25,31,32,),
);

The first is "Region A" and the rest is just int's that I'd pull from the db, so to set it I'd do this:

$chart [ 'chart_data' ][ 0 ][ 0 ] = "Region A";

But the problem is when I want to insert the data in the while loop (like the 10,12,11,15...), I've tried array_push but it's not working, maybe it doesn't work with multi-dimensional arrays? Anyways, here.'s what I tried, the following inside the "while" to loop the mysql results with mysql_fetch_assoc:

while($r=mysql_fetch_assoc($res)) {
   
     $chart [ 'chart_data' ][ 0 ][ 0 ] = array_push($chart['chart_data'][0][0], $r['wght']);
     // the above line is where I have problems    ^^
}

What I want is on each loop to insert the fetched data inside the array so that it gives what I gave first at the top, but what I've written above doesn't work, it gives me a warning saying "first argument must be an array" which seems to be one, but anyway, anybody know how to do this?

Multi Sorting Multi Dimensional Array?
I have been using usort to sort my multi dimensional arrays ...

function cmp($a, $b){
if($a[0] == $b[0]){
return 0;
}
return ($a[0] < $b[0]) ? -1 : 1;
}
usort($searchResults, 'cmp');

Which works fine, but I need to sort by one element in the array, then
another, preserving the previous sort.

lets say the array is as follows:

array[0] = array[0] = foo
[1] = 2
[1] = array[0] = foo
[1] = 0
[2] = array[0] = bar
[1] = 1
[3] = array[0] = bar
[1] = 0
[4] = array[0] = foo
[1] = 1
[5] = array[0] = bar
[1] = 2

Initially, I sort the array in to groups based on array[?][0] using
usort as above so the output is :

foo, 2
foo, 0
foo, 1
bar, 1
bar, 2
bar, 0

Next though, I would like to sort this output by number (array[?][1])
in the groups so that the output is :

foo, 0
foo, 1
foo, 2
bar, 0
bar, 1
bar, 2

Is this possible? I am completely at a loss as to how to do this ...

Using UPDATE In MySQL
I have an input form that passes data when submitted to a second form
to let the user know what they have just entered into the db.

My question comes with using 'update'. I'd like to query the database
by equipment number (equipno is unique) and query all fields from that
row, populating an original form 'look alike' whereby the user can add
detail to the original records as the db builds. I'm using 'date'
twice because I'd like to have the original date the record was added
plus the most recent update date.

Form 1 below, is original user input:

MySQL UPDATE
mysql_query("UPDATE news SET newstopic = '$newstopic', news = '$news', newswriter = '$newswriter' WHERE nID = '$nID'");

why isn't this working?

How Do I Update Mysql
i have a mysql database table called email2 mysql> describe email2;

+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | | PRI | NULL | auto_increment |
| email | varchar(20) | | | | |
+-------+-------------+------+-----+---------+----------------+

I want to update the database with a form. For example, i could edit the contents of the database using a form and save it to the database again. Is there way to do that? Code:

MYSQL UPDATE
i'm making a forum and am having a little trouble with updating a post.
I have an edit button, it gets the post and puts it into a text box, but once finished editing, it will not update the post! I made it echo the message before updating and its the right thing and it doesn't give any errors.

$postid=$_POST['postid'];
$post=$_POST['post'];
mysql_query("UPDATE posts SET post = '$post' WHERE postid = '$postid'") or die("Could not edit post.");

Is there anything wrong with the above is it something else in the code?

Best Way To Update A Mysql Record
I have a small app that a user can select an entry to be considered as "cancelled". This will change an entry in a mysql database.

Is there someway of making a button that as soon as its clicked, sends the appropriate update info to the database and reloads the page?

UPDATE Mysql TABLES With PHP
Ok, I know I can update my tables using phpmyadmin, but it becomes very difficult when I have a table with hundreds of rows all with different information. Now, what I want to do is be able to change the information that is in the table already. Meaning...if I have customer A, B and C all with different attributes, say one of them calls me and wants to change his shipping address. I know I could go to phpmyadmin, search this customer and edit his info. But it becomes really hard when I have 200 customers who change their info, not only their addresses but Contact info, etc.

Now what I am trying to do now is create a PHP script that will help with to accomplish that.

PHP MYSQL Update Issue
I normally do not ask for much help on php or mysql but this one has me stumped as to the actual cause of the issue.

I have a script that updates about 3000 records hourly well my main issue is this. The update starts and about 400 records into the update script, it stops . Sometimes it may go all the way and sometimes it does not.
Nothing changes in the scripting from one event to the next. As in sructured data wise.Is there a limit to the mysql_query update feature to PHP or MYSQL that wold cause this.

This is an example of my issue.

$tonytiger = mysql_query("select * from world");
while($goathurder = mysql_fetch_arrary($tonytiger))
{
$rickeet = mysql_query("select * from yukon where timeline='$goathurder[hunted]'");
$poco = mysql_fetch_array($rickeet);

$place = $goathurder[place] + $poco[place];
$yoogie = mysql_query("update location set place='$place' where hunted='$goathurder[hunted]'");
}

Now this query has been known to complete many times with 3000 records but its the time it does not that is my question.

PHP: MySQL UPDATE Query
I need to have a page where the user can update his info and/or delete his record. I haven't tested the DELETE query yet.

When I open the page it shows all the info stored in the database. When I change something and hit the update button I get the message that the record was successfully updated, but nothing really hapens.

If you want to see what's happening go to URL , click on the 'directory' link
The user ID is 'scooby', and password 'dooby'. If it does not work, try the following combination: user ID: 'sunny', password: 'trout' . Then click on the 'edit profile' link and try to change something and see what happens. I am attaching a php file of the 'edit profile' page, the one I am having trouble with so you can see the entire code.

Php Preview Before Update Mysql
I have an admin page with a form to submit outlet data in to the mysql database. all I want to do is have 3 buttons for the form 1 putting the outlet on hold which is ok the other update with is also ok, the one I am stuck on is Preview,

I need the the admin to be able to check over what has been updated but cannot work out how to display the the data witout updating the databse ...

UPDATE A Record In MYSQL DB With PHP
What is the best way to update a record in a MYSQL DB using a FORM and PHP
?
Where ID = $ID !

Any examples or URLS ?

Mysql UPDATE Syntax
what is wrong with this code? It generates no erros, but doesn't work either:

$query = "UPDATE $usertable SET dl=dl+1 WHERE id=$id";
$result = MYSQL_QUERY($query);

There is a unique id number for every row in my table. There is also a column called "dl" which holds the number of downloads certain files have gotten. I'm trying this code on my download page so that every time someone downloads a file (identified by its id number) the "dl" column for that file is incremented.

MySQL UPDATE Command
I use this to add a new row of data to a table:

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>$query = "insert into $parent values('$id','$author','$website','$fname','$width','$place','$title')";
$result = mysql_query($query) or die("crap");[/code]

The $id is an auto incrementing field so every row can be referenced with a unique number. Suppose I have the $id of the row I want to modify, and I have new values for $author, $website, $fname, $width, $place, and $title. What code do I use to modify the row (keeping the same $id)?

Mysql Update And Checkboxes
I'm building a music site with a mysql backend. It has a many to many
relational database.
I use this to match music genres with certain artists, to maintain the
possibility to add multiple genres to a singe artist.

Now i've searched google, but can't find a solution on how to update
rows with checkboxes.
If an artist gets his genre updated as follows:
from

- [_] classic
- [X] rock
- [_] ballad
- [X] 80's
- [_] 90's
- etc.

to

- [_] classic
- [_] rock
- [_] ballad
- [_] 80's
- [X] 90's
etc.

Update Several Rows In MYSQL
I have this table which displays multiple rows of information I think the max being about 100: PHP Code:

PHP/MySQL UPDATE Problem
//GET INSERTED CHUNK ID
$getid = mysql_query("SELECT id FROM chunks WHERE chunk = '$chunk'");
$idrow = mysql_fetch_array($getid, MYSQL_ASSOC);
$chunkid = $idrow["id"].",";

$eachtag = explode(",", $tags);
foreach($eachtag as $key=>$value) {
For some reason, this code:

$updated = $row["chunks"] . $chunkid;
mysql_query("UPDATE tagtochunk SET chunks = '$updated' WHERE tag =
'$value'");

only updates the field with $chunkid, leaving out row["chunks"]. I'm
guessing it may have something to do with scope within control
structures.... I'm at a loss.

$query = "SELECT chunks FROM tagtochunk WHERE tag = '$value'";
$result = mysql_query($query);

if (mysql_num_rows($result) == 0) {

//CREATE NEW TAG ENTRY
mysql_query("INSERT INTO tagtochunk (tag, chunks) VALUES ('$value',
'$chunkid')");

} else {

//UPDATE CUR TAG WITH NEW CHUNKID
$updated = $row["chunks"].$chunkid;
mysql_query("UPDATE tagtochunk SET chunks = '$updated' WHERE tag =
'$value'");

}

}

mysql_close($con);
?>

Php, Mysql And Update Table
I have one mysql table and I need to update it by form. But what is the best way.
I think First I need atleast following php-files:

list.php --> list all data rows from my table included link to select certain row and
update.php --> ...when selected you will get form view where you can update field
updated.php --> update your database table.

MySQL 'update' Not Working..
I'm setting up a website on which you have to pay for membership. I allow the user to register with an 'elec' field in the database as '0'. The 'elec' field is '0' when they haven't paid and '1' when they have.

I've tested it and the login/register scripts work fine but i cant get it to change 'elec' to '1'. I use a separate script to buy elec, as shown below. Code:

Mysql Update Problem
I get the following error when trying to change image file associated with row.  The image is stored on the server and the link in mysql.

Error:
Error, query failed : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(name, size, type, path) WHERE id='7'VALUES ('album1.jpg', '38916', 'image/pjpeg' at line 1

code:

Update Mysql With $_SESSION
I would like to update the mysql database using a $_SESSION array. The array looks like this when using print_r

[VA001] => 8 [VA002] => 26 etc.........

What i would like the SQL to do is update table column = value of $_SESSION array where column = key of $_SESSION array.

Could someone show me how to write this and is there anythong that needs to be done to the array such as stripslashs or trim or anything like that.

Addslashes With Mysql Update
I have form output that needs to go into a database. If the form output contains ' and I use addslashes on it then I am getting an error because for some reason it is only adding a slash to the back slash so:

' becomes ' - correct and will work
' becomes ' - incorrect and errors

Am I doing something wrong or missing something here?

Mysql Update Problem, Not The Usual
I have a particular problem in which a mysql database is now updating.

I am creating a "cookieless and sessionless" shopping cart using mysql and php. Everything is working fine except for my update shopping cart section. Here is the scenario...

I have a shopping cart named scart.php that contains two links: one to a delete page that redirects back to scart.php and one to a delete page that cotains a form that is being populated by a database entry(the same record that is on scart.php). This form, when submitted, sends all of its contents to update2.php, where the update sql resides, as well as a redirect back to scart.php.

All is working well and free of errors, but the record is not updated when the redirect occurs. I have tried this without the redirect and still get nothing. Here is the code for update2.php:

<?
$db_name = "xxx";
$table_name = "xxx";
$connection = mysql_connect ("xxx.xxx.xxx.xxx", "xxxxxx", "xxxxxx")
or die("Couldn't connect.");
$db = mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$query = ("UPDATE $table_name WHERE id='$id'
SET rfname = '$rfname', rlname = '$rlname', raddress = '$raddress', rcity = '$rcity', rstate = '$rstate', rcountry = '$rcountry', rzip = '$rzip', greeting = '$greeting'");

mysql_query($query);
mysql_close($connection);
header("Location:scart.php")
?>

MySQL Index And UPDATE Table
"When you update a table with an index, you have to update the index as well"
What does this mean? For example, my table has four columns:

MySQL: Insert...select - Update?
I was reading about insert select
http://dev.mysql.com/doc/mysql/en/insert-select.html

Thought this may be a better way to perform a query I'm doing. The differenc is that I need td select from one field, and then update another field in the same record (it is a backup/undo field).

Is there a way to do this in one query? It's a large chunk of data (longtext) so I thought this would be faster than the alternative...

Php/mysql Insert, Update, Delete All-in-one
I have a check box form in an admin area, that links various related tables into one.

These check box results are stored in an array, and then looped, there are in fact four groups of arrays, but the array length could become large (i.e. dozens - not hundreds)

The issue I have is that from the one form multiple things need to occur.

- If a box is checked and the record doesn't exist a new record needs to be inserted.
- If a box is checked and the record does exist, it should be ignored (as it already exists).
- If the box is unchecked and the record exists, it should be deleted.
- If the box is unchecked and the record doesn't exist it should be ignored (the record doesn't exists).

I'm looking for the logic and process (rather than being hand fed code ) Can this be done with 1 (or more likely 2) sql statements. Or do I have to loop thru the arrays, checking the existance and then applying a specific sql statement depending upon checked status and the records existance. Someone mentioned using IF() in the sql statement, but I am not familiar with that one.

Using PHP For Mysql Command (update Partial)
I have a table with a structure column of "product_attributes" that I want to do a mass update to with certain criteria. Basically if within product_attributes there are some rows with the following: Code:

color_blue,color_pink,color_purple,color_black
color_blue,color_pink,color_purple,color_white
color_green,color_pink,color_purple,color_black
color_blue,color_pink,color_purple,color_yellow

Now I want to change all instances of color_purple to color_violet. So that it should now read: Code:

color_blue,color_pink,color_violet,color_black
color_blue,color_pink,color_violet,color_white
color_green,color_pink,color_violet,color_black
color_blue,color_pink,color_violet,color_yellow

How would I do this without disturbing any of the other information within that table? Only the one word in all rows with "color_purple" in it?

Can't Update Mysql Table Via Php Form
I have a form that updates an item pulled from a database, but after the form is posted, it does not update the mysql database with the new info, here's what I am using: Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved