Page 1 of 1

MySQL CRUD not showing current records

Posted: Fri Apr 12, 2024 4:13 pm
by KaiMartinsen
I am able to add records, but the database's records is not showing in the list.

Why is that?

What am I doing wrong?

Re: MySQL CRUD not showing current records

Posted: Fri Apr 12, 2024 4:17 pm
by Pablo
Please try to be more specific.
What are your settings?
What is the database structure?
Are there any errors?

Re: MySQL CRUD not showing current records

Posted: Fri Apr 12, 2024 5:43 pm
by KaiMartinsen
I have a Bootstrap Table which is connected to the MySQL database and it shows the records just fine.

This is the settings for the MySQL CRUD:

Image

It is connected to the same database with the same user.

When I add records, the records are added to the database and shown in the Bootstrap Table.

The MySQL database table fields are: ID (auto increment), title (text) and text (longtext)

This is the settings for the Bootstrap Table:

Image


More info:

The Bootstrap table is on the page database.php
The MySQL CRUD is on the page redigerer.php


This is that the MySQL CRUD looks like on redigerer.php:
It is possible to add records but it does not show any of them in the CRUD editor itself.
Image

Re: MySQL CRUD not showing current records

Posted: Fri Apr 12, 2024 5:50 pm
by Pablo
Are you sure the fields names are correct?
Note that these are case sensitive.

Also, you have set 'listview' of all items to 'no'!
And the primary key must be in the listview, as documented in the PDF.

Re: MySQL CRUD not showing current records

Posted: Fri Apr 12, 2024 5:54 pm
by KaiMartinsen
Thank you.

It was the listview setting that was wrong.

Another question:
How do I change the order of the list (by default)?

descending vs. ascending

Re: MySQL CRUD not showing current records

Posted: Fri Apr 12, 2024 7:32 pm
by Pablo
In the filter property you can add additional SQL.

For example:

Code: Select all

1=1 ORDER BY fieldname DESC 

Re: MySQL CRUD not showing current records

Posted: Fri Apr 12, 2024 8:13 pm
by KaiMartinsen
Thank you so much! :)

Re: MySQL CRUD not showing current records

Posted: Sat Apr 13, 2024 2:59 pm
by Paul
Hello,

If I understand correctly, if I add in the filter option of the extension: ''ORDER BY No ASC' , my registration numbers will go past 1, 2,3,4,5.... The problem is that the search result displays the numbers in descending order. e.g. 999,998, 997 instead of 1,2, 3,...997, 998,999, ... I use the filter option to correct this situation but I get a message: "Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in..."

Thanks

Re: MySQL CRUD not showing current records

Posted: Sat Apr 13, 2024 3:17 pm
by Pablo
Did you also add "1=1"? otherwise the WHERE statement will be invalid.

Re: MySQL CRUD not showing current records

Posted: Sat Apr 13, 2024 7:55 pm
by Paul
I have add :

'1=1 ORDER BY No DESC'

error :
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in ..... on line 148

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in .... on line 154

Re: MySQL CRUD not showing current records

Posted: Sat Apr 13, 2024 8:28 pm
by Pablo
It is difficult to help you without seeing all your setting.

Re: MySQL CRUD not showing current records

Posted: Tue Jul 16, 2024 8:20 pm
by craigcampbell
I'm having the same issue with a trivial page.
I can ADD records to the file, and they appear (when I check the file), but the files current contents are never listed.

I've boiled it down to what I hope was the simplest test possible.

The test can be viewed live at http://eahl.ca/index.php (if I'm allowed to post that)

I entered two (2) fields of type editbox. Required=yes and listview=yes

The test file currently contains,
fred,freddata
fred2,freddata2
Creag,craigdatat
craigc,craigdata2
craig3,craigdata3

Adding records works,
Search produces the following error message,

Warning: A non-numeric value encountered in /data/www/jail/eahl.ca/htdocs/wb.csv.crud.php on line 147

The referenced line 147 contains,
return (stristr($row[$csv_column+1], $csv_value) !== FALSE);

Re: MySQL CRUD not showing current records

Posted: Wed Jul 17, 2024 5:35 am
by Pablo
Based on your description it sounds like you are using a different extension?
So, I doubt that this is the same is issue.

But anyway, to be able to help you, I need a DEMO project (.wbs file) so I can see all your settings.
Also, please include a description how to reproduce this problem.

I do not need the complete project because that will only take more time to figure out what you have done.
Basically, I just need a small project with one page and object(s) that are relevant to your question.

Note that I cannot see what you have done based on the published page (HTML), because the software has thousands of options and millions of possible combinations.
So, there is no way to know which options you have used by looking at the HTML only.

For further details about how to share a project file, please see this FAQ:
viewtopic.php?f=10&t=82134

Re: MySQL CRUD not showing current records

Posted: Wed Jul 17, 2024 10:23 am
by craigcampbell
Is this what you are looking for?

http://eahl.ca/Control_Panel.wbs

Re: MySQL CRUD not showing current records

Posted: Wed Jul 17, 2024 1:50 pm
by Pablo
The column values are not correct. The column should be a number. Please see the documentation.

Re: MySQL CRUD not showing current records

Posted: Thu Jul 18, 2024 9:32 pm
by craigcampbell
Do you have a reference for the documentation?
What I've located so far was minimal.

Thanks so much. I am making progress.

Re: MySQL CRUD not showing current records

Posted: Fri Jul 19, 2024 5:40 am
by Pablo
There is a PDF document included with the extension.
The PDF has the same name as the extension.