Re: Updat not Updating
On 15-Mar-2003 Sime wrote: > Andrew wrote: >> can you explain how I would do this tracking? >> > > Hi Andrew, > > Try building the query to a variable first, then output the variable to > see > if what MySQL is receiving is what you expected.. > > eg, > $querystring="select * from mytable;"; > echo("\n\n$querystring\n\n"); > mysql_query($querystring); > > will output.. > select * from mytable; > > You can check the syntax of the command this way. > Yep. My code is littered with: // echo $qry;exit; -- and -- echo ""; Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Updat not Updating
Andrew wrote: > can you explain how I would do this tracking? > > My code looks exactly like this: > > mysql_connect("$DBHost","$DBUser","$DBPass"); > mysql("$DBName","UPDATE items > SET ItemSKU='$ItemSKU', > ItemName='$ItemName', > ItemDescription='$ItemDescription', > PostCode='$PostCode', > Category='$Category', > CityID='$CityID', > CTelephone='$CTelephone', > Cfax='$Cfax', > Cemail='$Cemail', > Caddress='$Caddress', > Cfax='$CTown', > Cwww='$Cwww', > WHERE ItemID='$ItemID'"); > $result = mysql_query($query, $connection) or die("Error with query: > ".mysql_error().""); Hi Andrew, Try building the query to a variable first, then output the variable to see if what MySQL is receiving is what you expected.. eg, $querystring="select * from mytable;"; echo("\n\n$querystring\n\n"); mysql_query($querystring); will output.. select * from mytable; You can check the syntax of the command this way. S. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Updat not Updating
can you explain how I would do this tracking? Andrew >Subject: Re: Updat not Updating > > >If this is really exactly what your code looks like, you've got an >extraneous comma after the Cwww line. But when you're tracking down a bug >like this, you may find it helpful to output the exact query that is being >executed, because often the problem will lie in the variable you're >inserting. > >Brian McCain > My code looks exactly like this: mysql_connect("$DBHost","$DBUser","$DBPass"); mysql("$DBName","UPDATE items SET ItemSKU='$ItemSKU', ItemName='$ItemName', ItemDescription='$ItemDescription', PostCode='$PostCode', Category='$Category', CityID='$CityID', CTelephone='$CTelephone', Cfax='$Cfax', Cemail='$Cemail', Caddress='$Caddress', Cfax='$CTown', Cwww='$Cwww', WHERE ItemID='$ItemID'"); $result = mysql_query($query, $connection) or die("Error with query: ".mysql_error().""); Andrew - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Updat not Updating
If this is really exactly what your code looks like, you've got an extraneous comma after the Cwww line. But when you're tracking down a bug like this, you may find it helpful to output the exact query that is being executed, because often the problem will lie in the variable you're inserting. Brian McCain - Original Message - From: "Andrew" <[EMAIL PROTECTED]> To: "Paul DuBois" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; "cTpaXo" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, March 14, 2003 10:49 AM Subject: RE: Updat not Updating > I have an idea why this is but not 100% there is a diffeence in order between > query and Table the ItemID comes after the Ctelephone column in the DB. So > presumably this is the problem, but I realy haven't the foggiest why. > > mysql("$DBName","UPDATE items > SET ItemSKU='$ItemSKU', > ItemName='$ItemName', > ItemDescription='$ItemDescription', > PostCode='$PostCode', > Category='$Category', > CityID='$CityID', > CTelephone='$CTelephone', > Cfax='$Cfax', > Cemail='$Cemail', > Caddress='$Caddress', > Cfax='$CTown', > Cwww='$Cwww', > WHERE ItemID='$ItemID'"); > > Andrew > > >-Original Message- > >From: Paul DuBois [mailto:[EMAIL PROTECTED] > >Sent: 14 March 2003 18:27 > >To: [EMAIL PROTECTED]; cTpaXo > >Cc: [EMAIL PROTECTED] > >Subject: RE: Updat not Updating > > > > > > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Updat not Updating
At 17:41 + 3/14/03, Andrew wrote: yes you are right an I am very stupid for not doing this: It is very important for debugging as I now have this error :):) Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\program files\apache group\apache\htdocs\punterspower\admin\updatecompanyresponse.php on line 23 Error with query: You have an error in your SQL syntax near 'WHERE ItemID='01296 483402'' at line 14 I'm not really happy because I dont know why!! You didn't read Strahil's hint about missing commas below? Andrew -Original Message- From: nobody [mailto:[EMAIL PROTECTED] Sent: 14 March 2003 17:31 To: Andrew Cc: [EMAIL PROTECTED] Subject: Re: Updat not Updating Hello Andrew, Friday, March 14, 2003, 6:18:15 PM, you wrote: A> Can anyone tell me why this is not updating records for this table? A> mysql_connect("$DBHost","$DBUser","$DBPass"); A> mysql("$DBName","UPDATE items A> SET ItemSKU='$ItemSKU', A> ItemName='$ItemName', A> ItemDescription='$ItemDescription', A> PostCode='$PostCode', A> Category='$Category', A> CityID='$CityID' A> CTelephone='$CTelephone' A> Cfax='$Cfax' A> Cemail='$Cemail' A> Caddress='$Caddress' A> Cfax='$CTown' A> Cwww='$Cwww' A> WHERE ItemID='$ItemID'"); A> Andrew A> - A> Before posting, please check: A>http://www.mysql.com/manual.php (the manual) A>http://lists.mysql.com/ (the list archive) A> To request this thread, e-mail <[EMAIL PROTECTED]> A> To unsubscribe, e-mail <[EMAIL PROTECTED]> A> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php There are few simple steps, that everyone should do when using MySQL within PHP. 1. $connection = mysql_connect('host', 'user', 'pass') or die("Error with connect: ".mysql_error().""); 2. mysql_select_db('db_name', $connection) or die("Error with select: ".mysql_error().""); 3. $query = ""; 4. $result = mysql_query($query, $connection) or die("Error with query: ".mysql_error().""); This steps will provide you information if anything goes wrong and most import where it goes wrong. From what you wrote, you didn't placed enough commas in the query. Follow the steps described above and paste the error log. www.php.net and www.mysql.com are your friends! -- best wishes, Strahil Minev a.k.a. DLHelper, >BuFu TeaM mailto:[EMAIL PROTECTED] -- Paul DuBois, [EMAIL PROTECTED] http://www.kitebird.com/ sql, query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Updat not Updating
At 18:49 + 3/14/03, Andrew wrote: I have an idea why this is but not 100% there is a diffeence in order between query and Table the ItemID comes after the Ctelephone column in the DB. So presumably this is the problem, but I realy haven't the foggiest why. mysql("$DBName","UPDATE items SET ItemSKU='$ItemSKU', ItemName='$ItemName', ItemDescription='$ItemDescription', PostCode='$PostCode', Category='$Category', CityID='$CityID', CTelephone='$CTelephone', Cfax='$Cfax', Cemail='$Cemail', Caddress='$Caddress', Cfax='$CTown', Cwww='$Cwww', <-- no comma here! WHERE ItemID='$ItemID'"); Andrew -----Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: 14 March 2003 18:27 To: [EMAIL PROTECTED]; cTpaXo Cc: [EMAIL PROTECTED] Subject: RE: Updat not Updating > See note embedded in query above. To spot these things more easily, you might consider assigning the query to a variable. Then you can pass the variable to the mysql() function, and also print it later if an error occurs. -- Paul DuBois, [EMAIL PROTECTED] http://www.kitebird.com/ sql, query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Updat not Updating
I have an idea why this is but not 100% there is a diffeence in order between query and Table the ItemID comes after the Ctelephone column in the DB. So presumably this is the problem, but I realy haven't the foggiest why. mysql("$DBName","UPDATE items SET ItemSKU='$ItemSKU', ItemName='$ItemName', ItemDescription='$ItemDescription', PostCode='$PostCode', Category='$Category', CityID='$CityID', CTelephone='$CTelephone', Cfax='$Cfax', Cemail='$Cemail', Caddress='$Caddress', Cfax='$CTown', Cwww='$Cwww', WHERE ItemID='$ItemID'"); Andrew >-Original Message- >From: Paul DuBois [mailto:[EMAIL PROTECTED] >Sent: 14 March 2003 18:27 >To: [EMAIL PROTECTED]; cTpaXo >Cc: [EMAIL PROTECTED] >Subject: RE: Updat not Updating > > > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Updat not Updating
yes you are right an I am very stupid for not doing this: It is very important for debugging as I now have this error :):) Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\program files\apache group\apache\htdocs\punterspower\admin\updatecompanyresponse.php on line 23 Error with query: You have an error in your SQL syntax near 'WHERE ItemID='01296 483402'' at line 14 I'm not really happy because I dont know why!! Andrew >-Original Message- >From: nobody [mailto:[EMAIL PROTECTED] >Sent: 14 March 2003 17:31 >To: Andrew >Cc: [EMAIL PROTECTED] >Subject: Re: Updat not Updating > > >Hello Andrew, > >Friday, March 14, 2003, 6:18:15 PM, you wrote: > > >A> Can anyone tell me why this is not updating records for this table? > >A> mysql_connect("$DBHost","$DBUser","$DBPass"); >A> mysql("$DBName","UPDATE items >A> SET ItemSKU='$ItemSKU', >A> ItemName='$ItemName', >A> ItemDescription='$ItemDescription', >A> PostCode='$PostCode', >A> Category='$Category', >A> CityID='$CityID' >A> CTelephone='$CTelephone' >A> Cfax='$Cfax' >A> Cemail='$Cemail' >A> Caddress='$Caddress' >A> Cfax='$CTown' >A> Cwww='$Cwww' >A> WHERE ItemID='$ItemID'"); > > >A> Andrew > >A> - >A> Before posting, please check: >A>http://www.mysql.com/manual.php (the manual) >A>http://lists.mysql.com/ (the list archive) > >A> To request this thread, e-mail <[EMAIL PROTECTED]> >A> To unsubscribe, e-mail <[EMAIL PROTECTED]> >A> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > >There are few simple steps, that everyone should do when using MySQL >within PHP. >1. $connection = mysql_connect('host', 'user', 'pass') or die("Error >with connect: ".mysql_error().""); >2. mysql_select_db('db_name', $connection) or die("Error with select: >".mysql_error().""); >3. $query = ""; >4. $result = mysql_query($query, $connection) or die("Error with >query: ".mysql_error().""); > >This steps will provide you information if anything goes wrong and >most import where it goes wrong. > >From what you wrote, you didn't placed enough commas in the query. >Follow the steps described above and paste the error log. >www.php.net and www.mysql.com are your friends! > >-- >best wishes, >Strahil Minev a.k.a. DLHelper, >BuFu TeaM mailto:[EMAIL PROTECTED] > > > >--- >Incoming mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.461 / Virus Database: 260 - Release Date: 10/03/2003 > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Updat not Updating
Hello Andrew, Friday, March 14, 2003, 6:18:15 PM, you wrote: A> Can anyone tell me why this is not updating records for this table? A> mysql_connect("$DBHost","$DBUser","$DBPass"); A> mysql("$DBName","UPDATE items A> SET ItemSKU='$ItemSKU', A> ItemName='$ItemName', A> ItemDescription='$ItemDescription', A> PostCode='$PostCode', A> Category='$Category', A> CityID='$CityID' A> CTelephone='$CTelephone' A> Cfax='$Cfax' A> Cemail='$Cemail' A> Caddress='$Caddress' A> Cfax='$CTown' A> Cwww='$Cwww' A> WHERE ItemID='$ItemID'"); A> Andrew A> - A> Before posting, please check: A>http://www.mysql.com/manual.php (the manual) A>http://lists.mysql.com/ (the list archive) A> To request this thread, e-mail <[EMAIL PROTECTED]> A> To unsubscribe, e-mail <[EMAIL PROTECTED]> A> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php There are few simple steps, that everyone should do when using MySQL within PHP. 1. $connection = mysql_connect('host', 'user', 'pass') or die("Error with connect: ".mysql_error().""); 2. mysql_select_db('db_name', $connection) or die("Error with select: ".mysql_error().""); 3. $query = ""; 4. $result = mysql_query($query, $connection) or die("Error with query: ".mysql_error().""); This steps will provide you information if anything goes wrong and most import where it goes wrong. >From what you wrote, you didn't placed enough commas in the query. Follow the steps described above and paste the error log. www.php.net and www.mysql.com are your friends! -- best wishes, Strahil Minev a.k.a. DLHelper, BuFu TeaM mailto:[EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Updat not Updating
At 16:18 + 3/14/03, Andrew wrote: Can anyone tell me why this is not updating records for this table? mysql_connect("$DBHost","$DBUser","$DBPass"); mysql("$DBName","UPDATE items SET ItemSKU='$ItemSKU', ItemName='$ItemName', ItemDescription='$ItemDescription', PostCode='$PostCode', Category='$Category', CityID='$CityID' CTelephone='$CTelephone' Cfax='$Cfax' Cemail='$Cemail' Caddress='$Caddress' Cfax='$CTown' Cwww='$Cwww' WHERE ItemID='$ItemID'"); Andrew We cannot, but MySQL and PHP can. 1) Check the return values of the function calls to make sure they work. As written, you have no way of knowing. 2) When an error occurs, print the value of mysql_error() to see what the error is. -- Paul DuBois, [EMAIL PROTECTED] http://www.kitebird.com/ sql, query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php