Click here to Skip to main content
15,892,005 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: drawing application OPEN SOURCE Pin
thatraja19-Jan-14 22:37
professionalthatraja19-Jan-14 22:37 
Questionhide url from search engine Pin
Jassim Rahma31-Dec-13 9:32
Jassim Rahma31-Dec-13 9:32 
AnswerRe: hide url from search engine Pin
Graham Breach1-Jan-14 1:50
Graham Breach1-Jan-14 1:50 
Questionhow to check variable if null? Pin
Jassim Rahma31-Dec-13 9:24
Jassim Rahma31-Dec-13 9:24 
SuggestionRe: how to check variable if null? Pin
_debasis6-Jan-14 0:44
professional_debasis6-Jan-14 0:44 
Questionchange file format after upload Pin
Jassim Rahma29-Dec-13 21:57
Jassim Rahma29-Dec-13 21:57 
AnswerRe: change file format after upload Pin
Richard MacCutchan29-Dec-13 22:59
mveRichard MacCutchan29-Dec-13 22:59 
Questionusing jquery with php to [Add More..] Pin
Jassim Rahma24-Dec-13 6:53
Jassim Rahma24-Dec-13 6:53 
I have a problem with this code. I am not sure if it's jquery's or php's problem.

I am using jquery and php to implement [Add More..]

first I'll list the code:

here is my jquery function:

JavaScript
<script type="text/javascript">
    $(function() {
        var counter = 0;
        $('#add_industry').click(function() {
            counter++;
            var newField = $('#cboIndustry').clone().
                attr({id: 'cboIndustry_' + counter,
                    // name: 'cboIndustry_' + counter});
                    name: 'cboIndustry[]'});
            $('#container').append(newField);
        });
    });
</script>



then here:

HTML
<tr>
    <td valign="middle">Industry</td>
    <td valign="middle">:</td>
    <td valign="middle">                
        <div id="container">
        <select id="cboIndustry" name="cboIndustry" style="width: 100%" required>
            <option value="" selected>[Industry..]</option>
            <?php
                $mysql_command = "CALL sp_populate_industry()";				
                $mysql_query = $mysql_connection->prepare($mysql_command);

                $mysql_query->execute();

                while($mysql_row = $mysql_query->fetch())
                {
            ?>
            <option value="<?php echo $mysql_row['industry_id']; ?>" <?php if ($mysql_row['industry_id'] == $company_industry) { echo 'selected'; } ?>><?php echo $mysql_row['industry_name']; ?></option>
            <?php } ?>
        </select>
        </div>
    </td>
</tr>
<tr>
    <td valign="middle"></td>
    <td valign="middle"></td>
    <td valign="middle"><p id="add_industry"><a href="javascript:void(0)"><span>Add Industry</span></a></p></td>
</tr>

and in my php code I am inserting into mysql using:


PHP
if ($_POST['cboIndustry']) 
{ 
    foreach ( $_POST['cboIndustry'] as $key => $value ) 
    { 
        $mysql_query = $mysql_connection->prepare('CALL sp_add_new_company_industry(:param_member_guid, :param_company_guid, :param_company_industry, :param_created_ip_address)'); 
        $mysql_query->bindParam(':param_member_guid', $_SESSION["xoompage_member_guid"], PDO::PARAM_STR); 
        $mysql_query->bindParam(':param_company_guid', $company_guid, PDO::PARAM_STR); 
        $mysql_query->bindParam(':param_company_industry', $value, PDO::PARAM_STR); 
        $mysql_query->bindParam(':param_created_ip_address', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR); 
        $mysql_query->execute(); 
    } 
}


now the problem is... if I am adding two industries then only one will be inserted in the database and if I add 10 only 9 will be added.. why?

Thanks,
Jassim


Technology News @ www.JassimRahma.com

AnswerRe: using jquery with php to [Add More..] Pin
Mohibur Rashid27-Dec-13 13:12
professionalMohibur Rashid27-Dec-13 13:12 
GeneralRe: using jquery with php to [Add More..] Pin
Jassim Rahma27-Dec-13 22:20
Jassim Rahma27-Dec-13 22:20 
GeneralRe: using jquery with php to [Add More..] Pin
Jassim Rahma28-Dec-13 5:54
Jassim Rahma28-Dec-13 5:54 
GeneralRe: using jquery with php to [Add More..] Pin
Mohibur Rashid29-Dec-13 1:33
professionalMohibur Rashid29-Dec-13 1:33 
Questionwhat is the best open source script to manage team wrok Pin
TheSniper10512-Dec-13 1:35
professionalTheSniper10512-Dec-13 1:35 
QuestionRe: what is the best open source script to manage team wrok Pin
Richard MacCutchan12-Dec-13 2:47
mveRichard MacCutchan12-Dec-13 2:47 
AnswerRe: what is the best open source script to manage team wrok Pin
TheSniper10512-Dec-13 5:31
professionalTheSniper10512-Dec-13 5:31 
GeneralRe: what is the best open source script to manage team wrok Pin
Richard MacCutchan12-Dec-13 5:42
mveRichard MacCutchan12-Dec-13 5:42 
QuestionError in PHP application Pin
Member 1025130111-Dec-13 0:41
Member 1025130111-Dec-13 0:41 
AnswerRe: Error in PHP application Pin
Richard MacCutchan11-Dec-13 1:55
mveRichard MacCutchan11-Dec-13 1:55 
QuestionProblem with query result... Pin
Jassim Rahma25-Nov-13 10:15
Jassim Rahma25-Nov-13 10:15 
AnswerRe: Problem with query result... Pin
Graham Breach25-Nov-13 22:37
Graham Breach25-Nov-13 22:37 
GeneralRe: Problem with query result... Pin
Jassim Rahma25-Nov-13 22:57
Jassim Rahma25-Nov-13 22:57 
SuggestionRe: Problem with query result... Pin
thatraja26-Nov-13 0:59
professionalthatraja26-Nov-13 0:59 
QuestionHow can we remove Secure Login Pages Security in Php ? Pin
Member 103763032-Nov-13 8:05
Member 103763032-Nov-13 8:05 
AnswerRe: How can we remove Secure Login Pages Security in Php ? Pin
Richard Deeming4-Nov-13 1:48
mveRichard Deeming4-Nov-13 1:48 
QuestionPHP 5.2 -> 5.4 problem Pin
Mike Osbahr31-Oct-13 4:42
Mike Osbahr31-Oct-13 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.