Re: [PHP] Any One See where this is going wrong?

2010-05-02 Thread Gary

"Adam Richardson"  wrote in message 
news:aanlktikuqehnrjcannzq8ezvmx5pneg_bjvezglj0...@mail.gmail.com...
> On Sat, May 1, 2010 at 6:54 PM, Gary  wrote:
>
>>
>> "Adam Richardson"  wrote in message
>> news:aanlktinqixxb9oipu4op2xztrze_vwpbymaywziwb...@mail.gmail.com...
>> > >
>> >>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model, 
>> >> caliber,
>> >>
>> > condition, price, description, image_file_name, available) VALUES
>> >
>> > ('$manufacturer',
>> >> '$type',
>> >>
>> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');
>> >
>> > INSERT INTO images(id, image_file) VALUES ('', '$image_file')";
>> >
>> >
>> > Gary, the second insert has what appears to be a troublesome bit of 
>> > code:
>> >
>> > VALUES ('', '$image_file')";
>> >
>> > Shouldn't it read:
>> >
>> > INSERT INTO images(image_file) VALUES ('$image_file')";
>> >
>> > That's assuming you have id set to auto-increment, so no id in the 
>> > first
>> > or
>> > second set of parentheses.  Additionally, the ", before the $image_file
>> > var
>> > would cause issues, too.
>> >
>> > Adam
>> > --
>> > Nephtali:  PHP web framework that functions beautifully
>> > http://nephtaliproject.com
>> >
>> >
>> >
>> > __ Information from ESET Smart Security, version of virus
>> > signature database 5078 (20100501) __
>> >
>> > The message was checked by ESET Smart Security.
>> >
>> > http://www.eset.com
>> >
>> >
>>
>> Adam
>>
>> The second INSERT is part of a multi_query, and yes there is a
>> auto-increment field in front named id,  it is the foreign key that links
>> the tables.
>>
>> I had removed, and just tried again, but the same result.
>>
>> I have tried it so many ways my fingers and eyes are about to bleed. It
>> makes not sense how it works in one but not the other.
>>
>> I cant see to get the error called out.
>>
>> Thanks again.
>>
>> Gary
>>
>>
>>
>>
>> __ Information from ESET Smart Security, version of virus 
>> signature
>> database 5078 (20100501) __
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> And you also removed the double quote and the comma next to it (sorry, 
> just
> making sure?)  That is to say, you copied the line of code I sent?
>
> $sqlStatements = "INSERT INTO guns( *id,*manufacturer, type, model, //
> *id,*should be removed
> caliber, condition, price, description, image_file_name,submitted
> ,available) VALUES ('*',*'$manufacturer', '$type', '$model', '$caliber',
>   // the *",* combo should be removed
> '$condition', '$price', '$description','$image_file_name', ' ',
> '$available');
>
> INSERT INTO images (*id,* image_file) VALUES('','$image_file')"; 
> //
> the *id,* should be removed AND the *",* combo should be removed
>
> Also, have you tried directly echoing out the error (e.g., *echo
> mysql_error();*  if it's mysql you're using, or the comparable method in 
> the
> library you're using.)
>
> If that didn't work, I'd break up the multi-query into 2 separate queries 
> to
> better troubleshoot the issue.  I like using PDO and setting it up so it
> throws exceptions when something goes wrong (additionally, I like using 
> the
> prepared statements, too.)  Have you been trying that?
>
> I'm still hopeful you'll get this figured out before there's any 
> blood-loss
> ;)
>
> Feel free to send back the new code after the edits if you still have
> issues.
>
> Adam
>
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5078 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>

Adam

What I ended up doing was I rebuilt the entire thing from start.  I created 
one table with one column, made sure it worked, then added a few more, then 
added the child table.

The only thing that I can think of is that I had one of the columns named 
"id", and maybe that is not allowed.

I also just had the form processed on itself, but I cant really imagine that 
would have anything to do with it.

I'll post the code later if interested, I am still adding columns, but the 
child is working so that would seem to be the only real challenge.

Thanks for all your input.

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5080 (20100502) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Brandon Rampersad
yeah, try using the PDO instead

On Sat, May 1, 2010 at 9:14 PM, Adam Richardson wrote:

> On Sat, May 1, 2010 at 6:54 PM, Gary  wrote:
>
> >
> > "Adam Richardson"  wrote in message
> > news:aanlktinqixxb9oipu4op2xztrze_vwpbymaywziwb...@mail.gmail.com...
> > > >
> > >>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model,
> caliber,
> > >>
> > > condition, price, description, image_file_name, available) VALUES
> > >
> > > ('$manufacturer',
> > >> '$type',
> > >>
> >
> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');
> > >
> > > INSERT INTO images(id, image_file) VALUES ('', '$image_file')";
> > >
> > >
> > > Gary, the second insert has what appears to be a troublesome bit of
> code:
> > >
> > > VALUES ('', '$image_file')";
> > >
> > > Shouldn't it read:
> > >
> > > INSERT INTO images(image_file) VALUES ('$image_file')";
> > >
> > > That's assuming you have id set to auto-increment, so no id in the
> first
> > > or
> > > second set of parentheses.  Additionally, the ", before the $image_file
> > > var
> > > would cause issues, too.
> > >
> > > Adam
> > > --
> > > Nephtali:  PHP web framework that functions beautifully
> > > http://nephtaliproject.com
> > >
> > >
> > >
> > > __ Information from ESET Smart Security, version of virus
> > > signature database 5078 (20100501) __
> > >
> > > The message was checked by ESET Smart Security.
> > >
> > > http://www.eset.com
> > >
> > >
> >
> > Adam
> >
> > The second INSERT is part of a multi_query, and yes there is a
> > auto-increment field in front named id,  it is the foreign key that links
> > the tables.
> >
> > I had removed, and just tried again, but the same result.
> >
> > I have tried it so many ways my fingers and eyes are about to bleed. It
> > makes not sense how it works in one but not the other.
> >
> > I cant see to get the error called out.
> >
> > Thanks again.
> >
> > Gary
> >
> >
> >
> >
> > __ Information from ESET Smart Security, version of virus
> signature
> > database 5078 (20100501) __
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> And you also removed the double quote and the comma next to it (sorry, just
> making sure?)  That is to say, you copied the line of code I sent?
>
> $sqlStatements = "INSERT INTO guns( *id,*manufacturer, type, model, //
> *id,*should be removed
> caliber, condition, price, description, image_file_name,submitted
> ,available) VALUES ('*',*'$manufacturer', '$type', '$model', '$caliber',
>   // the *",* combo should be removed
> '$condition', '$price', '$description','$image_file_name', ' ',
> '$available');
>
> INSERT INTO images (*id,* image_file) VALUES('','$image_file')";
>  //
> the *id,* should be removed AND the *",* combo should be removed
>
> Also, have you tried directly echoing out the error (e.g., *echo
> mysql_error();*  if it's mysql you're using, or the comparable method in
> the
> library you're using.)
>
> If that didn't work, I'd break up the multi-query into 2 separate queries
> to
> better troubleshoot the issue.  I like using PDO and setting it up so it
> throws exceptions when something goes wrong (additionally, I like using the
> prepared statements, too.)  Have you been trying that?
>
> I'm still hopeful you'll get this figured out before there's any blood-loss
> ;)
>
> Feel free to send back the new code after the edits if you still have
> issues.
>
> Adam
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>



-- 
A Brandon_R Production


Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Adam Richardson
On Sat, May 1, 2010 at 6:54 PM, Gary  wrote:

>
> "Adam Richardson"  wrote in message
> news:aanlktinqixxb9oipu4op2xztrze_vwpbymaywziwb...@mail.gmail.com...
> > >
> >>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model, caliber,
> >>
> > condition, price, description, image_file_name, available) VALUES
> >
> > ('$manufacturer',
> >> '$type',
> >>
> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');
> >
> > INSERT INTO images(id, image_file) VALUES ('', '$image_file')";
> >
> >
> > Gary, the second insert has what appears to be a troublesome bit of code:
> >
> > VALUES ('', '$image_file')";
> >
> > Shouldn't it read:
> >
> > INSERT INTO images(image_file) VALUES ('$image_file')";
> >
> > That's assuming you have id set to auto-increment, so no id in the first
> > or
> > second set of parentheses.  Additionally, the ", before the $image_file
> > var
> > would cause issues, too.
> >
> > Adam
> > --
> > Nephtali:  PHP web framework that functions beautifully
> > http://nephtaliproject.com
> >
> >
> >
> > __ Information from ESET Smart Security, version of virus
> > signature database 5078 (20100501) __
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> >
>
> Adam
>
> The second INSERT is part of a multi_query, and yes there is a
> auto-increment field in front named id,  it is the foreign key that links
> the tables.
>
> I had removed, and just tried again, but the same result.
>
> I have tried it so many ways my fingers and eyes are about to bleed. It
> makes not sense how it works in one but not the other.
>
> I cant see to get the error called out.
>
> Thanks again.
>
> Gary
>
>
>
>
> __ Information from ESET Smart Security, version of virus signature
> database 5078 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
And you also removed the double quote and the comma next to it (sorry, just
making sure?)  That is to say, you copied the line of code I sent?

$sqlStatements = "INSERT INTO guns( *id,*manufacturer, type, model, //
*id,*should be removed
caliber, condition, price, description, image_file_name,submitted
,available) VALUES ('*',*'$manufacturer', '$type', '$model', '$caliber',
   // the *",* combo should be removed
'$condition', '$price', '$description','$image_file_name', ' ',
'$available');

INSERT INTO images (*id,* image_file) VALUES('','$image_file')";  //
the *id,* should be removed AND the *",* combo should be removed

Also, have you tried directly echoing out the error (e.g., *echo
mysql_error();*  if it's mysql you're using, or the comparable method in the
library you're using.)

If that didn't work, I'd break up the multi-query into 2 separate queries to
better troubleshoot the issue.  I like using PDO and setting it up so it
throws exceptions when something goes wrong (additionally, I like using the
prepared statements, too.)  Have you been trying that?

I'm still hopeful you'll get this figured out before there's any blood-loss
;)

Feel free to send back the new code after the edits if you still have
issues.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Gary

"Adam Richardson"  wrote in message 
news:aanlktinqixxb9oipu4op2xztrze_vwpbymaywziwb...@mail.gmail.com...
> >
>>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model, caliber,
>>
> condition, price, description, image_file_name, available) VALUES
>
> ('$manufacturer',
>> '$type', 
>> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');
>
> INSERT INTO images(id, image_file) VALUES ('', '$image_file')";
>
>
> Gary, the second insert has what appears to be a troublesome bit of code:
>
> VALUES ('', '$image_file')";
>
> Shouldn't it read:
>
> INSERT INTO images(image_file) VALUES ('$image_file')";
>
> That's assuming you have id set to auto-increment, so no id in the first 
> or
> second set of parentheses.  Additionally, the ", before the $image_file 
> var
> would cause issues, too.
>
> Adam
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5078 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>

Adam

The second INSERT is part of a multi_query, and yes there is a 
auto-increment field in front named id,  it is the foreign key that links 
the tables.

I had removed, and just tried again, but the same result.

I have tried it so many ways my fingers and eyes are about to bleed. It 
makes not sense how it works in one but not the other.

I cant see to get the error called out.

Thanks again.

Gary




__ Information from ESET Smart Security, version of virus signature 
database 5078 (20100501) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Adam Richardson
>
>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model, caliber,
>
condition, price, description, image_file_name, available) VALUES

('$manufacturer',
> '$type', 
> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');

 INSERT INTO images(id, image_file) VALUES ('', '$image_file')";


Gary, the second insert has what appears to be a troublesome bit of code:

VALUES ('', '$image_file')";

Shouldn't it read:

INSERT INTO images(image_file) VALUES ('$image_file')";

That's assuming you have id set to auto-increment, so no id in the first or
second set of parentheses.  Additionally, the ", before the $image_file var
would cause issues, too.

Adam
-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread tedd

At 3:18 PM -0400 5/1/10, Gary wrote:

As far as the whole "top posting".  I have been posting on this board for 2
years (give or take), in fact have had a number of exchanges with tedd, (so
I was a little surprised at his response). I have never heard the term top
posting, I had not been asked not to top post.


Okay, so now you know and everything is peachy.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Richard Quadling
Top Posting is putting your reply BEFORE the question.

A bit like this!



On 1 May 2010 17:37, Gary  wrote:
> What is top posting?
>
> Gary

Why is it bad?

Because you read the reply before the reason for the reply and that
makes our head hurt.

Eventually people actually stop replying to known top posters.

It makes their heads hurt.

So.

In the interest of not hurting any, intentional or otherwise, please
bottom post.

And snip out non relevant content in your reply as not everyone is on
super fast broadband and downloading the many many layers of reply can
be annoying.

Regards,

Richard.

--
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Gary

"Adam Richardson"  wrote in message 
news:aanlktil-gwsrxmbbwkcv7gic_ybzv9t4s7eurhpyd...@mail.gmail.com...
> >
>> If the OP does clean his $_POST before putting the results in his 
>> database,
>> his database will look like 'poo' if the wrong person comes along.
>
>
> Gary had mentioned in his initial post he was testing on a local machine 
> and
> would add the checks after resolving this issue.
>
>
>>
>
> Also, the OP's code reads:
>
>  ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&
>
> That should be:
>
>  ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&
>
>
> Tedd, Gary's original code does include jpeg AND pjpeg types (if you omit
> pjpeg's, you'll miss some images.)
>
> That said, Gary, Tedd did point out some important issues with the logic 
> in
> your code.
>
> Additionally, you were asked politely to not top post, but you continued 
> to
>> do so. If you expect us to help you but you won't accommodate a simple, 
>> and
>> appropriate request, then don't expect any more help from me.
>
>
>> bye!
>
>
> Where was he asked to avoid top-posting in this thread?
>
> What is top posting?
>
>
> Gary, top-posting is when you add your content to an email thread at the 
> top
> (as opposed to the bottom) of the email message.  The preferred method of
> this list's admins is that you add your reply to the bottom of the message
> thread.  So, in future posts, please try to remember to add your message 
> to
> the bottom of the thread instead of the top.  Thanks :)
>
> Gary, what is the INSERT line for the images table supposed to be (it 
> looks
> like it got mangled in your copying and pasting?)
>
> $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model,
>
> caliber, condition, price, description, image_file_name,submitted
>
> ,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber',
>
> '$condition', '$price', '$description','$image_file_name', ' ',
>
> '$available');
>
>
>> INSERT INTO images (id, image_file) VALUES('','$image_file')";
>
>
>>  $sqlResult = $batchconnection->multi_query($sqlStatements);
>
>  if($sqlResult == true) {
>
>  echo "Successfully Inserted Records";
>
>  } else {
>
>  echo "Some Error Occured While Inserting Records";
>
> }
>
>
> Adam
>
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>

Adam

Thank thank you for your reply.

This is the code for the INSERT

 $sqlStatements = "INSERT INTO guns (manufacturer, type, model, caliber, 
condition, price, description, image_file_name, available) VALUES 
('$manufacturer', '$type', 
'$model','$caliber','$condition','$price','$description','$image_file_name','$available');

 INSERT INTO images(id, image_file) VALUES ('', '$image_file')";

This seems to be the stopping point because when I intentionaly create 
errors (connecting to db) then the error message I created shows up.  None 
of the data is being inserted into the DB.

This script works fine in another DB on the same server.

 $sqlStatements = "INSERT INTO images(caption, where_taken,description, 
file_name, image_file) VALUES ('$caption','$where_taken','$description', 
'$file_name','$image_file');

INSERT INTO keywords (image_id,fox, wolves, wildlife, scenic, birds, eagles, 
deer, small_mammals, large_mammals, dogs, cats, flowers, insects, bear, 
moose) 
VALUES('','$fox','$wolves','$wildlife','$scenic','$birds','$eagles','$deer', 
'$small_mammals', '$large_mammals','$dogs', '$cats', '$flowers', '$insects', 
'$bear', '$moose')";

As far as the whole "top posting".  I have been posting on this board for 2 
years (give or take), in fact have had a number of exchanges with tedd, (so 
I was a little surprised at his response). I have never heard the term top 
posting, I had not been asked not to top post.  Jim Lucas had at the bottom 
of his reply.

Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

However I read that as a signature line, not a request.

So, sorry if I offended.

Adam

Again, thank you for your response, I appriciate any help you might be able 
to offer.

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Adam Richardson
>
> If the OP does clean his $_POST before putting the results in his database,
> his database will look like 'poo' if the wrong person comes along.


Gary had mentioned in his initial post he was testing on a local machine and
would add the checks after resolving this issue.


>

Also, the OP's code reads:

  ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&

 That should be:

  ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&


Tedd, Gary's original code does include jpeg AND pjpeg types (if you omit
pjpeg's, you'll miss some images.)

That said, Gary, Tedd did point out some important issues with the logic in
your code.

Additionally, you were asked politely to not top post, but you continued to
> do so. If you expect us to help you but you won't accommodate a simple, and
> appropriate request, then don't expect any more help from me.


> bye!


Where was he asked to avoid top-posting in this thread?

What is top posting?


Gary, top-posting is when you add your content to an email thread at the top
(as opposed to the bottom) of the email message.  The preferred method of
this list's admins is that you add your reply to the bottom of the message
thread.  So, in future posts, please try to remember to add your message to
the bottom of the thread instead of the top.  Thanks :)

Gary, what is the INSERT line for the images table supposed to be (it looks
like it got mangled in your copying and pasting?)

$sqlStatements = "INSERT INTO guns( id,manufacturer, type, model,

caliber, condition, price, description, image_file_name,submitted

,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber',

'$condition', '$price', '$description','$image_file_name', ' ',

'$available');


> INSERT INTO images (id, image_file) VALUES('','$image_file')";


>  $sqlResult = $batchconnection->multi_query($sqlStatements);

  if($sqlResult == true) {

  echo "Successfully Inserted Records";

  } else {

  echo "Some Error Occured While Inserting Records";

}


Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Gary
What is top posting?

Gary


"tedd"  wrote in message 
news:p06240803c801ff96d...@[192.168.1.102]...
> At 11:27 AM -0400 5/1/10, Gary wrote:
>>Jim
>>
>>Thanks for your reponse.  With the variable defined. it is supposed to
>>reduce the size of the image before upload.
>>
>>Thanks again.
>>
>>Gary
>
> Gary:
>
> That is so wrong!
>
> Additionally, you were asked politely to not top post, but you continued 
> to do so. If you expect us to help you but you won't accommodate a simple, 
> and appropriate request, then don't expect any more help from me.
>
> bye!
>
> tedd
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Gary
Hi tedd

Thanks for your reply.

I have your http://webbytedd.com/b/thumb/ code inserted, and changed to 
this:

 if ( ! isset( $_GET['image_file'] ) ) die( 'Source image not specified' );
 $filename = $_GET['image_file'];

and I get the 'Source image not specified' error message.

I have also tried this

$sqlResult = $batchconnection->multi_query($sqlStatements);
   if($sqlResult == true) {
   echo "Successfully Inserted Records";
   } else {
   echo "mysql_error()";
}

To get the insertion error, but I dont seem to have a handle on it.

I just find it curious that the code works for one and not the other.  Both 
local servers are the same, I have compared DB parameters, looked at the 
code till by eye bleed,,, I just done see it.

Gary
"tedd"  wrote in message 
news:p06240801c801f2dad...@[192.168.1.102]...
> At 1:45 AM +0100 5/1/10, Ashley Sheridan wrote:
>>On Fri, 2010-04-30 at 20:43 -0400, Gary wrote:
>>
>>>  I have this duplicate code on another site and it works fine.  The 
>>> image is
>>>  uploaded to the images folder, the information is not submitted to the
>>>  database.  I get the error
>>>
>>>  Some Error Occured While Inserting Records
>>>
>>>  This is only on a local machine so I have not yet included and 
>>> safegaurds
>>>  like stripslashes or my_real_escape_string.
>>>
>>>  Thanks for your help
>>>
>>>  Gary
>>>
>>>  >>  if (isset($_POST['submit']))  {
>>>  $manufacturer=($_POST['manufacturer']);
>>>  $type=($_POST['type']);
>>>  $model=($_POST['model']);
>>>  $caliber=($_POST['caliber']);
>>>  $condition=($_POST['condition']);
>>>  $price=($_POST['price']);
>>  > $description=($_POST['description']);
>>
>>-
>
> -snip-
>
>>Is it possible that this server doesn't like batch queries? Try
>>splitting them out into individual queries and seeing if that helps. If
>>that doesn't do the trick, print out the SQL query string to see if it's
>>what you expect. It might be working fine on the other server, but I've
>>seen enough strange things happen before to know that sometimes 'poo'
>>happens.
>>
>>Thanks,
>>Ash
>>http://www.ashleysheridan.co.uk
>
> Ash:
>
> 'poo'? Wow, you're becoming quite the Hemingway  :-)
>
> If the OP does clean his $_POST before putting the results in his 
> database, his database will look like 'poo' if the wrong person comes 
> along.
>
> Also, the OP's code reads:
>
>  ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&
>
> That should be:
>
>  ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&
>
> Regardless of IF the code runs OK somewhere else it won't if it's dealing 
> with a jpeg or even a jpg image.
>
> Plus, the logic is screwed because --
>
>   $src = imagecreatefromjpeg($this -> originalFile);
>
> -- always assumes the file is going to be a jpeg, but then later he test 
> for different image types. What's the reason for that?
>
> And I don't see where he provides the values for $newWidth and $newHeight 
> used in the resample.
>
> Here's a simpler example:
>
> http://webbytedd.com/b/thumb/
>
> Just add the png type to the header content.
>
> Cheers,
>
> tedd
>
>
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread tedd

At 11:27 AM -0400 5/1/10, Gary wrote:

Jim

Thanks for your reponse.  With the variable defined. it is supposed to
reduce the size of the image before upload.

Thanks again.

Gary


Gary:

That is so wrong!

Additionally, you were asked politely to not top post, but you 
continued to do so. If you expect us to help you but you won't 
accommodate a simple, and appropriate request, then don't expect any 
more help from me.


bye!

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Gary
Jim

Thanks for your reponse.  With the variable defined. it is supposed to 
reduce the size of the image before upload.

Thanks again.

Gary

"Jim Lucas"  wrote in message 
news:4bdc311b.4060...@cmsws.com...
> Gary wrote:
>> I have this duplicate code on another site and it works fine.  The image 
>> is uploaded to the images folder, the information is not submitted to the 
>> database.  I get the error
>>
>> Some Error Occured While Inserting Records
>>
>> This is only on a local machine so I have not yet included and safegaurds 
>> like stripslashes or my_real_escape_string.
>>
>> Thanks for your help
>>
>> Gary
>>
>> > if (isset($_POST['submit']))  {
>> $manufacturer=($_POST['manufacturer']);
>> $type=($_POST['type']);
>> $model=($_POST['model']);
>> $caliber=($_POST['caliber']);
>> $condition=($_POST['condition']);
>> $price=($_POST['price']);
>> $description=($_POST['description']);
>> $image_file_name=($_POST['image_file_name']);
>> $image_file=($_FILES['image_file']);
>> $available=($_POST['available']);
>>
>> $image_file = $_FILES['image_file']['name'];
>> $image_type = $_FILES['image_file']['type'];
>> $image_size = $_FILES['image_file']['size'];
>>
>> include ('includes/connect_local.inc.php');
>>
>
> Is the following line suppose to be working with a constant or the 
> variable that you defined/extracted just above here?
>
>> if(image_size >300) {
>>
>> class ImgResizer {
>>  private $originalFile = 'image_file';
>>  public function __construct($originalFile = 'image_file') {
>>   $this -> originalFile = $originalFile;
>>  }
>>  public function resize($newWidth, $targetFile) {
>>   if (empty($newWidth) || empty($targetFile)) {
>>return false;
>>   }
>>   $src = imagecreatefromjpeg($this -> originalFile);
>>   list($width, $height) = getimagesize($this -> originalFile);
>>   $newHeight = ($height / $width) * $newWidth;
>>   $tmp = imagecreatetruecolor($newWidth, $newHeight);
>>   imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, 
>> $width, $height);
>>   if (file_exists($targetFile)) {
>>unlink($targetFile);
>>   }
>>   imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 
>> 0 - 100 for output image quality with 100 being the most luxurious
>>  }
>> }
>> }
>> if (!empty($type) && !empty($image_file)) {
>>   if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') 
>> || ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&
>
> By the use of a variable below, I'm guessing it was suppose to be a 
> variable.
>
>> ($image_size <300))  {
>> if ($_FILES['image_file']['error'] == 0) {
>>   // Move the file to the target upload folder
>>   $target = 'images/' . $image_file;
>>   if (move_uploaded_file($_FILES['image_file']['tmp_name'], 
>> $target)){
>> $batchconnection;
>>
>>  $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model, 
>> caliber, condition, price, description, image_file_name,submitted 
>> ,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber', 
>> '$condition', '$price', '$description','$image_file_name', ' ', 
>> '$available');
>>
>> INSERT INTO images (id, image_file) VALUES('','$image_file')";
>>
>>  $sqlResult = $batchconnection->multi_query($sqlStatements);
>>if($sqlResult == true) {
>>echo "Successfully Inserted Records";
>>} else {
>>echo "Some Error Occured While Inserting Records";
>> }
>>
>>
>>
>>}
>>
>> }
>>  }
>> }
>> mysqli_close($batchconnection);
>> }
>> ?> __ Information from ESET Smart Security, version of virus 
>> signature database 5076 (20100430) __
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>
>
> -- 
> Jim Lucas
>
> A: Maybe because some people are too annoyed by top-posting.
> Q: Why do I not get an answer to my question(s)?
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread tedd

At 1:45 AM +0100 5/1/10, Ashley Sheridan wrote:

On Fri, 2010-04-30 at 20:43 -0400, Gary wrote:


 I have this duplicate code on another site and it works fine.  The image is
 uploaded to the images folder, the information is not submitted to the
 database.  I get the error

 Some Error Occured While Inserting Records

 This is only on a local machine so I have not yet included and safegaurds
 like stripslashes or my_real_escape_string.

 Thanks for your help

 Gary

 
 > $description=($_POST['description']);

-


-snip-


Is it possible that this server doesn't like batch queries? Try
splitting them out into individual queries and seeing if that helps. If
that doesn't do the trick, print out the SQL query string to see if it's
what you expect. It might be working fine on the other server, but I've
seen enough strange things happen before to know that sometimes 'poo'
happens.

Thanks,
Ash
http://www.ashleysheridan.co.uk


Ash:

'poo'? Wow, you're becoming quite the Hemingway  :-)

If the OP does clean his $_POST before putting the results in his 
database, his database will look like 'poo' if the wrong person comes 
along.


Also, the OP's code reads:

 ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&

That should be:

 ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&

Regardless of IF the code runs OK somewhere else it won't if it's 
dealing with a jpeg or even a jpg image.


Plus, the logic is screwed because --

  $src = imagecreatefromjpeg($this -> originalFile);

-- always assumes the file is going to be a jpeg, but then later he 
test for different image types. What's the reason for that?


And I don't see where he provides the values for $newWidth and 
$newHeight used in the resample.


Here's a simpler example:

http://webbytedd.com/b/thumb/

Just add the png type to the header content.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Any One See where this is going wrong?

2010-05-01 Thread Jim Lucas

Gary wrote:
I have this duplicate code on another site and it works fine.  The image is 
uploaded to the images folder, the information is not submitted to the 
database.  I get the error


Some Error Occured While Inserting Records

This is only on a local machine so I have not yet included and safegaurds 
like stripslashes or my_real_escape_string.


Thanks for your help

Gary



Is the following line suppose to be working with a constant or the 
variable that you defined/extracted just above here?



if(image_size >300) {

class ImgResizer {
 private $originalFile = 'image_file';
 public function __construct($originalFile = 'image_file') {
  $this -> originalFile = $originalFile;
 }
 public function resize($newWidth, $targetFile) {
  if (empty($newWidth) || empty($targetFile)) {
   return false;
  }
  $src = imagecreatefromjpeg($this -> originalFile);
  list($width, $height) = getimagesize($this -> originalFile);
  $newHeight = ($height / $width) * $newWidth;
  $tmp = imagecreatetruecolor($newWidth, $newHeight);
  imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, 
$height);

  if (file_exists($targetFile)) {
   unlink($targetFile);
  }
  imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 - 
100 for output image quality with 100 being the most luxurious

 }
}
}
if (!empty($type) && !empty($image_file)) {
  if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') || 
($image_type == 'image/pjpeg') || ($image_type == 'image/png') && 


By the use of a variable below, I'm guessing it was suppose to be a 
variable.



($image_size <300))  {
if ($_FILES['image_file']['error'] == 0) {
  // Move the file to the target upload folder
  $target = 'images/' . $image_file;
  if (move_uploaded_file($_FILES['image_file']['tmp_name'], 
$target)){

$batchconnection;

 $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model, 
caliber, condition, price, description, image_file_name,submitted 
,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber', 
'$condition', '$price', '$description','$image_file_name', ' ', 
'$available');


INSERT INTO images (id, image_file) VALUES('','$image_file')";

 $sqlResult = $batchconnection->multi_query($sqlStatements);
   if($sqlResult == true) {
   echo "Successfully Inserted Records";
   } else {
   echo "Some Error Occured While Inserting Records";
}



   }

}
 }
}
mysqli_close($batchconnection);
}
?> 




__ Information from ESET Smart Security, version of virus signature 
database 5076 (20100430) __

The message was checked by ESET Smart Security.

http://www.eset.com








--
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



Re: [PHP] Any One See where this is going wrong?

2010-04-30 Thread kranthi
may be it is not the error with the code. The problem may be with some
'  in the input. Print out the mysql error and/or the sql query to see
what is going wrong.

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



Re: [PHP] Any One See where this is going wrong?

2010-04-30 Thread Gary
This is the other code that works on the same server.

 300) {

class ImgResizer {
 private $originalFile = '';
 public function __construct($originalFile = '') {
  $this -> originalFile = $originalFile;
 }
 public function resize($newWidth, $targetFile) {
  if (empty($newWidth) || empty($targetFile)) {
   return false;
  }
  $src = imagecreatefromjpeg($this -> originalFile);
  list($width, $height) = getimagesize($this -> originalFile);
  $newHeight = ($height / $width) * $newWidth;
  $tmp = imagecreatetruecolor($newWidth, $newHeight);
  imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, 
$height);
  if (file_exists($targetFile)) {
   unlink($targetFile);
  }
  imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 - 
100 for output image quality with 100 being the most luxurious
 }
}
}

if (!empty($caption) && !empty($image_file)) {
  if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') || 
($image_type == 'image/pjpeg') || ($image_type == 'image/png') && 
($image_size < 300))  {
if ($_FILES['image_file']['error'] == 0) {
  // Move the file to the target upload folder
  $target = 'images/' . $image_file;
  if (move_uploaded_file($_FILES['image_file']['tmp_name'], 
$target)){
$batchconnection;

   $sqlStatements = "INSERT INTO images(caption, 
where_taken,description, image_file) VALUES 
('$caption','$where_taken','$description','$image_file');

INSERT INTO keywords (image_id,fox, wolves, wildlife, scenic, birds, eagles, 
deer, small_mammals, large_mammals, dogs, cats, flowers, insects, bear, 
moose) 
VALUES('','$fox','$wolves','$wildlife','$scenic','$birds','$eagles','$deer', 
'$small_mammals', '$large_mammals','$dogs', '$cats', '$flowers', '$insects', 
'$bear', '$moose')";


 $sqlResult = $batchconnection->multi_query($sqlStatements);
   if($sqlResult == true) {
   echo "Successfully Inserted Records";
   } else {
   echo "Some Error Occured While Inserting Records";
}

mysqli_close($batchconnection);

   }

}
 }
  }
}
?>
"Ashley Sheridan"  wrote in message 
news:1272674704.9998.11.ca...@localhost...
> On Fri, 2010-04-30 at 20:43 -0400, Gary wrote:
>
>> I have this duplicate code on another site and it works fine.  The image 
>> is
>> uploaded to the images folder, the information is not submitted to the
>> database.  I get the error
>>
>> Some Error Occured While Inserting Records
>>
>> This is only on a local machine so I have not yet included and safegaurds
>> like stripslashes or my_real_escape_string.
>>
>> Thanks for your help
>>
>> Gary
>>
>> > if (isset($_POST['submit']))  {
>> $manufacturer=($_POST['manufacturer']);
>> $type=($_POST['type']);
>> $model=($_POST['model']);
>> $caliber=($_POST['caliber']);
>> $condition=($_POST['condition']);
>> $price=($_POST['price']);
>> $description=($_POST['description']);
>> $image_file_name=($_POST['image_file_name']);
>> $image_file=($_FILES['image_file']);
>> $available=($_POST['available']);
>>
>> $image_file = $_FILES['image_file']['name'];
>> $image_type = $_FILES['image_file']['type'];
>> $image_size = $_FILES['image_file']['size'];
>>
>> include ('includes/connect_local.inc.php');
>>
>> if(image_size >300) {
>>
>> class ImgResizer {
>>  private $originalFile = 'image_file';
>>  public function __construct($originalFile = 'image_file') {
>>   $this -> originalFile = $originalFile;
>>  }
>>  public function resize($newWidth, $targetFile) {
>>   if (empty($newWidth) || empty($targetFile)) {
>>return false;
>>   }
>>   $src = imagecreatefromjpeg($this -> originalFile);
>>   list($width, $height) = getimagesize($this -> originalFile);
>>   $newHeight = ($height / $width) * $newWidth;
>>   $tmp = imagecreatetruecolor($newWidth, $newHeight);
>>   imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, 
>> $width,
>> $height);
>>   if (file_exists($targetFile)) {
>>unlink($targetFile);
>>   }
>>   imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 
>> 0 -
>> 100 for output image quality with 100 being the most luxurious
>>  }
>> }
>> }
>> if (!empty($type) && !empty($image_file)) {
>>   if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') 
>> ||
>> ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&
>> ($image_size <300))  {
>> if ($_FILES['image_file']['error'] == 0) {
>>   // Move the file to the target upload folder
>>   $target = 'images/' . $image_file;
>>   if (move_uploaded_file($_FILES['image_file']['tmp_name'],
>> $target)){
>> $batchconnection;
>>
>>  $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model,
>> caliber, condition, price, description, image_file_name,submitted
>> ,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber',
>> '$condition', '$price', '$description','$image_file_name', ' ',
>> '$available');
>>
>> INSERT INTO images (id, image_file) VALUES('','$image_file')";

Re: [PHP] Any One See where this is going wrong?

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 20:43 -0400, Gary wrote:

> I have this duplicate code on another site and it works fine.  The image is 
> uploaded to the images folder, the information is not submitted to the 
> database.  I get the error
> 
> Some Error Occured While Inserting Records
> 
> This is only on a local machine so I have not yet included and safegaurds 
> like stripslashes or my_real_escape_string.
> 
> Thanks for your help
> 
> Gary
> 
>  if (isset($_POST['submit']))  {
> $manufacturer=($_POST['manufacturer']);
> $type=($_POST['type']);
> $model=($_POST['model']);
> $caliber=($_POST['caliber']);
> $condition=($_POST['condition']);
> $price=($_POST['price']);
> $description=($_POST['description']);
> $image_file_name=($_POST['image_file_name']);
> $image_file=($_FILES['image_file']);
> $available=($_POST['available']);
> 
> $image_file = $_FILES['image_file']['name'];
> $image_type = $_FILES['image_file']['type'];
> $image_size = $_FILES['image_file']['size'];
> 
> include ('includes/connect_local.inc.php');
> 
> if(image_size >300) {
> 
> class ImgResizer {
>  private $originalFile = 'image_file';
>  public function __construct($originalFile = 'image_file') {
>   $this -> originalFile = $originalFile;
>  }
>  public function resize($newWidth, $targetFile) {
>   if (empty($newWidth) || empty($targetFile)) {
>return false;
>   }
>   $src = imagecreatefromjpeg($this -> originalFile);
>   list($width, $height) = getimagesize($this -> originalFile);
>   $newHeight = ($height / $width) * $newWidth;
>   $tmp = imagecreatetruecolor($newWidth, $newHeight);
>   imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, 
> $height);
>   if (file_exists($targetFile)) {
>unlink($targetFile);
>   }
>   imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 - 
> 100 for output image quality with 100 being the most luxurious
>  }
> }
> }
> if (!empty($type) && !empty($image_file)) {
>   if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') || 
> ($image_type == 'image/pjpeg') || ($image_type == 'image/png') && 
> ($image_size <300))  {
> if ($_FILES['image_file']['error'] == 0) {
>   // Move the file to the target upload folder
>   $target = 'images/' . $image_file;
>   if (move_uploaded_file($_FILES['image_file']['tmp_name'], 
> $target)){
> $batchconnection;
> 
>  $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model, 
> caliber, condition, price, description, image_file_name,submitted 
> ,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber', 
> '$condition', '$price', '$description','$image_file_name', ' ', 
> '$available');
> 
> INSERT INTO images (id, image_file) VALUES('','$image_file')";
> 
>  $sqlResult = $batchconnection->multi_query($sqlStatements);
>if($sqlResult == true) {
>echo "Successfully Inserted Records";
>} else {
>echo "Some Error Occured While Inserting Records";
> }
> 
> 
> 
>}
> 
> }
>  }
> }
> mysqli_close($batchconnection);
> }
> ?> 
> 
> 
> 
> __ Information from ESET Smart Security, version of virus signature 
> database 5076 (20100430) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
> 
> 
> 
> 


Is it possible that this server doesn't like batch queries? Try
splitting them out into individual queries and seeing if that helps. If
that doesn't do the trick, print out the SQL query string to see if it's
what you expect. It might be working fine on the other server, but I've
seen enough strange things happen before to know that sometimes 'poo'
happens.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Any One See where this is going wrong?

2010-04-30 Thread Gary
I have this duplicate code on another site and it works fine.  The image is 
uploaded to the images folder, the information is not submitted to the 
database.  I get the error

Some Error Occured While Inserting Records

This is only on a local machine so I have not yet included and safegaurds 
like stripslashes or my_real_escape_string.

Thanks for your help

Gary

300) {

class ImgResizer {
 private $originalFile = 'image_file';
 public function __construct($originalFile = 'image_file') {
  $this -> originalFile = $originalFile;
 }
 public function resize($newWidth, $targetFile) {
  if (empty($newWidth) || empty($targetFile)) {
   return false;
  }
  $src = imagecreatefromjpeg($this -> originalFile);
  list($width, $height) = getimagesize($this -> originalFile);
  $newHeight = ($height / $width) * $newWidth;
  $tmp = imagecreatetruecolor($newWidth, $newHeight);
  imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, 
$height);
  if (file_exists($targetFile)) {
   unlink($targetFile);
  }
  imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 - 
100 for output image quality with 100 being the most luxurious
 }
}
}
if (!empty($type) && !empty($image_file)) {
  if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') || 
($image_type == 'image/pjpeg') || ($image_type == 'image/png') && 
($image_size <300))  {
if ($_FILES['image_file']['error'] == 0) {
  // Move the file to the target upload folder
  $target = 'images/' . $image_file;
  if (move_uploaded_file($_FILES['image_file']['tmp_name'], 
$target)){
$batchconnection;

 $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model, 
caliber, condition, price, description, image_file_name,submitted 
,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber', 
'$condition', '$price', '$description','$image_file_name', ' ', 
'$available');

INSERT INTO images (id, image_file) VALUES('','$image_file')";

 $sqlResult = $batchconnection->multi_query($sqlStatements);
   if($sqlResult == true) {
   echo "Successfully Inserted Records";
   } else {
   echo "Some Error Occured While Inserting Records";
}



   }

}
 }
}
mysqli_close($batchconnection);
}
?> 



__ Information from ESET Smart Security, version of virus signature 
database 5076 (20100430) __

The message was checked by ESET Smart Security.

http://www.eset.com





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