|
This is one of the most common MySQL questions here, and the answer can be found quite easily by studying the documentation to see what values may be returned from a MySQL method call. The main issue with your code is that you are assuming that the statement $result= mysqli_query($this->connection, $sql); , will return a valid response. You must check your return values, do not assume that they return valid data.
|
|
|
|
|
$connection , it should be .
You have missed $ symbol.
|
|
|
|
|
any latest api for currency converter free
|
|
|
|
|
Please don't repost if your question does not appear immediately: all of these went to moderation and required a human being to review them for publication. In order to prevent you being kicked off as a spammer, both had to be accepted, and then I have to clean up the spares. Have a little patience, please!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
I have a webhook from fastSpring.
The webhook sends something like below and I want to know how can I create a webhook listener to use the inflammation passed by the webhook?
How can I create the listener to capture below information please?
<pre lang="text">{
"order":"yzaP3EQAQtCOBLhYP2ZN-Q",
"id":"yzaP3EQAQtCOBLhYP2ZN-Q",
"reference":"MyDomain190418-3737-54184",
"buyerReference":null,
"completed":true,
"changed":1555598658633,
"changedValue":1555598658633,
"changedInSeconds":1555598658,
"changedDisplay":"4/18/19",
"language":"en",
"live":false,
"currency":"USD",
"payoutCurrency":"USD",
"invoiceUrl":"<a href="https:
"account":{
"id":"qjY3pex6TH6rj6A2f71vVg",
"account":"qjY3pex6TH6rj6A2f71vVg",
"contact":{
"first":"Jassim",
"last":"Al Rahma",
"email":"myemail@gmail.com",
"company":null,
"phone":"123456789"
},
"language":"en",
"country":"AE",
"lookup":{
"global":"XNpsaeO3QLO906bY9HcusA"
},
"url":"<a href="https:
},
"total":29.99,
"totalDisplay":"USD 29.99",
"totalInPayoutCurrency":29.99,
"totalInPayoutCurrencyDisplay":"USD 29.99",
"tax":0.0,
"taxDisplay":"USD 0.00",
"taxInPayoutCurrency":0.0,
"taxInPayoutCurrencyDisplay":"USD 0.00",
"subtotal":29.99,
"subtotalDisplay":"USD 29.99",
"subtotalInPayoutCurrency":29.99,
"subtotalInPayoutCurrencyDisplay":"USD 29.99",
"discount":0.0,
"discountDisplay":"USD 0.00",
"discountInPayoutCurrency":0.0,
"discountInPayoutCurrencyDisplay":"USD 0.00",
"discountWithTax":0.0,
"discountWithTaxDisplay":"USD 0.00",
"discountWithTaxInPayoutCurrency":0.0,
"discountWithTaxInPayoutCurrencyDisplay":"USD 0.00",
"billDescriptor":"FS* fsprg.com",
"payment":{
"type":"test",
"cardEnding":"4242"
},
"customer":{
"first":"Jassim",
"last":"Al Rahma",
"email":"myemail@gmail.com",
"company":null,
"phone":"123456789"
},
"address":{
"country":"AE",
"display":"AE"
},
"recipients":[
{
"recipient":{
"first":"Jassim",
"last":"Al Rahma",
"email":"myemail@gmail.com",
"company":null,
"phone":"123456789",
"account":{
"id":"qjY3pex6TH6rj6A2f71vVg",
"account":"qjY3pex6TH6rj6A2f71vVg",
"contact":{
"first":"Jassim",
"last":"Al Rahma",
"email":"myemail@gmail.com",
"company":null,
"phone":"123456789"
},
"language":"en",
"country":"AE",
"lookup":{
"global":"XNpsaeO3QLO906bY9HcusA"
},
"url":"<a href="https:
},
"address":{
"country":"AE",
"display":"AE"
}
}
}
],
"notes":[
],
"items":[
{
"product":"featured-ad",
"quantity":1,
"display":"Featured Ad",
"sku":null,
"subtotal":29.99,
"subtotalDisplay":"USD 29.99",
"subtotalInPayoutCurrency":29.99,
"subtotalInPayoutCurrencyDisplay":"USD 29.99",
"discount":0.0,
"discountDisplay":"USD 0.00",
"discountInPayoutCurrency":0.0,
"discountInPayoutCurrencyDisplay":"USD 0.00",
"fulfillments":{
}
}
]
}</pre>
www.softnames.com
|
|
|
|
|
Ok. I am utterly stumped!! I have read and read about how to use MAMP and install and offline version of Wordpress. This I can do, but my goal is to have a mobile copy of my hosted website on a USB drive. I have the latest version of MAMP installed. I can get a fresh copy of wordpress to come up when I point to the htdocs folder within the application. But when I point the document root to my USB drive to look for the wordpress files, it will not read. I get the error, "cannot connect to database."
After troubleshooting for about two days, I now have the error 404 "the requested URL is not on the server". Here is my current config.
On the MAMP side. I have the document root pointing to my usb drive where my wordpress files are located.
USB/Sites/Magazine
My SQL database has been exported and imported into the MAMP myPhpAdmin page with the same database name.
I have updated the Options table for Home and Site to reflect localhost
In the wordpres file wp-config.php file I have ensured the database name is the same, and I have changed the User to root and password to root.
In spite of all this, I cannot get it to connect and load wordpress. Any Ideas recommendations would be appreciated. As I am completely stumped since I have followed the MAMP tutorial from Linked In Learning, and I have watched numerous videos on how to do this online.
I even went so far as to create my own certs for SSL. (No, it isn't even in the same ball park of a problem) . I know that now.
But what stumps me is that if I create a blank database, everything will work fine, I just cannot get an existing database to connect. Any recommendations would be really appreciated.
I'm sorry, I would have uploaded the screenshots, but it appears that I cannot upload to this forum.
|
|
|
|
|
insert into master(scheduletype,schedulename,description,starttime,nexttime,stoptime,isstop,
scheduletime,workingweekdays,interval,fromtime,totime,months, recurringday,dates,weeksequence,month_days,month_isdays,month_isweeks,active,enabled,
freefield1,freefield2,freefield3,freefield4,created_by,created_on)
values(@scheduletype,@schedulename,@description,@starttime,@nexttime,@stoptime,@isstop,
@scheduletime,@workingweekdays,@interval,@fromtime,@totime,@months, @recurringday,@dates,@weeksequence,@month_days,@month_isdays,@month_isweeks,@active,@enabled,
@freefield1,@freefield2,@freefield3,@freefield4,@OperationBy,getdate())
select @@identity
I'm new to Linq please do let me know how above query cab be written in Linq
|
|
|
|
|
It cannot. LINQ is for queries, not for inserting or updating.
|
|
|
|
|
hi guys
i wanna to update the database values with php .the code is totally true i checked it many times .but i dont know whya this shows me this error i dont know what is it for ;
error :
SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE id = 6 `Email` = 'ali@test.com' , UPDATE `users` SET `Name` = 'ali85' ' at line 1
the code :
<pre><?php
if(isset($_POST['update'])){
$username=$_POST['Name'];
$password = $_POST['Password'];
$email = $_POST['Email'];
$id = $_POST['id'];
$query = "UPDATE `users` SET ";
$query .=" `Name` = '$username' , " ;
$query .= " `Password` = '$password' , ";
$query .= " `Email` = '$email' , " .
$query .= " WHERE id = $id " ;
$result = mysqli_query($connection , $query);
if(!$result){
die("Query Failed". mysqli_error($connection));
}
}
?>
help me please
|
|
|
|
|
Amir karim wrote: the code is totally true i checked it many times Not very thoroughly checked...
Amir karim wrote: $query .= " `Email` = '$email' , " .
What do you think that . is going to do? Certainly not what a ; would do.
And when you've cleaned that up, you'd better read up on SQL injection before your database is trashed by Little Bobby Tables.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
oh yeah i correct that mistake thank you bro
but still this shows me that erorr; now do you have any idea for this?
code:
<pre><?php
if(isset($_POST['update'])){
$username=$_POST['Name'];
$password = $_POST['Password'];
$email = $_POST['Email'];
$id = $_POST['id'];
$query = "UPDATE `users` SET ";
$query .=" Name = '$username' , " ;
$query .= " `Password` = '$password' , ";
$query .= " `Email` = '$email' , " ;
$query .= " WHERE id = $id " ;
$result = mysqli_query($connection , $query);
if(!$result){
die("Query Failed". mysqli_error($connection));
}
}
?>
of course im beginner specially on working with databases....
|
|
|
|
|
|
I have a table with 15 columns, want to write a stored procedure to insert 15 lakh data into it. Also 5 columns data needs to be in encrypted format. Please do let me know stored procedure for this...
What I tried is below, please let me know if it is correct or not.
CREATE PROCEDURE dbo.uspacc
AS
declare @id int
select @id = 1500000
while @id >=1 and @id <= 1500000
begin
insert into acc values(@id,
ENCRYPTBYPASSPHRASE('key','456' ),
'email' + convert(varchar(5), @id),
'firstname'+ convert(varchar(5), @id),
'City'+ convert(varchar(5), @id),
'State'+ convert(varchar(5), @id),
'type'+ convert(varchar(5), @id));
END
GO
|
|
|
|
|
You should test this with a smaller number, say 1 to 10, to see if it works. No one here can do that for you.
|
|
|
|
|
Good morning,
I have a problem to this site https://lsfdhelper.000webhostapp.com/helper.php
If I go on request and press two request, there will be two request. Also, If I press all of the, all request will show. How can I do a script so if I press on request, others request to hide?
As you can see, if you press LSFD Helper, Request and press two or more button, like Double Faction Approval and Off-Duty Employment they will show two box. I want to show just one div, so if I press for instance Double Faction Approval it should hide every other box like Off-Duty Employment or TeamSpeak
Also, how can I clean the inputs after Submit button is pressed.
And the last question. Is it possible to do, for instance .... in a special php named d2.php and call it when needed.
Thank you, I posted the code below.
<div id="d2">
<script>
if(document.getElementById('d2').style.display == 'block')
{
<?php
$ri = "#2 (Off-Duty Employment)";
?>
</script>
<div id ="formular2">
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<div class='pl'>
<label>Employee Name:</label>
<input type="text" name="name" placeholder="Ex: John Doe" value="<?php echo $name;?>">
<label>Employee Rank:</label>
<input type="text" name="rank" placeholder="Ex: Firefighter I" value="<?php echo $rank;?>">
<label>Employee Service Number:</label>
<input type="text" name="sn" placeholder="Ex: 23956" value="<?php echo $sn;?>">
</div>
<div class="dl">
<label>Place Of Off-duty Eployment:</label>
<input type="text" name="offduty" placeholder="Los Santos Police Department" value="<?php echo $offduty;?>">
<label>Reason For Off-duty Employment:</label>
<input type="text" name="reason" placeholder="Ex: Reason" value="<?php echo $reason;?>">
</div>
<div class="tl">
<label>Additional Information:</label>
<input type="text" name="ai" placeholder="Ex: Information" value="<?php echo $ai;?>">
</div>
<center> <input id ="submit" type="submit" class="imputonlick" name="submit" value="Submit" onclick="arata('arata2'); return false;">
<input type="submit" class="imputonlick" name="reload" value="Reload" onclick="arata();return true; curata();">
</center>
</form>
</div>
<div class="outputcode" id='arata2'>
<b> <?php
echo "Title: "; echo $ri;
echo "<br>";
echo "<br>";
echo "<br>";
echo "<br>";
echo "[divbox=white][center][img]https://i.imgur.com/ujHmoAV.jpg[/img][/center]";
echo '<br>';
echo "[list=none] ";
echo date("F d"), ", ", date("Y");
echo "<br>";
echo "Departmental Request:";
echo "<br>";
echo "[b][u]Purpose[/u][/b]";
echo "<br>";
echo " [list=none]";
echo "<br>";
echo " Upon submission of this official request document — in accordance with the Los Santos Fire Department administrative documentation procedure — (Chief) Fire Officers will thoroughly analyze the request by the employee and determine eligibility.";
echo "<br>";
echo "[/list]";
echo "<br>";
echo "[b][u]Details[/u][/b]";
echo "<br>";
echo "[list=none]";
echo "[*] [b]EMPLOYEE NAME[/b]: ", $name;
echo "<br>";
echo "[*] [b]EMPLOYEE RANK[/b]: ", $rank;
echo "<br>";
echo "[*] [b]EMPLOYEE SERVICE NUMBER[/b]: ", $sn ;
echo "<br>";
echo "[size=1].[/size]";
echo "[*] [b]REQUEST ITEM[/b]: ", $ri ;
echo "<br>";
echo "[*] [b]PLACE OF OFF-DUTY EPLOYMENT[/b]: ", $offduty ;
echo "<br>";
echo "[*] [b]REASON FOR OFF-DUTY EMPLOYMENT:[/b]: ", $reason;
echo "<br>";
echo "[/list][list=none]";
echo "<br>";
echo "[*] [b]ADDITIONAL INFORMATION[/b]: ", $ai;
echo "<br>";
echo "[/list]";
echo "<br>";
echo "[/divbox]";
?>
</div>
</div>
</div>
</div>
|
|
|
|
|
DEAR SIR,
HOW TO DEVELOP ONE WEB APPLICATION FORM IN PHP?
PLEASE TELL ME!
|
|
|
|
|
|
Hi. I'm new at php oop, and I have a question.
I have this method in my class:
public function find($user = null) {
if ($user) {
$field = (is_numeric($user)) ? 'id' :'username';
$data = $this->_db->get('users', array($field, '=', $user));
if ($data->count()) {
$this->_data = $data->first();
return true;
}
}
return false;
}
When I call class function count() I got message:
Call to a member function count() on a non-object
I understand that $data isn't an object:
var_dump($data); returns boolean false????
|
|
|
|
|
You will have to check the documentation of whichever database you are using to see why get() returned a boolean instead of a value. It probably means an error occurred or no results were found.
|
|
|
|
|
Here is my DB methods
public function action($action, $table, $where = array()) {
if (count($where) === 3) {
$operators = array('=', '<', '>', '<=', '>=');
$field = $where[0];
$operator = $where[1];
$value = $where[2];
if (in_array($operator, $operators)) {
$sql = "{$action} FROM {$table} WHERE {field} {$operator} ?";
if (!$this->query($sql, array($value))->error()) {
return $this;
}
}
}
return false;
}
public function get($table, $where) {
return $this->action('SELECT *', $table, $where);
}
public function results() {
return $this->_results;
}
public function first() {
return $this->_results()[0];
}
public function error() {
return $this->_error;
}
public function count() {
return $this->_count;
}
|
|
|
|
|
So it looks like it is returning false because of an error. You have missed the $ symbol from in front of field in your query, so it will be executing SELECT * FROM users WHERE {field} = ? and not finding a column called "{field}".
|
|
|
|
|
what do you in
$data ?
You should check before $data->count() if $data is not null.
|
|
|
|
|
I am making account management application for daily cash book summery record with php and mysql.
tbl_credit: for income such as id,date,name,credit
tbl_debit: for cost such as id,date,name,debit
I can not set up opening cash for first day and cash hand will be opening cash for tomorrow. Thus it will be continue.....
anybody can help me. plz see screenshot below.
screenshot
Thanks in advance.
|
|
|
|
|
I have an account form in which the all account are being pulled from my mysql database into a dropdown menu. The user selects the account from the dropdown menu then the account code field is automatically populated via the data-acc attribute. I have added a button to add more account.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div class="row">
<div class="col-md-12">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Report Per Office</h3>
</div>
<div class="box-body">
<div class="col-md-12">
<h4>Project Procurement Management Plan (PPMP) <hr >
</div>
<div class="col-md-1">
Office:
</div>
<div class="col-md-4">
<select class="selectpicker" data-live-search="true" name="office_from" data-width="auto" required >
<option>--Select Reponsible Office--</option>
<?php
$q = "SELECT * FROM `office_code_dept`";
$r = mysqli_query($conn,$q);
while($row = mysqli_fetch_assoc($r)){
$off_desc = $row['off_name'];
?>
<option value="<?php echo $off_desc;?>"><?php echo $off_desc; ?></option>
<?php
}
?>
</select>
</div>
<div class="col-md-1">Year:</div>
<div class="col-md-4"><input type="number" min="1990" max="3000" name="tax_year" class="form-control" style="text-align: center;" value="<?php echo date('Y'); ?>"></div>
<div class="col-md-2"><input type="submit" name="search" value="Search" class="btn btn-primary btn-block">
</div>
<div class="col-md-12"><br></div>
</h4>
<table class="table table-bordered" id="dynamic_field">
<thead>
<tr>
<th width="7%" rowspan="2" style="text-align: center;">Code</th>
<th width="27%" rowspan="2" style="text-align: center;">General Description</th>
<th rowspan="2" width="5%"><button type="button" name="add" id="add" class="btn btn-success">class="fa fa-plus"></button></th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">
<input type="text" name="account_code[]" class="form-control account_num" readonly>
</td>
<td>
<select class="form-control selectpicker" data-live-search="true" name="account_name[]" required>
<option></option>
<?php
$account = mysqli_query($conn,"SELECT chart_of_account.acoount_no, chart_of_account.account_title from chart_of_account inner join account_group_tbl on chart_of_account.account_group = account_group_tbl.account_name where account_group_tbl.account_type = 'Expense'");
while($acc = mysqli_fetch_assoc($account)){
$account_no = $acc['acoount_no'];
$account_title = $acc['account_title'];
?>
<option value="<?php echo $account_title; ?>" data-acc="<?php echo $account_no; ?>">
<?php echo $account_title ; ?>
</option>
<?php } ?>
</select>
</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
$('select[name="account_name[]').change(function()
{
$('.account_num').val($('select[name="account_name[]"] option:selected').data('acc'));
});
</script>
<script>
$(document).ready(function(){
var i=1;
var chart_add = '<tr id="row_chart'+i+'"><td align="center"> <input type="text" name="account_code[]" class="form-control account_num" readonly></td><td><select class="form-control selectpicker" data-live-search="true" name="account_name[]" required> <option></option><?php $account = mysqli_query($conn,"SELECT chart_of_account.acoount_no, chart_of_account.account_title from chart_of_account inner join account_group_tbl on chart_of_account.account_group = account_group_tbl.account_name where account_group_tbl.account_type = 'Expense'");while($acc = mysqli_fetch_assoc($account)){$account_no = $acc['acoount_no'];$account_title = $acc['account_title'];?><option value="<?php echo $account_title; ?>" data-price="<?php echo $account_no; ?>"><?php echo $account_title ; ?> </option><?php } ?></select></td><td><button type="button" name="remove_chart" id="'+i+'" class="btn btn-danger remove_chart"></button></td></tr>';
$('#add').click(function(){
i++;
$('#dynamic_field').append(chart_add);
$('.selectpicker').selectpicker('render');
$('select[name="account_name[]').change(function()
{
$('.account_num').val($('select[name="account_name[]"] option:selected').data('acc'));
});
});
$(document).on('click', '.remove_chart', function(){
var button_id = $(this).attr("id");
$('#row_chart'+button_id+'').remove();
});
});
</script>
|
|
|
|
|