Re: What's wrong with this code?

2005-05-15 Thread Michael Stassen
Robb Kerr wrote:
I have the following lines in my PHP doc.
 


mysql_select_db($database_TBAJobLink, $TBAJobLink);
$updateSQL = sprintf("UPDATE JL_Resumes SET DateEdited=%s, Status=%s WHERE
ResumeID=%s", $dateEdited, $status, $resumeID);
mysql_query($updateSQL, $TBAJobLink) or die(mysql_error());
echo 'The JL_Resumes table has been updated.';
?>
 

The three variables - $dateEdited, $status and $resumeID - are defined in
the top of the page.
I'm getting a return of.
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 'Updated WHERE
ResumeID=33' at line 1
Updated looks like a column name rather than a string.  As has already 
been pointed out, non-numeric values need to be quoted.

What's up? What's wrong with my code? The first line in the page is a link
to the connections file.
Robb
I'm also curious why you are bothering with sprintf.  Try this
$updateSQL = "UPDATE JL_Resumes
  SET DateEdited='$dateEdited', Status='$status'
  WHERE ResumeID=$resumeID";
(I'm assuming ResumeID is numeric.)
Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: What's wrong with this code?

2005-05-15 Thread Taisuke Yamada
What are the types of each column?
You need to quote parameter if it's a string type.
But anyway, you'd better use placeholder '?' and pass
parameters as argument to query method instead of embedding
into SQL statement using sprintf.
$updateSQL = sprintf("UPDATE JL_Resumes SET DateEdited=%s, Status=%s WHERE
ResumeID=%s", $dateEdited, $status, $resumeID);
mysql_query($updateSQL, $TBAJobLink) or die(mysql_error());
[snip] 
What's up? What's wrong with my code? The first line in the page is a link
to the connections file.
--
Taisuke Yamada <[EMAIL PROTECTED]>
2268 E9A2 D4F9 014E F11D  1DF7 DCA3 83BC 78E5 CD3A
Message to my public address may not be handled in a timely manner.
For a direct contact, please use my private address on my namecard.


signature.asc
Description: OpenPGP digital signature


Re: What's wrong with this code?

2005-05-15 Thread Peter Brawley




Robb,

If DateEdited is a datetime col, try "...DateEdited='%s'...", ditto for
Status if it is not numeric.

PB

-

Robb Kerr wrote:

  I have the following lines in my PHP doc.

 



 

The three variables - $dateEdited, $status and $resumeID - are defined in
the top of the page.

 

I'm getting a return of.

 

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 'Updated WHERE
ResumeID=33' at line 1

 

What's up? What's wrong with my code? The first line in the page is a link
to the connections file.

 

Robb


  
  

No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005
  



No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.10 - Release Date: 5/13/2005

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

What's wrong with this code?

2005-05-15 Thread Robb Kerr
I have the following lines in my PHP doc.

 



 

The three variables - $dateEdited, $status and $resumeID - are defined in
the top of the page.

 

I'm getting a return of.

 

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 'Updated WHERE
ResumeID=33' at line 1

 

What's up? What's wrong with my code? The first line in the page is a link
to the connections file.

 

Robb



What's wrong with this code?

2005-05-15 Thread Robb Kerr
I have the following lines in my PHP doc.

 



 

The three variables - $dateEdited, $status and $resumeID - are defined in
the top of the page.

 

I'm getting a return of.

 

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 'Updated WHERE
ResumeID=33' at line 1

 

What's up? What's wrong with my code? The first line in the page is a link
to the connections file.

 

Robb



What's wrong with this code?

2002-08-26 Thread Soheil Shaghaghi

Hi everyone,
In the following code:

sub DATEJOINED{
my %arg = @_;
if (! $arg{USER}) {return undef}
return $arg{USER}->get(field=>'RegistrationDate');
}
The field Registration date is returned from the mysql table for the user
who is currently logged in in the following format:
Thu, Mar 1st, 2001

What I would like to do is change this date to the raw format (i.e.
20010801)

Can anyone please tell me how I can do this?
I tried the following, but get a bunch of errors!

sub DATEJOINEDRAW {
my %arg = @_;
if (! $arg{USER}) {return undef}
return $arg{USER}->get(field=>'DATE_FORMAT(RegistrationDate,
'%M %e, %Y')');

Thanks so much.



-
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