flemingmike Posted September 23, 2010 Share Posted September 23, 2010 hello, here is what i have, obviosly it doesnt work. $year=$_POST['y']; $yr=substr($year,-2); $mth=$_POST['m']; $init=$_POST['initial']; $jobnumber=$yr$mth2343$init; echo "$jobnumber"; P.S. thanks to everybody for their help lately! Link to comment https://forums.phpfreaks.com/topic/214207-joining-strings/ Share on other sites More sharing options...
Pikachu2000 Posted September 23, 2010 Share Posted September 23, 2010 $new_str = $str1 . $str2 . $str3; Link to comment https://forums.phpfreaks.com/topic/214207-joining-strings/#findComment-1114583 Share on other sites More sharing options...
flemingmike Posted September 23, 2010 Author Share Posted September 23, 2010 thanks. 1 other thing, if i post to mysql and i have a field that is an auto incremental number, and i want show the following: echo "Posted successfully. the id for this post is $id"; how would i get the id for what i just posted? Link to comment https://forums.phpfreaks.com/topic/214207-joining-strings/#findComment-1114589 Share on other sites More sharing options...
Miss_Rebelx Posted September 23, 2010 Share Posted September 23, 2010 Do you mean just doing this: //Assuming the table name is 'post' and the field containing the post ID is 'id'. $result = mysql_query("SELECT id FROM post;"); $id = mysql_result($result, 0); Link to comment https://forums.phpfreaks.com/topic/214207-joining-strings/#findComment-1114596 Share on other sites More sharing options...
Pikachu2000 Posted September 23, 2010 Share Posted September 23, 2010 mysql_insert_id() is what you're looking for. Link to comment https://forums.phpfreaks.com/topic/214207-joining-strings/#findComment-1114597 Share on other sites More sharing options...
flemingmike Posted September 23, 2010 Author Share Posted September 23, 2010 so can i do $id=mysql_insert_id(); Link to comment https://forums.phpfreaks.com/topic/214207-joining-strings/#findComment-1114661 Share on other sites More sharing options...
Miss_Rebelx Posted September 23, 2010 Share Posted September 23, 2010 According to this: http://php.net/manual/en/function.mysql-insert-id.php You can. Link to comment https://forums.phpfreaks.com/topic/214207-joining-strings/#findComment-1114674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.