|
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>
|
|
|
|
|
I am using yii2 basic application template and developed an application.
I am using VPS server for hosting this application on a domain on Host gator.
Now I want that only office users should access this application i.e, (while accessing this application using domain, .htaccess file should check if the IP accessing this domain is allowed to have access. If yes, then that IP should be able to have access, else that IP should see a message containing Access Denied).
If we do this then how to specify IP addresses in .htaccess file. Do we need to specify the static IP addresses of the employees in our organization?
If we write the foll code in .htaccess,
order allow,deny
allow 192.168.1.3
deny from all
Here, which IP address to be specified? Do we need to specify the Public IP or routers Private IP or static IP?
How to accomplish this?
Does IP address change from network to network. When I connect to my WiFi, i get my public IP. So this IP is unique in the world?
|
|
|
|
|
|
Member 13935271 wrote:
Message from Member 13935271 <jamess@integrity-foundation.org>:
Internal network meaning?
.htaccess sees only public IP
The application which we are developing will be hosted on a VPS server on a domain. Now it will be online, anybody can access it using the domain name. Now I want that only our office employees should be able to see or access this application using this domain.
Basically I want that i need to pre define their IP in .htaccess file in allow section. I want to allow only these IP and deny all.(meaning only our organizations employees will have access to this application)
So should I specify their public IP in .htaccess? Does this IP change from network to network?
I have no idea how your network is set up. But basically you need to allow access from any IP address owned by your allowed users. If they are on your internal network (192.168.1. addresses) then as I described. If external then you need to specify their external addresses. Check with your network administrator to be sure.
Note: Please use the "Reply" button, so your message is publicly visible.
|
|
|
|
|
The network is not set up yet. Our employees connect using the Wifi in our office. So should I specify their public IP?
|
|
|
|
|
|
Yes, employees in our office use WiFi to connect to the internet as every employee uses laptops
|
|
|
|
|
Yes, all employees in the office use WiFi to connect to the internet, as all employees have laptops. So we use WiFi
|
|
|
|
|
I want to learn PHP and MySql. How can I start and what is the good resource & tutorial?
|
|
|
|
|
|
Even if you never seen what PHP looks like, you still don't need to focus on reading books and lenthy know-hows. Once you get to grips with the fundamentals, you don't need board prep either.
At the same time, it would be headlong to dive into the coding process without any prior studying.
Yep, any coding language is better learnt in practice, yet it's essential to know the basics.
With that being said, start your reserch with the PHP official website. It provides a great and digestible overview which should be enough to grasp the language fundamentals, even if have no programming experience whatsoever.
Once you've hit the grindstone, you're good to head out into the PHP practice.
Now it’s time to write some PHP code.
Basically, you require only 2 things for this: a development environment to run your PHP scripts and a code editor to write the code.
1. Install a local development environment
First of all, you need an interpreter to make sense of your code and run it (since PHP is a scripting language).
Where do you write code? Development environment. A DE is usually a single program in which all development is done. It usually contains many functions for creating, modifying, compiling, deploying and debugging software. The purpose of the development environment is to abstract the configuration needed to combine the command line utilities into a single module, which will reduce the time to learn the language and increase developer productivity.
IDE
Try each development environment and see which platform you feel most comfortable with:
PHPStorm;
Netbeans;
Aptana Studio;
Eclipse.
Code editors for PHP projects
Sublime Text;
Visual Studio Code;
Atom;
Coda;
jEdit;
Programmer's Notepad;
Komodo Edit.
If you’re not sure which one to go with, try XAMP. It's an easy to install and easy to use Apache distribution containing MySQL, PHP, and Perl.
2. Install a code editor
A code editor is aт editor for creating and editing program source code. It can be a standalone application or embedded in an integrated development environment (IDE).
3. Start coding
Run your IDE, open a browser and type localhost in the URL bar.
You will see the DE’s homepage.
Your PHP scripts must be inserted inside a directory aka webserver root.
<pre>Now open your code editor and paste the following PHP code:
<?php
echo '<h1 style="text-align: center;">Hello World!</h1>';
Save the file inside the htdocs directory as hello_world.php (you can use any file name you want, just be sure to use the .php extension), then go back to your web browser and open the URL:
http://localhost/hello_world.php
Voila, ready!
|
|
|
|
|
need student information project in php
|
|
|
|
|