K, my tired eyes last night missed a few stupid mistakes...

First: The Commas
Second: I removed the period form the first line of the array -- $field_str
= " kwo = '$kwo', ";
Third: two typos.

*hangs head in shame*

Sorry for bothering everyone. :P

BUT!  I'm still having a problem - when I try to submit the change it comes
back and says "Nothing Changed!" even if I change every field.

Gonna do some more hunting - I'm doubting myself now.  ;)




"Richard Hutchins" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'd suggest you first output your SQL statement to the browser to see
> exactly what it's sending to the database. Might give you the answer right
> there.
>
> > -----Original Message-----
> > From: Jeff [mailto:[EMAIL PROTECTED]
> > Sent: Friday, September 05, 2003 12:35 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Modify MySQL Record
> >
> >
> > Yah, I noticed that after I had submitted this, and fixed it
> > - still no
> > change - gives the same exact error.
> >
> > "Jeffrey N Dyke" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > >
> > > looks like you stopped putting commas after your fields at
> > >   $field_str .= " formation = '$formation' ";
> > >   $field_str .= " perfs = '$perfs' ";
> > >   $field_str .= " event = '$event' ";
> > >   $field_str .= " fluid = '$fluid' ";
> > >
> > >   hth
> > > Jeff
> > >
> > >
> > >
> > >                       "Jeff"
> > >                       <[EMAIL PROTECTED]        To:
> > [EMAIL PROTECTED]
> > >                       >                        cc:
> > >                                                Subject:
> > [PHP-DB] Modify
> > MySQL Record
> > >                       09/05/2003 12:28
> > >                       PM
> > >
> > >
> > >
> > >
> > >
> > >
> > > Helloooo!
> > >
> > > I'm having a small problem with modifying the data in a MySQL DB.
> > >
> > > And here's the error:
> > >
> > > (After I click the "Submit Changes" button) Error: 1064:
> > You have an error
> > > in your SQL syntax near '(10-10-10-10)' kwo='1235',
> > lsd='10-10-10-10',
> > > date='2003-05-05', well' at line 1
> > >
> > > Here's the code:
> > >
> > > function edit_record() {
> > >   global $default_dbname, $gradient_tablename,
> > $access_log_tablename;
> > >   global $new_lsd, $kwo, $lsd, $date, $well, $field,
> > >    $uni, $license, $formation, $perfs, $event, $fluid, $mode,
> > >    $type, $vhd, $file, $kb, $grd, $open, $sour, $tube,
> > >   $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag;
> > >
> > >   if(empty($kwo)) error_message('Empty Gradient!');
> > >
> > >   $link_id = db_connect($default_dbname);
> > >   if(!$link_id) error_message(sql_error());
> > >
> > >   $field_str = '';
> > >   if($kwo != $new_kwo) $field_str = " kwo = '$new_kwo', ";
> > >   if(!empty($lsd)) {
> > >     $field_str .= " lsd = other_lsd('$lsd') ";
> > >   }
> > >
> > >   $field_str .= " kwo = '$kwo', ";
> > >   $field_str .= " lsd = '$lsd', ";
> > >   $field_str .= " date = '$date', ";
> > >   $field_str .= " well = '$well', ";
> > >   $field_str .= " field = '$field', ";
> > >   $field_str .= " uni = '$uni', ";
> > >   $field_str .= " license = '$license', ";
> > >   $field_str .= " formation = '$formation' ";
> > >   $field_str .= " perfs = '$perfs' ";
> > >   $field_str .= " event = '$event' ";
> > >   $field_str .= " fluid = '$fluid' ";
> > >   $field_str .= " mode = '$mode' ";
> > >   $field_str .= " type = '$type' ";
> > >   $field_str .= " vhd = '$vhd' ";
> > >   $field_str .= " file = '$file' ";
> > >   $field_str .= " kb = '$kb' ";
> > >   $field_str .= " grd = '$grd' ";
> > >   $field_str .= " open = '$open' ";
> > >   $field_str .= " sour = '$open' ";
> > >   $field_str .= " tubing = '$tubing' ";
> > >   $field_str .= " landed = '$landed' ";
> > >   $field_str .= " casing = '$casing' ";
> > >   $field_str .= " landed2 = '$landed2' ";
> > >   $field_str .= " shut_date = '$shut_date' ";
> > >   $field_str .= " sut_time = '$shut_time' ";
> > >   $field_str .= " pres = '$pres' ";
> > >   $field_str .= " tag = '$tag' ";
> > >
> > >
> > >   $query = "UPDATE $gradient_tablename SET $field_str WHERE
> > kwo = '$kwo'";
> > >
> > >   $result = mysql_query($query);
> > >   if(!$result) error_message(sql_error());
> > >
> > >   $num_rows = mysql_affected_rows($link_id);
> > >   if(!$num_rows) error_message("Nothing changed!");
> > >   if($lsd != $new_kwo) {
> > >     $query = "UPDATE $access_log_tablename SET kwo =
> > '$new_kwo' WHERE kwo
> > =
> > > '$kwo'";
> > >     $result = mysql_query($query);
> > >     if(!$result) error_message(sql_error());
> > >
> > >     user_message("All records regarding $lsd have been changed!",
> > >                  "$PHP_SELF?action=view_record&kwo=$new_kwo");
> > >   }
> > >   else {
> > >     user_message("All records regarding $lsd have been changed!");
> > >   }
> > > }
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to