[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

PHP REEEEEEEE

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 28
Thread images: 1

File: 2647d.jpg (10KB, 252x221px) Image search: [Google]
2647d.jpg
10KB, 252x221px
$tsql = "INSERT INTO dbo.order(order_client,
order_contact,
order_vendor,
order_iteminfo,
order_ourcost,
order_ourshipping,
order_pricequote,
order_shipquote,
order_shipinfo,
order_requestor)
VALUES (?,?,?,?,?,?,?,?,?,?)";

$params = array(&$_POST['order_client'],
&$_POST['order_contact'],
&$_POST['order_vendor'],
&$_POST['order_iteminfo'],
&$_POST['order_ourcost'],
&$_POST['order_ourshipping'],
&$_POST['order_pricequote'],
&$_POST['order_shipquote'],
&$_POST['order_shipinfo'],
&$_POST['order_requestor']);

>[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near the keyword 'order'.
>near the keyword 'order'.
>'order'.

Thanks that helps.
>>
>>56262367
that's some terrible nomenclature man

why so many business people not realize that table/object/etc names contextually describe their fucking members is beyond me
>>
>>56262390
Why is that bad? Would you rather have it named 'obj1', 'obj2', etc?

It really doesn't matter what it's called. It's just easy reference for me. It's worked on a number of other scripts I just don't know why this is giving me this error. I might have to go home and get drunk tonight and then come back at it with a fresh set of eyes in the morning.
>>
>>56262390
I see where you're go I'll modify the tables and take 'order' out of it.
>>
>>56262367
Holy shit get out of that hell as soon as possible
>>
>>56262390
Nevermind, duh. I see where you were going with this. I'll take 'order' out all together except for the table name.
>>
>>56262367
>has a terribly designed database with terribly named tables containing terribly named columns
>writes terribly ugly code to bind raw user-supplied data to a syntactically incorrect parametrized query
>gets an error message from the DBMS
>blames PHP
Is your name Pajeet?
>>
>VALUES (?,?,?,?,?,?,?,?,?,?)";
>>
>>56262482
I couldnt have said it better, thank you
>>
>takes out 'order'
>same error message

wew
>>
>>56262447
He was talking about the order_ prefixes you retard.
>>
>>56262482
It's just a temporary test database for a demonstration for further development.
>>
>>56262550
>damage controlling this hard
Come on anon, everyone knows it's your production code
>>
>>56262576
No I just need something in place for orders like, right now. It's just a temporary setup.

I don't have time to make it pretty yet. I did similar code for the client list and it worked just fine.

I know trolling me is fun, but I'm just not seeing the syntax error.
>>
>>56262615
Then use phpmyadmin
>>
Try Gentoo
>>
>>56262650
I'm using SQL express though, not MySQL
>>
Ok this works:

$tsql = "INSERT INTO dbo.client(client_name,
client_phone,
client_address,
client_city,
client_state,
client_zip)
VALUES (?,?,?,?,?,?)";

$params = array(&$_POST['client_name'],
&$_POST['client_phone'],
&$_POST['client_address'],
&$_POST['client_city'],
&$_POST['client_state'],
&$_POST['client_zip']);

But not this:

$tsql = "INSERT INTO dbo.order(client,
contact,
vendor,
iteminfo,
ourcost,
ourshipping,
pricequote,
shipquote,
shipinfo,
requestor)
VALUES (?,?,?,?,?,?,?,?,?,?)";

$params = array(&$_POST['order_client'],
&$_POST['contact'],
&$_POST['vendor'],
&$_POST['iteminfo'],
&$_POST['ourcost'],
&$_POST['ourshipping'],
&$_POST['pricequote'],
&$_POST['shipquote'],
&$_POST['shipinfo'],
&$_POST['requestor']);

I don't see what I'm missing here.
>>
>>56262849
>I don't see what I'm missing here.
Because you're a retard who should never touch the keyboard. Really, consider killing yourself.
>>
GOT IT!!!

'order' is a reserved word, I changed it to:

INSERT INTO dbo.[order](client,

And it worked.
>>
>>56263118
t. dumbass faggot who can't figure out what the problem was.
>>
>>56263150
Not being able to figure out the problem from an error message explicitly mentioning _keyword_ 'order' is not why you should consider changing profession to shoveling shit. Inserting user supplied data to a disgusting, non-normalized database using ugly as fuck PHP code is. People like you are the reason why everyone shits on PHP more than it actually deserves, Pajeet.
>>
>>56263282
But I did figure it out by that metric you dumb fucking NEET. Are you employed?

The first response prompted me to take the dozens of 'order' prefixes out which was actually helpful advice.

That helped me narrow it down. Upon further research, I found out that 'order' is a reserved word and put it in brackets []. This solved the problem.

Please kill yourself immediately you retard.
>>
>>56262447
databased called "erp" or something
table called "order"
column called "iteminfo"

full path erp.order.iteminfo. concise as fuck.

>>56262466
>>56262479
please normalize also. you should have an "order" table and an "order_products" (or something) table with a one-to-many relation between the two.
>>
>>56263384
Thanks for the advice. I am building an ordering table for adding in relational tables that I'm developing, but for now I just needed something today as our other ordering software is expired and we had literally nothing.

I got the problem narrowed down and it's running for now. Thanks anon you saved my ass.
>>
> 2016
> using PHP and not RUBY master race
>>
>>56262492

Standard parameter binding, granted, the sane among us would use ?1, ?2, ?3 or :client, :contact, :vendor.

That said, I fucking hate it when people do that shit. I'm in the goddamned order table, I know it's the id of the fucking order, you don't need to name it order_id. I can tolerate that shit with foreign keys, but I'd prefer that it was the table name and we can assume that it maps to the primary key.
>>
>>56262367

I bet whoever designed this schema inserts delimited strings and thinks they're being clever.
Thread posts: 28
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.