Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - dobsun

1
Issues / multiple data bases
Hello,
Please help!
I would like use different Mysql db with one instalation !?
so far my project is simple cash flow for different shops, it is ready installed on server, works fine for one shop only! but I have 22 shops, I don't want 22 installations, they should use different db, as they don't need to see each other... so I have 22 same structure data bases and one installation...
So i have made drop down menu in index file just before log in, in order to change  db name in config.php :
define("DB_NAME", "cashflow_1");
result is Notice: Constant DB_NAME already defined in ...
so I have that problem as once constant is defined we can't change it !

So I have that fight for few days,
I have try so far to change hole config.php, it makes some other issues,
I have try undefine, I have no full control of that server, so that php plugin is not an option,
I have try true and false statment for define...
I have try delete from config.php and put  in PDOdb.php my own variable... but I'm doing something wrong
please advice?  other ideas, that could solve that?
or Where to put my variable $db_name to make it work?

2
Questions / what a user see? what none user see?
Hello,
Before a year I create small project with PHPrad 2.7.3,  I needed only login Authentication and I was happy!
Now I decided to make my project more open  so I make some pages to be seen by guest !
In Authentication I marked pages that no require user Authentication(guest) ... it works by direct link!

the problem :
I was expecting to see menu with those pages  + login link and completely different home page!
How to create a menu for that guest? Did I miss something?
Is there an easy way or I should do menu/guest/home/etc pages my self ?

New version of phprad - is there a guest section? what to expect ? When is coming?
3
Issues / Re: Export to PDF generate only 1st page?
I found a solution, it is not perfect but works for me!

in CSS
<style>
.page_break{
    page-break-before: always;
}
</style>

in view.php

 <div class="page_break"></div>
4
Suggestions / Re: be able to search in more then one column!
@willvin
Maybe my explain was poor, I will try again!
search is working but very bad! It search by one word only! yes in all columns and all rows!
 but if you search by 2 or more words, and if combination exist in a one field it will return result, but if combination is in more fields it will return "No record found"

what I mean I have table with 1000 rows, simple table few column only:
id | name | position | salary | month| year| date

so I want to find specific rows by searching:  John 2018
result I get is "No record found",
the result should return: 12 rows

so how to fix this?


8
Issues / Notice: Trying to access array offset on value of type null
Hello,
I get this: Notice: Trying to access array offset on value of type null
My code is working stand alone!
  but it is not working in PHPRAD!

this is the part of the code that return the notice:
  return isset($_num0[$nmber]) ? $_num0[$nmber] : $_mod10[$nmber] ."надесет";

help, please
9
Issues / number_to_words issue
I have this code :
...
$total=4654;
   print "<b>".to_number($total,$lang="en")."</b>";
   print "<b>".number_to_words($total,$lang="en")."</b>";
...

it returns
...
Error 500
Server Error
Error Message   Class 'NumberFormatter' not found

how to make it work?
where is NumberFormatter as file ?
where to check what languages are as options $lang="en"?
11
Questions / Re: How to call an array in add page from controller?
@willvin
Hi,
I have a form add.php, there is few calculation have to be made and should be confirmed before real submit/inserting in a db
so I make one additional button with name='update', then in page events before add I put the code:
if(isset($_POST['update'])){
 $fields = array("doc" => $_POST['doc'],
                          "test" => "11111111111111111111111",
             "uprice" => $_POST['uprice'],
           "qty" => $_POST['qty'],
"total"=> $_POST['uprice']* $_POST['qty']
);
             return   $this->redirect("docs/add");
}
The idea is to update those values from the array in the form add.php!
How to display it in add.php?
 
13
Bugs / Re: relation bug
if refresh is used between clicks it works fine so it is not big issue for me!
you could try it your self, It is not only me I think!
Thank you
14
Issues / Re: view page of multiple selected value and labels
<?php
//single row:
$company_id=$cid;
$cmtcc = new CompanyController;
$db = $cmtcc->GetModel();
//execute SQL statement and return a single row
$params = array($company_id);
 $array  = $db->rawQuery("SELECT * FROM company WHERE id = ?", $params);
 $company=$array['0'];
?>
 <br <?php echo $company['company']; ?>
<br> <?php echo (ucwords($company['vat'])); ?>
//etc....
<?
//many rows
// one way  in my case $products_in_cart is an array with a product_ids and quantitys

$cmtc = new ProductController;
$db = $cmtc->GetModel();
$exeq = (array_keys($products_in_cart));
$counter = 0;
               for($i=0; $i<count($exeq); $i++){
             $pid = $exeq[$i];
             $pid = array($pid);
             $pids = $db->rawQuery("SELECT * FROM product WHERE id = ?", $pid);
             $product = $pids['0'];
             $counter++;
?>
 <br <?php echo $product['name'; ?>
 <br <?php echo $product['id'; ?>
<?
}

// the above code is simple but could crash, so it is better to call the db array first then the loop as:
$params = array($products_in_cart);
$arr = $db->rawQuery("SELECT * FROM product WHERE id IN (?)", $params );

see also: https://phprad.com/forum/index.php?topic=834.0
especially wilvin links and video

15
Questions / How to call an array in add page from controller?
From few days I can't figure out the following:
I want to call array in add.php!

code:
// in page event before add:
......
if(isset($_POST['update'])){
 $fields = array("doc" => $_POST['doc'],
                          "test" => "11111111111111111111111"
);
 $this->set_flash_msg(get_lang('UPDATED! '), "success");
               return   $this->redirect("docs/add");
}
.....
//in add.php
I have try so much different options in controller and add.php as: $modeldata['test']; $data = $this->view_data; request, view_data, $data['test'], I even make my own view functions and etc... and No it didn't work... due to some reasons, it clear the array and display blank: and gives Notice: Trying to access array offset … or print_r gives blank array etc...
I call the controller to display other arrays  from DB as well, that seems to be the main issue... as that calls are bellow in page, and mayby that is what clears my $post['update'] data?

Please advice, how to call this array in add page?
<?php
// I want to call it this in add.php
echo fields['doc'];
echo fields['test'];

//but how to do it?