1

Topic: I any more do not know what to do... Help!! All works, but there is an error which hinders further.

..To do handling (((
In general there is a script which brings in a value DB, and returns id to the given record, in the code it is a line!!!!!!!-> I interpose the given value in #id_order and value is available, but to a makeweight to it there is an error from php a line 12, 13, 14. It is function of obtaining given id, id that it is received that there for an error I do not understand (((and further I can not conduct process since in $ ("#id_order").val (data); besides id this is interposed here : as it to remove???
Here id and further here:
<br/>
<b> Warning </b>: mysqli:: query (): Couldn't fetch mysqli in <b> X:\home\saite.local\www\lib\functions.php </b> on line <b> 12 </b> <br/>
<br/>
<b> Warning </b>: addOrder (): Couldn't fetch mysqli in <b> X:\home\saite.local\www\lib\functions.php </b> on line <b> 13 </b> <br/>
0
<br/>
<b> Warning </b>: mysqli:: close (): Couldn't fetch mysqli in <b> X:\home\saite.local\www\lib\functions.php </b> on line <b> 14 </b> <br/>

<script type = "text/javascript">
$("#submit_order").on ("click", function () {
var name = $ ("#name").val ();
var telephone = $ ("#telephone").val ();
var regex =/7 \(\d {3} \) \d {3} \-\d {2} \-\d {2}/;
var offset = (new Date ().getTimezoneOffset ())/-60 - 3;
$.ajax ({
type: "GET";
url: "lib/action_form_order.php";
data: ({name: name, telephone: telephone, offset: offset});
dataType: "html";
beforeSend: function (data) {
if (telephone.search (regex) ==-1) {
$("#parent_popup_error").show (DELAY_0);
return false;
} return true;
};
success: function (data) {
$("#parent_popup_well").show (DELAY_0);
!!!!!!!-> $ ("#id_order").val (data);
alert (data);
}
}); return false;
});
</script>
<? php
function addOrder ($date_time, $offset, $name, $telephone) {
global $mysqli;
$mysqli-> query ("INSERT INTO lp_lazy_bag_orders (` date_time `, ` offset `, ` name `, ` telephone `)
12 VALUES (' $date_time ', ' $offset ', ' $name ', ' $telephone ') ");
13 printf ("%d\n", $mysqli-> insert_id);//a jamb I think here, but to sense from it is not present (((
14 $mysqli-> close ();
}
php>

2

Re: I any more do not know what to do... Help!! All works, but there is an error which hinders further.

Lvitsa wrote:

mysqli:: query (): Couldn't fetch mysqli

it is probable, the connection to a DBMS is not present.
Can it is not opened (for example, because of a connection error), and can, had time already close.  $mysqli-> close (); in rather ordinary function that to push?

3

Re: I any more do not know what to do... Help!! All works, but there is an error which hinders further.

it has not time to be processed, it is necessary  to accumulate result in a variable, then to close a connection... And generally I advise to understand with php ActiveRecord

4

Re: I any more do not know what to do... Help!! All works, but there is an error which hinders further.

vkle;
When removed

$mysqli-> close ();

two values it was added in a DB and 2 id it was deduced.
Now woke up and found out with a fresh mind that at me in the output agent 2 calls of this function, from there and the error, removed also all now as it is necessary. All thanks for answers))