e_i_pi's Profile User Rating: *****

Reputation: 850 Master
Group:
Mentors
Active Posts:
1,821 (0.69 per day)
Joined:
30-January 09
Profile Views:
58,027
Last Active:
User is offline Today, 09:13 PM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
Playstation
Your Car:
Mitsubishi
Dream Kudos:
75
Expert In:
Databases

Latest Visitors

Icon   e_i_pi has set their status

Posts I've Made

  1. In Topic: Interesting truncation

    Posted 2 May 2016

    You should be treating it as a string anyway... how is it getting into the system as an integer with a leading zero? Not from a database or a form field, it would come in as string from those. And surely you're not explicitly declaring it in your code if it's an account type number.
  2. In Topic: Interesting truncation

    Posted 2 May 2016

    It's an octal number. Octal numbers are represented in the format 0nnn..., where nnn... is the number. As per the manual:

    Quote

    Warning
    Prior to PHP 7, if an invalid digit was given in an octal integer (i.e. 8 or 9), the rest of the number was ignored. Since PHP 7, a parse error is emitted.

    So, your number is being ignored once it hits the 9. 1011 from octal to decimal is 521.

    CASE DISMISSED!
  3. In Topic: Trouble with Case statement with select

    Posted 12 Apr 2016

    View PostSoundWaves, on 12 April 2016 - 09:13 PM, said:

    I am unable to use your query though, it tries to look for a match on every row. The DocId is an integer and the ButtonLink is either a matching integer or a file path. When it tries to compare the two it breaks the query. I may add another field to the table to store the foreign key of the document and keep them separate.

    It's best to store data types separately, so I would suggest moving the document ID to it's own nullable column. You can JOIN on integer to varchar, you just have to cast the integer to varchar, but as I said it would be best to keep integer data in an integer field and then foreign key constrain it
  4. In Topic: Trouble with Case statement with select

    Posted 11 Apr 2016

    Well, your SQL is pretty messy and not really doing what you want by the looks. Assuming the join between Machine_Links and QCBD_Files does not generate duplicate rows, you're probably after something like this:
    SELECT Machine_Links.Button_Id, Machine_Links.Machine_Id, Machine_Links.Button_Position, Machine_Links.Button_Name, Machine_Links.Button_Type, Machine_Links.Button_Link, 
    CASE WHEN Machine_Links.Button_Type = 'QCBD_Link'
    	THEN QCBD_Files.Doc_Name
    	ELSE Machine_Links.Button_Link
    END AS Link_Text
    FROM Machine_Links
    LEFT OUTER JOIN QCBD_Files ON QCBD_Files.Doc_Id=Machine_Links.Button_Link
    WHERE Machine_Links.Machine_Id = 6
    
    

    Note that the tables are not separated by a comma. Separating with a comma is SQL-89 standard, and you run into major problem with cartesian products when missing JOIN predicates (like you are). The SQL-92 standard, where you use LEFT OUTER JOIN / RIGHT OUTER JOIN / INNER JOIN / CROSS JOIN and FULL JOIN forces predicates, so is better to use and more current (I'll let you google that).

    Notice that I have made a LEFT OUTER JOIN from Machine_Links to QCBD_Files. This means that every row of Machine_Links will be returned, and if a row exists in QCBD_Files where QCBD_Files.Doc_Id=Machine_Links.Button_Link, then we'll get that information as well. Since it is LEFT OUTER JOIN, if QCBD_Files does not have a corresponding row, the row from Machine_Links will still be returned, but all the values for QCBD_Files for that row will be NULL. Also something to keep in mind is if there are multiple rows in QCBD_Files where QCBD_Files.Doc_Id=Machine_Links.Button_Link then multiple (potentially duplicate) rows will be returned in the query. I'm not sure how your database is structured, otherwise I could offer some help there. See how you go, that query may well fix your issue. Also, I would highly recommend doing some online study of basic SQL syntax to brush up your skills. Any tutorial that has text such as FROM table1, table2, ..., close that window straight away, they are trying to poison your brain with bad information :)/>
  5. In Topic: Is PHP going to die?

    Posted 10 Apr 2016

    View Postlordofduct, on 06 April 2016 - 12:38 AM, said:

    So it was removed just a few months ago? Since PHP7 was only just released in December.

    It only reasserts to me that PHP is still the hellscape it was the last time I used it. Bloated, quarky, "easy to learn - easy to break".

    Hey, let's keep the punches above the belt, there's no need to accuse PHP of being a theoretical particle.

My Information

Member Title:
= -1
Age:
41 years old
Birthday:
June 24, 1974
Gender:
Location:
Australia
Years Programming:
4
Programming Languages:
HTML, XML, jQuery, PHP, SQL, MySQL, VBA, VBScript, PostgreSQL, C#, SSRS, SSIS, Crystal, BIML, Java

Contact Information

E-mail:
Private
Website URL:
Website URL  http://www.artofwar.cc/

Comments

Page 1 of 1
  1. Photo

    cupidvogel Icon

    09 Jun 2012 - 11:30
    Ha ha, I really liked your "if(navigator.appName == 'Microsoft Internet Explorer')" theme!
  2. Photo

    Duckington Icon

    04 Apr 2012 - 00:57
    It's not live yet, still developing and then going into beta test. I haven't actually decided on a name yet, so no domain for it.
  3. Photo

    modi123_1 Icon

    13 Mar 2012 - 06:56
    Ha.. well good luck with it.. it's always a good butt of a joke.
  4. Photo

    RudiVisser Icon

    08 Mar 2012 - 15:20
    You know, I only just worked out what your avatar is. Love it!
  5. Photo

    RudiVisser Icon

    06 Sep 2011 - 00:37
    Thank you very much :-D
  6. Photo

    RudiVisser Icon

    06 Sep 2011 - 00:37
    Thank you very much :-D
  7. Photo

    e_i_pi Icon

    05 Sep 2011 - 22:15
    Ah thank you :) I'm a fan of minimalism, so I wwanted something nice and simple, plus you just can't go past red and black!
  8. Photo

    no2pencil Icon

    05 Sep 2011 - 19:52
    Love your avatar!
  9. Photo

    Sayid Ahmed Icon

    13 Jul 2011 - 14:02
    thanks for the add.
  10. Photo

    Dormilich Icon

    17 Feb 2011 - 13:25
    just wanted to congratulate for the funny thread title "OOP, PDOs, pain, tears".
Page 1 of 1