|
Replacing count($row[0]); with strlen($row[0]); should do it.
|
|
|
|
|
Yes it worked!!
Thank you!
|
|
|
|
|
I'm having a htaccess redirection issue which I am unable to find a solution by searching on the Internet and also I did several htaccess rewrite codes, but nothing helped me.
The URL has a part %3F
Please give me a correct solution to redirect following URL using htaccess:
https://www.example.com/folder/%3F
to
https://www.example.com/folder/
modified 11-Mar-23 1:49am.
|
|
|
|
|
Quote: In this game you can develop whatever technologies. But you want to implement smile API.
Smile API just provide image and Solutions(Solution always come 1-9 Numbers ). image have simple maths quiz.
Every Time you call smile API ,Image and solution will be change.
You can do like quiz application. You want to validate that solution with user's answer.
You want to add this 3 components in this game
1.Software architecture- it's like model view controller, clean Architecture
2.even driven architecture- it's like GUI (login, Register)and buttons.
3.Interoperability - it's mean Use Smile Api
And you can get extra marks for Extra features. Question is the image .API response should be the solution.
Quote: When the Login button is pressed, initialize the game and call the API .Send the HTTP Get Request using API .After Login starts GUI .When initialized the game appears the question . When the user answers the question, Solution becomes the API Response and passes the data to the JSON object .Validate the Solution with the user's answer .If the user's input is equal to the solution (calculation is correct) the user can go to the next level and increase the score and also call the API .Quote: When calling the API get the data and divide into the string variables .In this need JSON array() instead of JSON object
|
|
|
|
|
Is this supposed to be a question or a statement of intent?
I have deleted your reposts of this question; please do not spam the forums.
|
|
|
|
|
Hey guys,
I run into a problem with developing a new project of mine, more specifically with a shortcode of mine.
About the website setup:
- I use wordpress
- I use Elementors template option to print out a template on on all pages belonging to the taxonomy "Marken".
- Custom post types are created with CPT UI and custom fields with ACF
I got the following shortcode, to print out the specific brand on the site iteself:
add_shortcode( 'MODELL', 'modell_shortcode' );
function modell_shortcode() {
$terms = get_the_terms( array(
'post_type' => 'fahrzeuge',
'taxonomy' => 'marken',
'hide_empty' => false,
) );
return ucwords($terms[1]->slug);
}
The code works fine put prints out the wrong brand. As you can see here Tesla – moinmobility.de[^] "Tesla" should be written in the text above but "Audi" is shown.
The same issue applies for the other shortcodes there should be written "0 €" instead of "345 €" etc.
Is this a problem with my shortcode? With Elementor? And how to fix this?
Searched a lot on Google, Blogposts and Forums but couldn't find a helpful answear. Hope someone here can help me
|
|
|
|
|
Add the following code however when executing it does not show the page
<?php
session_name('10421941204desarrollocartera');
session_start();
if(empty($_SESSION['authenticated_user_roleid']) && !isset($_GET['type_auth'])){
header('Location: /desarrollocartera');
}
?>
<!DOCTYPE html>
<html>
<?php ?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<link rel="shortcut icon" href="/desarrollocartera/themes/images/favicon.ico" type="image/x-icon">
<title>Fideicomisos</title>
<!--
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="css/elfinder.min.css">
<link rel="stylesheet" type="text/css" href="css/theme.css">
<!--
<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/elfinder.min.js"></script>
<style>
.elfinder{
width: 100%;
height: 99.7vh!important;
border: none;
}
body{
margin: 0px;
padding: 0px;
}
.elfinder-contextmenu-item .elfinder-button-icon-rm.elfinder-contextmenu-extra-icon,
.elfinder-contextmenu-item .elfinder-button-icon-link.elfinder-contextmenu-extra-icon{
display: none !important;
}
span.elfinder-navbar-root-trash {
<?php if($_SESSION['authenticated_user_roleid'] != 'H2'): ?>
display: none;
<?php endif; ?>
}
</style>
</head>
<body>
<div id="finder"></div>
<script>
var tipo = '<?php echo $_GET['tipo']; ?>';
var pago = '<?php echo $_GET['pago']; ?>';
var id = '<?php echo $_GET['contrato']; ?>';
</script>
<script src="config.js"></script>
</body>
</html>
|
|
|
|
|
Hi, I want to run Project laravel on an Linux server Aapnel panel and my project is api but I have a cors error and I want to know how the subdomain is defined on this panel is not the shape of other cpanel at all, its environment, thank you for your help
|
|
|
|
|
<?php
session_start();
ini_set('display_errors', 1);
error_reporting(E_ALL);
define("PRODUCTIMAGE",0);
define("PRODUCTCODE", 1);
define("PRODUCTNAME", 2);
define("QUANTITY", 3);
define("PRICE", 4);
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (isset($_POST['productcode']))
{
AddToCart();
}
else
{
$action = isset($_POST['action']) ? $_POST['action'] : '';
$value = strtoupper(substr($action, 0, 5));
switch ($value)
{
case "CONTI":
header("Location: "."products.html");
break;
case "RECAL":
RecalculateCart();
break;
case "CHECK":
header("Location: "."customer.php");
break;
}
}
}
function AddToCart()
{
$cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : '';
$itemcount = isset($_SESSION['itemcount']) ? $_SESSION['itemcount'] : 0;
$productname = $_POST['productname'];
$extra_price = 0;
$productname = stripslashes($productname);
for ($i=0; $i < $itemcount; $i++)
{
if ($cart[PRODUCTNAME][$i] == $productname) {
$cart[QUANTITY][$i] = $cart[QUANTITY][$i] + intval($_POST['quantity']);
$_SESSION['cart'] = $cart;
$_SESSION['itemcount'] = $itemcount;
header("Location: "."cart.php");
exit;
}
}
$cart[PRODUCTIMAGE][$itemcount] = $_POST['productimage'];
$cart[PRODUCTCODE][$itemcount] = $_POST['productcode'];
$cart[PRODUCTNAME][$itemcount] = $_POST['productname'];
$cart[QUANTITY][$itemcount] = intval($_POST['quantity']);
$cart[PRICE][$itemcount] = $_POST['price'];
$itemcount = $itemcount + 1;
$_SESSION['cart'] = $cart;
$_SESSION['itemcount'] = $itemcount;
}
function RecalculateCart()
{
$cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : '';
$itemcount = isset($_SESSION['itemcount']) ? $_SESSION['itemcount'] : 0;
for ($i=0; $i<$itemcount; $i++)
{
$quantity = $_POST['quantity'.($i)];
if (empty($quantity))
{
$quantity = 0;
}
else
if (($quantity < 0) || (!is_numeric($quantity)))
{
$quantity = 0;
}
$cart[QUANTITY][$i] = intval($quantity);
}
for ($j=0; $j<$itemcount; $j++)
{
$quantity = $cart[QUANTITY][$j];
if ($quantity == 0)
{
$itemcount--;
$curitem = $j;
while(($curitem+1) < count($cart[0]))
{
for ($k=0; $k<4; $k++)
{
$cart[$k][$curitem] = $cart[$k][$curitem+1];
$cart[$k][$curitem+1] = '';
}
$curitem++;
}
}
}
$_SESSION['itemcount'] = $itemcount;
$_SESSION['cart'] = $cart;
}
?>
modified 29-Apr-22 3:30am.
|
|
|
|
|
Probably by adding some numbers together. But you need to add more specific details to your question.
|
|
|
|
|
Bonjour, j'ai un soucis avec les privilèges utilisateurs (AUCUN, EDITEUR, ADMINISTRATEUR).
C'est à dire, en fonction des identifiants rentrés, on a accès à certaines liens du menu.
et malheureusement chez moi le menu ne s'affiche pas. Besoin d'aide, merci d'avance.
voici mon code :
class/Usermanager.php
class Usermanager {
private $db;
public function __construct($db) {
$this->setDb($db);
}
public function setDb(PDO $dbh) {
return $this->db = $dbh;
}
public function displayMenu($user_role_id) {
try {
$sql = 'SELECT A.name, A.slug
FROM user_action AS A
INNER JOIN user_permission AS P
ON A.actionID = P.action_id
AND P.min_role_id < :user_role_id';
$stmnt = $this->db->prepare($sql);
$stmnt->execute(array(
':user_role_id' => $user_role_id
));
while($row = $stmnt->fetch(PDO::FETCH_ASSOC)) {
$menu_data[] = $row;
}
if(isset($menu_data)) {
return $menu_data;
}
else {
return false;
}
}
catch(PDOException $e) {
echo MSG_ERROR . $e->getMessage();
}
}
public function checkUserPermission($action_slug, $user_role_id) {
try {
$sql = 'SELECT P.action_id, P.min_role_id
FROM user_permission AS P
INNER JOIN user_action AS A
ON A.slug = :action_slug
AND P.action_id = A.actionID';
$stmnt = $this->db->prepare($sql);
$stmnt->execute(array(
':action_slug' => $action_slug
));
while($row = $stmnt->fetch(PDO::FETCH_ASSOC)) {
$min_role_id = $row['P.min_role_id'];
if($min_role_id > $user_role_id) {
return $min_role_id;
}
}
}
catch(PDOException $e) {
echo MSG_ERROR . $e->getMessage();
}
}
}
process/process-display-menu.php
$username_form = isset($_SESSION['username_form']) ? $_SESSION['username_form'] : NULL;
$manager = new Usermanager($db);
$menu_items = $manager->displayMenu($username_form);
$menu_html = '';
if(!empty($menu_items)) {
foreach($menu_items as $menu_item) {
$name = $menu_item['name'];
$slug = $menu_item['slug'];
$menu_html .= '<li><a href="' . $slug . '.php">' . $name . '</a></li>' . "\n";
}
}
process/process-user-permission.php
$action_slug = substr($filename, 0, 4);
$username_form = isset($_SESSION['username_form']) ? $_SESSION['username_form'] : NULL;
$manager = new Usermanager($db);
$userPermission = $manager->checkUserPermission($action_slug, $username_form);
if($userPermission === false) {
echo 'Erreur. Cette page n\'existe pas.';
exit;
}
admin/menu.php
require('../process/process-display-menu.php');
<ul class="menu">
<?php echo $menu_html; ?>
<li><a href="../index.php">Site web</a></li>
<li><a href="logout.php">Déconnexion</a></li>
</ul>
admin/index.php
require('../include/inc-connexion.php');
require('../include/inc-config.php');
require('../include/inc-identification-user.php');
$filename = basename( __FILE__ );
require('../process/process-user-permission.php');
require('menu.php');
|
|
|
|
|
I have an input box and a search button, when someone enter some query in input box and press the button then I want to show the results from google on that page. Is it possible to do it with JavaScript or PHP or any other language?
|
|
|
|
|
i have three condition like if(isset($_POST['search']) & !empty($_POST['searchdata']) ) and if(isset($_POST['search']) & !empty($_POST['seardate']) ) and else . these are searching input text field name searchdata and searchdate and esle if empty.
when first condition is true pagination is aslo create according to is t condition similarly on both two condition pagination is created.but confusion when i click on pagination cursor goes to else condition and again all page is shown in pagination.what i can doing wrong... i want if pagination is created in first condition and i click on pagination the cursor should be goes to first condition and the pagination is created upon second condition and i click it should go to second part not to else.
|
|
|
|
|
There's a secret error somewhere in your secret code. You need to fix that.
Seriously, how do you expect anyone to be able to help you fix code we cannot see running on a server we cannot access, based solely on a brief description of the behaviour?
Edit your message and provide the relevant parts of your code, and a clear description of what the problem is, what you have tried, and where you are stuck. Remember to include the full details of any errors.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i proved code of page Problem is when any condition is true and pagination is created according to condition then upon clicking any page why page number is wrong in below part
<?php
include('includes/checklogin.php');
check_login();
?>
<!DOCTYPE html>
<html lang="en">
<?php @include("includes/head.php");?>
<body>
<div class="container-scroller">
<!-- partial:../../partials/_navbar.html -->
<?php @include("includes/header.php");?>
<!-- partial -->
<div class="container-fluid page-body-wrapper">
<!-- partial:../../partials/_sidebar.html -->
<?php @include("includes/sidebar.php");?>
<!-- partial -->
<div class="main-panel">
<div class="content-wrapper">
<div class="row">
<div class="col-lg-12 grid-margin stretch-card">
<div class="card">
<!-- start modal -->
<div id="editData5" class="modal fade">
<div class="modal-dialog modal-lg">
<div class="modal-content" >
<div class="modal-header" >
<h5 class="modal-title" >View Visitor details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="info_update5">
<?php @include("view_visitor_details.php");?>
</div>
<div class="modal-footer ">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</div>
<h4 class="new-title">View Visitor details</h4>
<!-- end modal -->
<div class="table-responsive p-3" style="margin-top: -15px;">
<table class="content-table" id="dataTableHover">
<thead>
<tr>
<th class="text-center">No</th>
<th class="text-center">Full Name</th>
<th class="text-center">Card#</th>
<th class="text-center">Department</th>
<th class="text-center">Facility Visit</th>
<th class="text-center">Status</th>
<th class="text-center">Reg Date</th>
<th class="text-center" style="width: 15%;">Action</th>
</tr>
</thead>
<tbody>
<?php
if(isset($_POST['search']) & !empty($_POST['searchdata']) )
{
session_start();
$pdf_data =$_POST['searchdata'];
$_SESSION['pdf-data']= $pdf_data;
$sdata=$_POST['searchdata'];
$limit=10;
if(isset($_GET['page1']))
{
$page=$_GET['page1'];
$cnt=(($page-1)*$limit) + 1;
}
else
{
$page=1;
$cnt=1;
}
$offset = ($page-1)*$limit;
?>
<h4 align="center">Result against "<?php echo $sdata;?>" keyword </h4>
<?php
$query="select * from tblvisitor where FullName like '%$sdata%'||MobileNumber like '$sdata%'";
$sql_run=mysqli_query($connection,$query);
$num_rows = mysqli_affected_rows( $connection );
$cnt=1;
while ($row=mysqli_fetch_array($sql_run))
{
?>
<tr>
<td class="text-center"><?php echo ($cnt);?></td>
<td class="text-center"><?php echo $row['FullName'];?></td>
<td class="text-center"><?php echo $row['Cardno'] ;?></td>
<td class="text-center"><?php echo $row['Deptartment'] ;?></td>
<td class="text-center"><?php echo $row['Facility'] ;?></td>
<td class="text-center"><?php echo $row['Status'];?></td>
<td class="text-center"><?php echo date ("d-m-Y", strtotime($row['EnterDate']) );?></td>
<td class=" text-center">
<a href="#" class=" edit_data5" id="<?php echo $row['ID'] ?>" title="click to view"> class="mdi mdi-eye"></a>
</td>
</tr>
<?php
$cnt=$cnt+1;
}}
elseif (isset($_POST['search']) & !empty($_POST['date-search'])) {
echo "elseif for pagnation of data wise search is started" ;
session_start();
$sdata=$_POST['date-search'];
$_SESSION['pdf-newdata']= $sdata;
?>
<h4 align="center">Result against "<?php echo date ('d-m-Y', strtotime($sdata));?>" keyword </h4>
<?php
$limit=10;
if(isset($_GET['page']))
{
$page=$_GET['page'];
$cnt=(($page-1)*$limit) + 1;
}
else
{
$page=1;
$cnt=1;
}
$offset = ($page-1)*$limit;
$new_date=date ('d-m-Y', strtotime($sdata));
echo $new_date;
$query="select * from tblvisitor where date_format(enterdate,'%Y-%m-%d')=date('$sdata') LIMIT {$offset},{$limit}";
$sql_run=mysqli_query($connection,$query);
$num_rows = mysqli_affected_rows( $connection );
$cnt=1;
while ($row=mysqli_fetch_array($sql_run))
{
?>
<tr>
<td class="text-center"><?php echo ($cnt);?></td>
<td class="text-center"><?php echo $row['FullName'];?></td>
<td class="text-center"><?php echo $row['Cardno'] ;?></td>
<td class="text-center"><?php echo $row['Deptartment'] ;?></td>
<td class="text-center"><?php echo $row['Facility'] ;?></td>
<td class="text-center"><?php echo $row['Status'];?></td>
<td class="text-center"><?php echo date ("d-m-Y", strtotime($row['EnterDate']) );?></td>
<td class=" text-center">
<a href="#" class=" edit_data5" id="<?php echo $row['ID'] ?>" title="click to view"> class="mdi mdi-eye"></a>
</td>
</tr>
<?php
$cnt=$cnt+1;
}}
else { ?>
<?php
echo "after pagantion else if is started";
session_start();
$pdf_data =$_POST['searchdata'];
$_SESSION['pdf-data']= $pdf_data;
$sdata=$_POST['date-search'];
$_SESSION['pdf-newdata']= $sdata;
$limit=10;
if(isset($_GET['page']))
{
$page=$_GET['page'];
$cnt=(($page-1)*$limit) + 1;
}
else
{
$page=1;
$cnt=1;
}
$offset = ($page-1)*$limit;
$connection = mysqli_connect("localhost","root","","cvdb");
$query="SELECT * from tblvisitor ORDER BY id DESC LIMIT {$offset},{$limit}" ;
$sql_run=mysqli_query($connection,$query);
$num_rows = mysqli_affected_rows( $connection );
while ($row=mysqli_fetch_array($sql_run)) {
?>
<tr>
<td class="text-center"><?php echo ($cnt);?></td>
<td class="text-center"><?php echo $row['FullName'];?></td>
<td class="text-center"><?php echo $row['Cardno'] ;?></td>
<td class="text-center"><?php echo $row['Deptartment'] ;?></td>
<td class="text-center"><?php echo $row['Facility'] ;?></td>
<td class="text-center"><?php echo $row['Status'];?></td>
<td class="text-center"><?php echo date ("d-m-Y", strtotime($row['EnterDate']) );?></td>
<td class=" text-center">
<a href="#" class=" edit_data5" id="<?php echo $row['ID'] ?>" title="click to view"> class="mdi mdi-eye"></a>
</td>
</tr>
<?php
$cnt=$cnt+1;
$tot_rec=$cnt;
}
} ?>
</tbody>
</table>
<?php
if(isset($_POST['search']) & !empty($_POST['searchdata']) )
{
echo "pagntion mobile and name";
$connection2 = mysqli_connect("localhost","root","","cvdb");
$query2="select * from tblvisitor where FullName like '%$sdata%'||MobileNumber like '$sdata%' " ;
$sql_run2=mysqli_query($connection2,$query2);
$num_rows2 = mysqli_affected_rows( $connection2 );
echo $num_rows2;
echo '<ul class="pagination pagination-sm">';
if ($page>1)
{
echo '<li><a href="manage_visitor.php?page='.($page - 1).'" class="page-link" >Prev</a></li>';
}
if (mysqli_num_rows($sql_run2)>0 )
{
$total_record = mysqli_num_rows($sql_run2);
$total_pages = ceil($total_record/$limit);
for ($i=1; $i<=$total_pages;$i++)
{
if ($i == $page)
{
$active="page-item active";
}
else
{
$active="";
}
echo '<li class="'.$active.'" ><a class="page-link" href="manage_visitor.php?page1='.$i.'">'.$i.'</a></li>';
}
if ( $total_pages>$page)
{
echo '<li><a href="manage_visitor.php?page='.($page + 1).'" class="page-link" >Next</a></li>';
}
echo '</ul>';
}
}
elseif (isset($_POST['search']) & !empty($_POST['date-search']))
{
echo "pagnation date wise search " ;
$connection2 = mysqli_connect("localhost","root","","cvdb");
$query2="select * from tblvisitor where date_format(enterdate,'%Y-%m-%d')=date('$sdata') " ;
$sql_run2=mysqli_query($connection2,$query2);
$num_rows2 = mysqli_affected_rows( $connection2 );
echo $num_rows2;
echo '<ul class="pagination pagination-sm">';
if ($page>1)
{
echo '<li><a href="manage_visitor.php?page='.($page - 1).'" class="page-link" >Prev</a></li>';
}
if (mysqli_num_rows($sql_run2)>0 )
{
$total_record = mysqli_num_rows($sql_run2);
$total_pages = ceil($total_record/$limit);
for ($i=1; $i<=$total_pages;$i++)
{
if ($i == $page)
{
$active="page-item active";
}
else
{
$active="";
}
echo '<li class="'.$active.'" ><a class="page-link" href="manage_visitor.php?page='.$i.'">'.$i.'</a></li>';
}
if ( $total_pages>$page)
{
echo '<li><a href="manage_visitor.php?page='.($page + 1).'" class="page-link" >Next</a></li>';
}
echo '</ul>';
}
}
else
{
echo "else pagntion no search criterai ";
$connection1 = mysqli_connect("localhost","root","","cvdb");
$query1="SELECT * from tblvisitor ORDER BY id DESC " ;
$sql_run1=mysqli_query($connection,$query1);
$num_rows1 = mysqli_affected_rows( $connection );
echo '<ul class="pagination pagination-sm">';
if ($page>1)
{
echo '<li><a href="manage_visitor.php?page='.($page - 1).'" class="page-link" >Prev</a></li>';
}
if (mysqli_num_rows($sql_run1)>0 )
{
$total_record = mysqli_num_rows($sql_run1);
$total_pages = ceil($total_record/$limit);
for ($i=1; $i<=$total_pages;$i++)
{
if ($i == $page)
{
$active="page-item active";
}
else
{
$active="";
}
echo '<li class="'.$active.'" ><a class="page-link" href="manage_visitor.php?page='.$i.'">'.$i.'</a></li>';
}
if ( $total_pages>$page)
{
echo '<li><a href="manage_visitor.php?page='.($page + 1).'" class="page-link" >Next</a></li>';
}
echo '</ul>';
}
}
?>
</div>
<!-- <li class="page-item active" aria-current="page">-->
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
<!-- partial:../../partials/_footer.html -->
<?php @include("includes/footer.php");?>
<!-- partial -->
</div>
<!-- main-panel ends -->
</div>
<!-- page-body-wrapper ends -->
</div>
<!-- container-scroller -->
<?php @include("includes/foot.php");?>
<!-- End custom js for this page -->
<script type="text/javascript">
$(document).ready(function(){
$(document).on('click','.edit_data5',function(){
var edit_id5=$(this).attr('id');
$.ajax({
url:"view_visitor_details.php",
type:"post",
data:{edit_id5:edit_id5},
success:function(data){
$("#info_update5").html(data);
$("#editData5").modal('show');
}
});
});
});
</script>
</body>
</html>
|
|
|
|
|
When we install Ubuntu Server all we get is terminal only access. I admit we can install necessary GUI like KDE, GNome etc.
But my concern is whether there would be any security concern to be taken care of when installing anything like this for an Ubuntu Server Azure or AWS? Because I guess with a GUI we also need to expose ports for RDP unlike Private/Public key using Putty.
|
|
|
|
|
mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\xampp\htdocs\binemorg\required\op_lib.php:689 Stack trace: #0 C:\xampp\htdocs\binemorg\required\op_lib.php(689): mysqli_num_rows(false) #1 C:\xampp\htdocs\binemorg\required\op_lib.php(277): get_multi_data('employee_attend...', Array, ' order by id de...') #2 C:\xampp\htdocs\binemorg\employee_attendance.php(8): insert_row('employee_attend...') #3 {main} thrown in C:\xampp\htdocs\binemorg\required\op_lib.php on line 689
|
|
|
|
|
Paste the start of your error message into Google, or your preferred search engine, and you will find the hundreds of times this exact question has been asked before.
The answer hasn't changed: mysql_query[^] returns false if the query fails. You need to test for that before trying to count the number of rows.
As to why your query failed, that's up to you. You haven't shown any code, nor the structure of your database, so nobody can tell you what the problem with your query is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
need to add date in the file name into outfile caluse below please suggest
SET @outpath = "/var/lib/mysql-files/";
SET @outfile = (SELECT NOW());
SET @outextension = "_StepCount.csv";
SET @SQL := CONCAT("Select Concat(ifnull(First_Name,'')," ",ifnull(Middle_Name,'')," ",ifnull(Last_name,'')) AS Name, u.email from users",@outpath,@outfile,@outextension ) ;
PREPARE stmt FROM @SQL;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
|
|
|
|
|
$offline = $odb->query("SELECT COUNT(*) FROM bots WHERE (UNIX_TIMESTAMP()-time)>20")->fetch()[0];
$offliner $offline->fetchColumn();
|
|
|
|
|
I want to solve a PHP issue
I have a db with 2 tables: first one is "document":
id | title |
================================
1 | equations |
2 | great |
3 | painting |
second one is "pic":
id | doc_id | description
===============================================
1 | 1 | "mathematics"
2 | 1 | "physic"
3 | 2 | "litterature"
4 | 2 | "art"
the "doc_id" is a foreign key, related to the id of the table "document"
this is my question: I'm trying to print for each title, all the descriptions related to it, example:
for the title "equations" , the foreign key related to it, is "doc_id =1"
wich means for "equations" i will print "matematics" and "physic"
the final table printed using PHP and SQL, on my browser, should be:
| tiltle | description
===============================================
| equations | mathematics, physic
| great | litterature , art
| painting |
Here's my code:
<pre><?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "doc-pic";
$conn = mysqli_connect($servername, $username, $password, $dbname);
$sql = "SELECT * FROM pic LEFT JOIN document ON pic.doc_id=document.id";
$result = mysqli_query($conn, $sql);
$sql1 = "SELECT title from document";
$result1 = mysqli_query($conn, $sql1);
?>
<table>
<?php
if (mysqli_num_rows($result1) > 0)
while($row = mysqli_fetch_array($result1)){?>
<tr>
<td><?php echo $row["title"]; ?></td>
</tr>
<?php if (mysqli_num_rows($result) > 0 )
while($row = mysqli_fetch_array($result)){
?>
<tr>
<td><?php echo $row["doc_id"]; ?></td>
<td><?php echo $row["description"]; ?></td>
</td>
</tr>
</td>
<?php }
} ?>
thanks in advance
|
|
|
|
|
|
<pre>I have an issue while calculating the column-like bank statement. actually, I am trying to calculate Opening Balance/today In /today Out / Closing Bal in MySQL PHP. I have two tables. material_infor `IN +` entry and material_approvefor `OUT -`. I am considering my opening balance was `123`.
I am new in PHP and I am here using Union All function. Please help me to create the function for getting Opening / In today / out today/closing calculation in my code.
`table- material_in`
| id | components_key | insert_date | credit |
|------|----------------|-------------|-------------|
| 1 | 12345 | 2021-04-16 | 100 |
| 2 | 12345 | 2021-04-16 | 50 |
`table- material_approve`
| id | components_key | insert_date | debit |
|------|----------------|-------------|-------------|
| 1 | 12345 | 2021-04-16 | 30 |
| 2 | 12345 | 2021-04-16 | 2 |
<pre>I am trying the code -
SELECT
`u`.`component_key`,
`u`.`insert_date`,
`u`.`transaction_qty`
FROM
(
SELECT
`components_key` AS `component_key`,
`insert_date`,
`credit` AS `transaction_qty`
FROM
`material_in`
UNION ALL
SELECT
`components_key`,
`insert_date`,
`debit` AS `transaction_qty`
FROM
`material_approve`
) u
WHERE
`u`.`component_key` = '12345'
ORDER BY
`u`.`insert_date`
DESC
the output comes -
| components_key | insert_date | transaction_qty|
|-------------|-------------|------------|
| 12345 | 2021-04-16 | 100 |
| 12345 | 2021-04-16 | 50 |
| 12345 | 2021-04-16 | 30 |
| 12345 | 2021-04-16 | 2 |
`output will be-`
| components_key | insert_date | openbal| today_in | today_out | closebal
|-----------|-------------|-------------|----------|-----------|---------|
|12345 | 2021-04-16 | 123 | 100 | 30 | 193 |
|12345 | 2021-04-16 | 193 | 243 | 2 | 241 |
|
|
|
|
|
This is not a php issue. This is Mysql.
Where are you stuck?
|
|
|
|
|
I was using netbeans for php development before, now VSCode.
My question is why every time I run / load a page, VSCode opens a new blank window... even though VScode is already open... why!? It is true even when I am not debugging!
Even when I run the most basic code to debug,
<?php
phpinfo();
?>
it always opens a new VS Code Window (Untitled-1). Then, let say I press Reload, it again opens the same blank screen.
I am using "PHP Debug" as a extension, and my launch.json is:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000
}
]
}
I do not want to open a new vs window each page I debug. How to fix that?
|
|
|
|
|