Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

PHP & MySQL

Name: wowzor 2013-05-30 10:45

im making e-commerce and im having issue to add from dropmenu value 0 or 1 (availability) into my database. when i try send that query it save all datas except availability. thanks for any advice
            <select name="dostupnost">
              <option selected="selected">Vyberte možnost</option>
              <option value="1">Skladem</option>
              <option value="0">Není skladem</option>
            </select>

    if(isset($_POST["name"])) {
      require "connect.php";
      $name=$_POST["name"];
      $price=$_POST["price"];
      $quantity=$_POST["quantity"];
      $availability=$_POST["availability"];
      $describe=$_POST["describe"];
      $regex = '/[0-9]+/'; //Only numbers

      $sql = "INSERT INTO products (name, describe, price, quantity, date_added, availability) VALUES (\"$name\", \"$describe\", \"$price\", \"$quantity\", NOW(), \"availability\")";
      //$echo $sql;
      $ok = mysql_query($sql) or die (mysql_error());

Name: Anonymous 2013-05-30 10:51

Data is already plural, you don't need to put an 's' on the end.

Name: Anonymous 2013-05-30 10:51

PHP is defective by design. There is simply no apology for PHP flaws:
1. Inconsistent lexical scope, where assignment acts as declaration and all variables have function scope, serving as major source of PHP bugs and impeding functional programming, because in PHP anonymous functions require awfully verbose constructions, like `function($y) use ($x) {`. Compared to Scheme/Racket, which uses `let` for everything, PHP's global scope is completely separate entity and requires explicit use of `global` keyword to access variables. PHP has no package system, so global namespace becomes unmanageably cluttered. Moreover, referencing nonexistent variable isn't even an error, so any typo produces untraceable bug. Finally, PHP allows non-string variable names: $a=array();$$a='broken'; print ${array()};
2. Inconsistent standard library: for example, shuffle(123) would return false, instead of logging error and halting execution, before more damage is done; same for accessing array beyond bounds, which is even worser than C/C++, where such access at least produces segmentation fault. Despite null also being valid JSON object, json_decode returns null on error, welcoming bugs if user forgets json_last_error. Functions sizeof, count `print` and `echo` duplicate functionality, while `print` for some reason always returns 1. Moreover, PHP arrays are implemented as hash tables, so there is no way to get their real size or iterate by indices at all. PHP standard library basically indulges hard to trace bugs, exploits and backdoors, because almost any PHP feature is fragile and poses security danger. Inconsistent function naming: underscores (isset vs is_null), abbreviations (call_user_func vs create_function), uncertain parameter order (in_array($needle, $haystack) vs strpos($haystack, $needle)), redundant aliases (disk_free_space vs diskfreespace, strcmp vs ==), misleading names (addslashes and stripslashes, which deal with backslashes). PHP's one unique operator is @ (actually borrowed from DOS), which silences errors.
3. Broken and non-portable type system: PHP stores integers in a platform-dependent format, usually 64-bit or 32-bit signed integer, equivalent to the C-language long type. Even worse: big integers are represented as floating point numbers, so 9999999999999999999==10000000000000000000. Confusing automatic type coercion, where FALSE=="", FALSE==0, array()==FALSE, array()!=0, "1e3"=="1000", "0x10"=="16" "a"+"d"==0, 123=="123broken", "4.2"=="4.20", "6"==" 6", "x"==0", NULL<-1, NULL==0. Be prepared to a lot of instant bugs, like if(strpos($h,$n)) {...}, because 0 gets converted to FALSE, behind your back. Due to broken `<` sorting is nondeterministic.
4. Inconsistent garbage collection, performed only when you tell PHP to do it or passing specific junctions. In some cases memory lost until program halts, which unnoticeable with small one shot page generation scripts, but poses a major handicap for general purpose programming using PHP, when code must run for days.
5. Discrepancy between literals and variables, growing from variables being objects themselves: given $a="foo", var_dump($a instanceof stdClass) works, but var_dump("foo" instanceof stdClass) produces error; same with array literals: $a[0] works, but array(1,2,3)[0] fails. Array assignment always involves deep copying, which is confusing and bad for performance. Function may be called via variable, containing function name, leading to badly designed and insecure code, welcoming exploits, especially when function name comes from use input.
6. Fugly syntax: every PHP variable requires `$` prefix, which looks even scarier when combined with `&`, required to pass objects by reference, so be prepared for quirky perl-ugly code, like &$o[i++] and !--$$i. The syntax has 1375 conflicts and 6 unused terminals, reflecting that implementors had no understanding of LALR(1) parser generators or robust language design in general, because with that many conflicts, the chances are slime that the parser is actually doing 100% of what was intended: for example "a".2 produces an error, but "a"."2", "a" . 2 and 1 . 2 parse as string concatenation, while 1.2 and .2 parse as numbers, worser 0x0+2==4, but 0x0+ 2==2 so meaning of operator depends on spaces around it.  Usual `{` and `}` braces can be interchanged with `:` and `endif;`, which is aggravated by the fact that PHP syntax treats { and ${ as separate tokens (T_CURLY_OPEN and T_DOLLAR_OPEN_CURLY_BRACES), making PHP syntax bigger and even less regular: PHP has around 70 keywords, including echo, eval and exit, which in well designed languages implemented as functions. Appending to an array is done with $foo[] = $bar.
7. No multithreading support possible, because PHP is full of global and implicit state. mbstring uses a global character set. func_get_arg and friends look like regular functions, but operate on the currently-executing function. Error handling have global defaults. register_tick_function sets a global function to run every tick.
8. When faced with criticism, all PHP apologists spit generic arguments, starting with banal ad-hominem, which speak for themselves: "all languages are turing complete", "languages are just tools", "no language is perfect", "good developers can write good code in any language", "PHP was never intended to solve problem X", "PHP isn't the problem, bad programmers are", "products X was built using PHP, so PHP is good enough", "there are two kinds of languages: the ones complained about and the ones nobody uses", "PHP is free, hosting is available, PHP programmers are cheap", "clients don't care what language is used", "PHP has great community, we are like family", "if you do X then problem Y would be less noticeable", and a myriad of variations. The best examples of PHP apologetics, like https://news.ycombinator.com/item?id=4177516 , contain gems in the lines of "Sometimes you don't care if a function succeeds" - in other words, PHP community doesn't care if their code succeeds.
9. PHP is Jewish language, developed by Israeli company with unclear agenda. It is entirely possible that PHP is just a trojan horse and real goal was to produce exploit-happy environment, which Israeli intelligence agencies could leverage to advance interests of Israel. Being originally a collection of CGI scripts designed for building a 'personal home page', PHP indulges messy, unmaintainable code: spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places.

Name: Anonymous 2013-05-30 10:52

>>2
Data is already plural, you don't need to put an 's' on the end.
He is a Polish kike. "Vyberte možnost" is polish.

Name: Anonymous 2013-05-30 10:55

>>4
That's no excuse for not knowing Latin.

Name: wowzor 2013-05-30 11:00

what about help me, huh ? and bro im not from poland so its not polish

Name: Anonymous 2013-05-30 11:03

>>6
No matter. You're Jewish, because you're from Eastern 'Jewish' Europe and write PHP - Jewish language.

Name: wowzor 2013-05-30 11:04

bruh ive green card i live in 'MERICA, also im atheist

Name: Anonymous 2013-05-30 11:07

>>5
latin is "datum"

i.e. what is given. I'm pretty sure in his slavic language it sounds the same, sometihn like "dati".

Name: Anonymous 2013-05-30 11:07

>>8

A Jew who says "I'm an atheist" still says "I'm a Jew."
A Jew who says "I'm a Buddhist" still says "I'm a Jew."

Jews consider their ethnicity more fundamental than religious beliefs. Jews use religion as a cover for their ethnocentrism.

Name: Anonymous 2013-05-30 11:10

>>9
i.e. in polish datum is:

dać
   
give, let, provide, allow, have, yield
   
   
podać
   
give, offer, make out, let have, pass over, pose
   
   
nadać
   
give, grant, confer, transmit, endow, vest
   
   
ofiarować
   
offer, give, present, devote, proffer, dedicate
   
   
podarować
   
give, donate, present
   
   
poświęcać
   
spend, devote, sacrifice, dedicate, give, consecrate
   
   
zadać
   
inflict, set, give, launch, smite, blow
   
   
poddać się
   
surrender, give up, give in, yield, give, knock under

Name: Anonymous 2013-05-30 11:26

At least he had the decency to use the code tag.

Name: Anonymous 2013-05-30 11:42

At least he had the decency to allow HOT MANLY SQL INJECTION

Name: Anonymous 2013-05-30 11:52

HOT MANLY SQL INJECT MY ANUS

Name: Anonymous 2013-05-30 13:18

PHP
The hour will come in which all the peoples of the earth will awake, and the Jews will be the victims. -- Joseph Goebbels, 21 January 1945

Name: Anonymous 2013-05-30 13:20

PHP
The hour will come in which all the peoples of the earth will awake, and the Jews will be the victims. -- Joseph Goebbels, 21 January 1945

Name: Anonymous 2013-05-30 13:24

PHP

The hour will come in which all the peoples of the earth will awake, and the Jews will be the victims. -- Joseph Goebbels, 21 January 1945

Name: Anonymous 2013-05-30 14:52

PHP
MySQL
im making e-commerce

★★★★☆

Name: Anonymous 2013-05-30 15:50

                                                        `
>trusting PHP to handle money

Name: Anonymous 2013-05-30 15:51

>>19
Tell that to Americunts.

Name: Anonymous 2013-05-30 15:54

>>20
And to all other countries, who jew-owned central banks.

Name: Anonymous 2013-05-30 16:10

>>21
Which includes mother Russia (jewish by halakha)

Name: Anonymous 2013-05-30 16:40

>>22
Russia had some nazis advocating CB nationalization, but they were suppressed.

Name: Anonymous 2013-05-30 16:49

>>23
I know, and of course they were, with as many kikes as there are in Russia there's no way they wouldn't be mossaded ASAP.

Name: Anonymous 2013-05-30 18:22

Russia is kikes.

Name: Anonymous 2013-05-30 19:45

>>22
mother Russia (jewish by halakha)
fuck this I lel'd

>>23
a stopped clock tells the right time twice a day

Don't change these.
Name: Email:
Entire Thread Thread List