This is my current code for adding some additional information to a database table named klantinfo. This information is added after the user is logged in. At the login, the given username gets inserted into the login table, but also into the klantinfo table. This way I can compare the username in the database with the username in the session,
Tag: php
PHP, SQL – INSERT INTO SELECET CASE
I have this PHP code connected with form (using nette framework), name of columns are different in every table but geo column is in everyone: which generate this SQL: but I’m getting this error: The goal is to COPY data into the same table but change value of geo column before insert. I know that ELSE value looks stupid but
How to let user only delete their details and no one elses php
I created a very basic site where a user logs in and then has access to a table that they can edit. I want the user to be able to only delete their own details and no one elses, and I don’t know what i’m supposed to add to the delete page so it only deletes the details of logged
How do you prevent tags from displaying in textarea?
I am saving this string into my sql db: This displays fine in a table: But when I display it in a textarea it shows up like this: How can I get the textarea to keep the formatting but not show the <br> tags. Answer You would want to strip out the <br> tags and the extra space. Here’s a
get all the tables within a date range
I have many weekly backup tables of the same structure and columns but with different names containing some user-specific information like this. Now I want to find the tables within a date range for example: If I choose the date range of 2021-11-20 to 2021-11-13 then the tables fetched would be user_details, user_details_20211126, user_details_20211119 for using them in a query
Check value of last 4 rows
I want to check the value of the last 4 rows from DB. If these 4 rows have a specific value, Do something. So the table looks like this: Here is a fiddle to test with: http://sqlfiddle.com/#!9/1064b3/1 I can run the following query SELECT * FROM testing ORDER BY id DESC LIMIT 4, Then check with PHP: Is there is
php stop sql query from running every time on refresh
In my php script, I used a sql query to create a table, but after creating the table every subsequent refresh will return an error message stating table is already created. I know its already created but how do I stop query from running a second time on refresh if its already ran? php script: Answer The DDL commands, such
Counting Rows Includes JSON by Id in Codeigniter
We have one groups table name as “groups” (There is mail groups) We have one person table name as “person” (There is persons who has in mail groups) We saved person in the “person” table with json_encode by group ID. Because a person can belong to more than one group. The problem is we can not get count rows of
How to merge two array if one item exist in both array?
I want to expand my city array with post code value. If the city_postcode array contain city array name record then push postcode value into city array. That’s what i want to achive somehow. city array: city_postcode array: The result I want: Answer If you can rely on the cities and post codes to be equal in length and sorted,
Integrity constraint violation: 1052
Integrity constraint violation: 1052 Column ‘id’ in where clause is ambiguous (SQL: select * from kumeti_member_registrations left join members list on members list.id = kumeti_member registrations.member_name where id = 2)”, this Query please solve the error Answer Try this: