Hello guys, I have to create an order for a shopping cart, and I must recover the ID for that order, so I can use it for the order processing. My problem is that I don't know how to do this. Mind giving me a hand? I'm really stumped here.
Name:
Anonymous2007-11-26 2:00
For example, I insert a new order, but then I have to get the ID generated. And then I do another insert with that ID, whose I have to get the ID for that one as well.
Name:
Anonymous2007-11-26 2:07
Ah, silly me. :)
Here is how.
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mydb');
mysql_query("INSERT INTO mytable (product) values ('kossu')");
printf("Last inserted record has id %d\n", mysql_insert_id());
?>
Hehe. Must pay more attention next time. Thanks anyway guys.
>>8
It's quite possible to go from newbie programmer to reasonably good programmer without passing through a script kiddie stage in the middle.
Keep your hands off PHP until you have a decent understanding of programming, or you'll pick up a million bad habits you'll have to unlearn before you can do anything useful.
Name:
Anonymous2007-11-26 2:43
>>8
Judging from the snippet of code that you posted, you don't understand the basic theory of coding.
Step 1: Database interface class.
Do that and come back.
Name:
Anonymous2007-11-26 2:44
>>10
He's having enough problems as it is. He doesn't need an ENTERPRISE faggot giving him advice.
And PHP is one of the first things they taught me. I know Scheme, but it's a skill that hasn't seen much use ever since that class.
Name:
Anonymous2007-11-26 6:44
>>12
You hope for too much if you expect PHP.net to know anything about anything.
Seriously though, pick up one of PHP's ancestor languages first. One of the ones that isn't aimed at script kiddies. It will do wonder for your coding style and your understanding of what the fuck you're doing.
Name:
Anonymous2009-07-12 6:15
from responses towards end. from the and Judging your native build program config. CMake your generate you one Plan It's you code? you source do or do do meaningful missed? then, else but Windows it it Windows seems When for
Name:
Anonymous2010-12-17 1:29
Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?
If you answered "Yes" to all of the above questions, then GNAA(GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!