Atli's Profile User Rating: *****

Reputation: 3730 Guru
Group:
Moderators
Active Posts:
6,476 (3.97 per day)
Joined:
08-June 10
Profile Views:
81,278
Last Active:
User is offline Nov 20 2014 12:29 PM
Currently:
Offline

Previous Fields

Country:
IS
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Mitsubishi
Dream Kudos:
275
Expert In:
PHP, Databases, Web Development
Icon   Atli has not set their status

Posts I've Made

  1. In Topic: Column Is not increment by one.

    Posted 6 Nov 2014

    I won't write the code for you, no.

    The process of how you do this is actually quite simple. You just have to:

    • INSERT the delivery details into your Delivery table.
    • Grab the ID of the row you just inserted. - How you do that is explained in the docs for each MySQL API: PDO, MySQLi, or the Old MySQL API. (Using the Old API is bad!)
    • If your Order entries already exist, UPDATE them with the Delivery ID.
    • If they don't exist, INSERT the Orders, and pass the Delivery ID into them.
  2. In Topic: Column Is not increment by one.

    Posted 6 Nov 2014

    OK, so just to make sure I'm understanding you correctly. (There seems to be a bit of a language barrier here.)

    You want to create a Delivery table, where each row in that Delivery table is linked to one or more of the items in your Order table?

    There is no need to create an incrementing field in the Order table for that. Relational Databases (which is what MySQL is) have standard methods to deal with such situations; relationships between tables that can easily be added and will be enforced by the database.

    In your case, if you want one Delivery to be able to link back to one or more Order, you create what we call a One-To-Many relationship (1:N). That means that you create a Delivery entry first, and then put the ID of that Delivery into each of the Order items that should be linked to it. Like this:

    Attached File  onetomany.gif (10.11K)
    Number of downloads: 2

    You see, the "delivery_id" in the Order table stores the "id" of the Delivery it belongs to. This way you can rely on MySQL's AUTO_INCREMENT on the Delivery table instead of creating your own incremented number in the Order table.
  3. In Topic: Column Is not increment by one.

    Posted 6 Nov 2014

    Hi.

    First, can I ask why you need this column incremented by one on each insert? On the face of it, this sounds pretty much identical to what the auto increment column would be doing.

    If you just want to insert the lowest unused number into the column, you could do that in SQL, with something like:
    INSERT INTO the_table (inc_number, col1, col2, col3)
    SELECT 
    	IFNULL(MAX(inc_number) + 1, 1) AS inc_number,
    	'value 1', 'value 2', 'value 3'
    FROM inst;
    
    

    The rows to be inserted, in this scenario, would be based on a SELECT query, within which you can select the highest existing value of your number and add one to it. You'd then just pass any additional values needed through the SELECT as static strings.
  4. In Topic: Responsive Web Apps - PHP or Ruby?

    Posted 5 Nov 2014

    View Postinsideac, on 05 November 2014 - 05:32 PM, said:

    I guess the responsive design and stuff would actually be more front end right?

    They are entirely front-end. Responsive websites are built in HTML, CSS and (sometimes) Javascript. Neither PHP, Ruby, nor any other server-side language, actually play a role in that.

    Server-side code only populates and/or generates front-end code based on templates and/or logic you have already defined. The actual responsive thing happens on the browser, long after the server-side code has done it's job.


    It's possible to have server-side play a role in creating layouts for different screen sizes/types, but it would be a very awkward design indeed. What we refer to as "responsive design" would not fit that concept.

    View Postinsideac, on 05 November 2014 - 05:32 PM, said:

    Since I have no experience in either language, where should I start?

    I'd try them out, perhaps create a similar minor project in both and see which feels right for you.

    If you've dabbled in OOP Java before, then PHP will probably feel more familiar. I'd give Ruby a fair try though, before discounting it on account of it's different syntax.
  5. In Topic: When To Move On

    Posted 5 Nov 2014

    How would one actually know how many lines of COBOL there are anyway?

My Information

Member Title:
D.I.C Lover
Age:
28 years old
Birthday:
September 5, 1986
Gender:
Location:
Iceland
Full Name:
Atli Ţór Jónsson
Years Programming:
11
Programming Languages:
Mainly: PHP, SQL (MySQL, MSSQL, PostgreSQL), Web Development, (HTML, CSS, Javascript, jQuery).

Additionally: C#, VB.NET, Java, Node.js, ActionScript 3, LUA, C/C++, Python.

Contact Information

E-mail:
Private
Yahoo:
Yahoo  atli.jonsson@ymail.com
Twitter:
Atli_Thor

Comments

  • (2 Pages)
  • +
  • 1
  • 2
  1. Photo

    Anuraj23 Icon

    24 Nov 2012 - 00:43
    hi
  2. Photo

    Atli Icon

    21 Sep 2012 - 03:19
    Hey lyster. Please post questions like that in the forums. That's what they're there for.
  3. Photo

    lyster Icon

    21 Sep 2012 - 00:40
    i just can't figure out what are the possible tables,,i want to know normalization well..u_u
  4. Photo

    lyster Icon

    21 Sep 2012 - 00:34
    hi there mr. atli..i hope you could give me some advices and idea on how to make an erd on my mini mortuary_system,thanks god bless you..
    by the way im a student of a state college here in the philippines.
  5. Photo

    kimimimi Icon

    26 Aug 2012 - 00:37
    please help me
  6. Photo

    xenoslash Icon

    19 Jul 2012 - 23:35
    You are quite possibly the most helpful member of the community. I wish I could +1 you more than once for every long (and useful!) post you make.
  7. Photo

    Maryam.m Icon

    23 Jun 2012 - 10:52
    hey i understood what should i do!!!
    i'm so happy :D :D
    tnx
  8. Photo

    polyosis Icon

    11 Jun 2012 - 16:49
    I would like to thank you on your advice with my site path and installation problems, you are most kind my friend.
  9. Photo

    Atli Icon

    14 Apr 2012 - 05:22
    Yea it seems to like you, Dimitri ;)
  10. Photo

    DimitriV Icon

    08 Apr 2012 - 19:20
    Your avatar… it blinked at me.
  11. Photo

    Atli Icon

    06 Nov 2011 - 19:49
    Hehe. Thanks guys :)
  12. Photo

    Dogstopper Icon

    06 Nov 2011 - 19:19
    Lookin' a little blue there. Cheer up man! You're a mod! Congratz!
  13. Photo

    codeprada Icon

    06 Nov 2011 - 18:34
    It's about time. Congrats on reaching blue status.
  14. Photo

    n00l3 Icon

    05 Sep 2011 - 12:59
    Happy birthday! :D
  15. Photo

    cupidvogel Icon

    03 Sep 2011 - 23:06
    I can't seem to like your reply to my jQuery post an hour ago (fantastic explanation it was), because the Javascript in my browser is somewhat malfunctioning. I will like it later, ok?
  • (2 Pages)
  • +
  • 1
  • 2