sprintf error

I am getting PHP Warning: sprintf() [function.sprintf]: Too few arguments in

with this line of code but don't know why?

GetSQLValueString($_FILES['Photo']['name'], "text"));
jonofatAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael701Commented:
post a few lines around that code. include any sprintf() function before that line.

chances are it's NOT that line, but a syntax error on a previous line causing the error.

80% guess it's  missing )
0
jonofatAuthor Commented:
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE projects SET ClientID=%s, ClientName=%s, ProjectName=%s, Completed=%s, Cvalue=%s, thumb=%s WHERE ProjectID=%s",
                       GetSQLValueString($_POST['ClientID'], "text"),
                       GetSQLValueString($_POST['ClientName'], "text"),
                       GetSQLValueString($_POST['ProjectName'], "text"),
                       GetSQLValueString($_POST['Completed'], "text"),
                       GetSQLValueString($_POST['CValue'], "text"),
					   GetSQLValueString($_FILES['Photo']['name'], "text"));
                       GetSQLValueString($_POST['ProjectID'], "int");

Open in new window

0
Michael701Commented:
i was wrong, so terribly wrong. humor is good, it was a misplaced )

GetSQLValueString($_FILES['Photo']['name'], "text"));

should be

GetSQLValueString($_FILES['Photo']['name'], "text"),
GetSQLValueString($_POST['ProjectID'], "int"));
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

jonofatAuthor Commented:
Hmm. Okay, thanks. Now I am getting

PHP Parse error: syntax error, unexpected ';' in
0
Michael701Commented:
did you change the ; to a comma on the first line? and add the ) on the second?

it should look like this

GetSQLValueString($_FILES['Photo']['name'], "text"),
GetSQLValueString($_POST['ProjectID'], "int"));
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
PHP lets you line up your code so you can find the errors visually.  Look at this - the double closing paren  on line 20 stands out like a sore thumb!

And of course, PHP is a kind, gentle, loosely typed language, so the statement on line 21 will run silently.  Don't you just hate that!
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) 
{
    $updateSQL = sprintf("UPDATE projects SET 
                        
                        ClientID=%s, 
                        ClientName=%s, 
                        ProjectName=%s, 
                        Completed=%s, 
                        Cvalue=%s, 
                        thumb=%s 
                        WHERE 
                        
                        ProjectID=%s",
                        
                        GetSQLValueString($_POST['ClientID'],       "text"),
                        GetSQLValueString($_POST['ClientName'],     "text"),
                        GetSQLValueString($_POST['ProjectName'],    "text"),
                        GetSQLValueString($_POST['Completed'],      "text"),
                        GetSQLValueString($_POST['CValue'],         "text"),
                        GetSQLValueString($_FILES['Photo']['name'], "text"));
                        GetSQLValueString($_POST['ProjectID'],       "int");

Open in new window

0
Ray PaseurCommented:
Here is how I might set this up...  Putting the commas at the front seems to make it easier for me to read and follow the intent of the code.  Setting the parentheses and logic control structures on different lines is something I like to do, too.  A side benefit of this structure is that you make fewer typos when you have to go in and modify what you have written.

Best regards, and good luck with the project, ~Ray
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) 
{
    $updateSQL 
    = sprintf
    ( "UPDATE projects SET ClientID=%s
    ,   ClientName=%s
    ,   ProjectName=%s
    ,   Completed=%s
    ,   Cvalue=%s
    ,   thumb=%s 
       WHERE ProjectID=%s"
    ,   GetSQLValueString($_POST['ClientID'],       "text")
    ,   GetSQLValueString($_POST['ClientName'],     "text")
    ,   GetSQLValueString($_POST['ProjectName'],    "text")
    ,   GetSQLValueString($_POST['Completed'],      "text")
    ,   GetSQLValueString($_POST['CValue'],         "text")
    ,   GetSQLValueString($_FILES['Photo']['name'], "text")
    ,   GetSQLValueString($_POST['ProjectID'],       "int")
    )
    ;
    // ETC...

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.