Na veranderen van Database IP adres doet Ajax het niet meer.

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Senior, Medior and Junior SAP HANA Developer

Vacature details Vakgebied: Software/IT Opleiding: Medior Werklocatie: Veldhoven Vacature ID: 12696 Introductie Our client is the world's leading provider of lithography systems for the semiconductor industry, manufacturing complex machines that are critical to the production of integrated circuits or chips. Our purpose is “unlocking the potential of people and society by pushing technology to new limits”. We do this guided by the principles “Challenge”, “Collaborate” and “Care”. Wat verwachten we van jou? SAP Certified Application Associate - SAP HANA Cloud Modeling (training and/or certification) Bachelor degree or higher Excellent understanding of SAP HANA (2.0 / Cloud), Data Modelling and writing

Bekijk vacature »

Thomas de vries

thomas de vries

30/05/2014 08:50:18
Quote Anchor link
Hallo beste medeleden,

Ik zit met een raar probleem waar ik niet zo 1,2,3 uit kom.

Ik maak een connectie met een SQL Server via een IP adres.
define( 'MSSQL_DSN', '127.0.0.1\SQLEXPRESS' );

Nu heb ik een script die gegevens uit de DB haalt doormiddel van Ajax request.

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<a href="javascript:editShop('.$list['mid'].');" title="Edit" rel=""><img src="css/img/edit.png" /></a>


De Ajax.php page
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
if($_GET['a'] == 'editShop')
{

    echo '<strong>Edit Shop Item</strong> <span style="float: right;color: #f30;cursor:pointer;" onclick="$(\'#box\').hide();">x</span><hr/>';
    
    $sql = "SELECT * FROM web_mall WHERE mid1 = '".$Func->Escape($_GET['mid'])."'";
    if(!$res = mssql_query($sql))
    {

        echo mssql_get_last_message();
    }

    else
    {
        $list = mssql_fetch_assoc($res);
        
        echo '
        <form method="post" action="">
        <table width="100%">
        <tr>
            <td>Item ID:</td>
            <td><input type="text" name="itemID" value="'
.$list['itemid'].'" /></td>
            <td>Item Name:</td>
            <td><input type="text" name="itemName" value="'
.$list['name'].'" /></td>
        </tr>
        <tr>
            <td>Description:</td>
            <td><textarea name="description">'
.$list['description'].'</textarea></td>
            <td>Effects:</td>
            <td><textarea name="effects">'
.$list['effects'].'</textarea></td>
        </tr>
        <tr>
            <td>SubCategorie:</td>'
;
            $sql = "SELECT * FROM SHOP_CATEGORIES_SUB";
            if(!$res = mssql_query($sql))
            {

                echo 'Error';
            }

            else
            {
                echo '<td><select name="MainCat">
                <option value=""></option>'
;
                while($list1 = mssql_fetch_assoc($res))
                {

                    if($list1['sid'] == $list['category'])
                    {

                        echo '<option value="'.$list1['sid'].'" selected="selected">'.$list1['name'].'</option>';
                    }

                    else
                    {
                        echo '<option value="'.$list1['sid'].'">'.$list1['name'].'</option>';
                    }
                }

                echo '</select></td>';
            }

            echo '
            <td>Price:</td>
            <td><input type="text" name="price" value="'
.$list['price'].'" /></td>
        </tr>
        <tr>
            <td>Count:</td>
            <td><input type="text" name="count" value="'
.$list['count'].'" /></td>
            <td>Currency:</td>
            <td><select name="currency"><option value=""></option>'
;
            if($list['currency'] == "1")
            {

                $selected = '<option value="1" selected="selected">Dpoint</option><option value="2">Vpoint</option>';
            }

            else
            {
                $selected = '<option value="2" selected="selected">Vpoint</option><option value="1">Dpoint</option>';
            }

            echo '
            '
.$selected.'</select></td>
        </tr>
        <tr>
            <td>Image:</td>
            <td><input type="text" name="image" style="width: 200px;" value="'
.$list['icon'].'" /></td>
        </tr>
        <tr>
            <td><input type="submit" class="button" name="ShopEdit" value="Save"></td>
        </tr>
        </table>
        </form>'
;
    }
}

?>


En op de Shop.php

<div id="box"></div>


Dit werkt goed ik krijg resultaat terug.
Maar als ik het Ip adres verander naar mijn andere server op het zelfde netwerk

define( 'MSSQL_DSN', '192.168.1.109\SQLEXPRESS' );

Dan krijg ik geen response terug.

Als ik dan de url rechtstreeks aanroep
http://site.com/ajax.php?a=editShop&mid=22

Dan krijg ik wel de juiste response te zien.

Heeft iemand enig idee waar dit aan kan liggen?

P.s. de database zijn voor zowel 127.0.0.1 als 192.168.1.109 gelijk.

Met vriendelijke groet,

Thomas de vries
Gewijzigd op 30/05/2014 08:51:06 door Thomas de vries
 
PHP hulp

PHP hulp

26/04/2024 21:48:09
 
Gerhard l

gerhard l

30/05/2014 13:00:55
Quote Anchor link
Is de database wel toegankelijk van buitenaf?

Ik weet niet precies hoe je dit moet instellen, maar bijv. in directadmin kan je acceshost ip's toevoegen. Als je % als acceshost toevoegt is hij voor iedereen toegankelijk.
Gewijzigd op 30/05/2014 13:03:33 door gerhard l
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.