How to remove unrecognized character via MySQL query or PHP code? - php

I have uploaded CSV via CLI command and in the CSV have used bullets with description column.
When it imported in MySQL its showing like boxes for reference we have also attached screenshot. i want to replace with <li> tag or any other character. But neither i am able to select and replace character in MYSQL nor vi PHP.
I have already try update table name set field = replace(filed,"spacial","") but character not recognized in MySQL query.

We can change on front-end with help of javascript. So, share your website single page link or HTML from top (id or class).

Thanks you guys for solutions but i got the solution to replace character bullet was not visible in database but i have tried and got luck. it was replaced luckily.
MYSQL update script for Magento 1 product short description and description update query. you can also run with your tables via replace table name and fields.
UPDATE catalog_product_entity_text SET value = REPLACE(value,'• ','') WHERE entity_id = 141047 and attribute_id in (73,74)

Related

PHPMyAdmin Grab specific strings from table

So I have a table in my SQL and it saves ServerID from discord, now like 500 users verified and on the table it says like ServerID: 123 User: Test
Now I accidentally I have deleted the server on dashboard and all things with the server id 123 have been deleted, I have made a backup earlier, now my question is can I do it like I only search id 123 can download only the strings with it and add it to my old database? Thanks!
Standard query language (SQL) makes this beautifully simple to do.
SELECT * FROM table WHERE id = 123;
Explain
The SELECT portion indicates you wish to select/inspect a given record.
The * indicates that you wish to select all records.
The FROM indicates the desired table - and lowercase table indicates the table name. The table will need to be customized to your environment.
The WHERE is your filter and indicates what type of wheres to search.
The id = 123 is restricting your WHERE to results when the keyword id is equal to 123
You should finish all SQL queries with a semicolon. This is language syntax, but may not be required depending on your interface.
I would load the entire SQL file to a new database (you'll want to open the SQL file in a text editor to search and replace any references to the old database name; not all database dumps will contain the database name but if it does, you don't want to accidentally import to the wrong database).
Once you have the new database, it's relatively simple to search across all tables for the rows that reference the id 123 and either manually or programmatically replicate that back to the original database.
There are 2 ways to recover it.
You have to restore the backup and then grab the required string and then later on delete the unnecessary data.
Open the file via a text editor, use ctrl+f to find the required string and then insert/update it in your database via SQL query.

How to update all records by adding custom name for all the entry

I have facing a problem. I want to update all my database field value by adding a custom name at the beginning of the row. Here is an example.
In the above picture i want to add a folder name image at the beginning of each record in the table. But I am unable to do it. Sorry for my bad English.
It sounds like you just want this update:
UPDATE yourTable
SET image_large = CONCAT('image/', image_large);
But if I get a vote, then I suggest that you just add this prefix in your presentation layer.
Call a UPDATE like this (simplified)
UPDATE table SET field1 = concat('image/', field1);
Backup your data before. And be aware without a WHERE clause it will update every row!

Export MySQL column aliases in phpMyadmin

I am currently moving from one ticketing system to another. The table columns are close but not quite. I can run a query that will change the column name to what I need. However, when I export I am getting the original column name.
Here is the query with alias:
SELECT u.id AS staff_id
FROM users AS u
This gives me what I need. However when I export it, it is showing the original column names. Is there a way to keep the alias when exporting?
Since you're using phpMyAdmin, you can quickly use the "Rename exported databases/tables/columns" feature to rename your table and/or columns when exporting. (I believe this feature was added with version 4.6.0).
On the export page, select the "Custom - display all possible options" radio button, then in the "Output" area look for the "Rename exported databases/tables/columns" checkbox, which opens an additional dialog where you can adjust these names.

Adding FIELDS on mySQL database without visiting phpMyadmin

i want to create database with a intity name "insert" but have a only one FIELD name--> "ID_no" <-- (this is auto increment field)
then .. i want to use PHP codes to add a FIELD without visiting the phpMyadmin
example:
i create my database name "data" and the intity name is "insert"
FIELD
ID_no |
then i will the use the php output code which functions of ADDING FIELDS in mySQL database to add a fields On my database..
PLEASE SHARE YOUR SOURCE CODE.....
You need to write an ALTER TABLE.. query, and then execute this in the ususal way. eg:
ALTER TABLE <tablename> ADD COLUMN <columnname> <columntype>;
replacing the values in < >

mysql import to varchar field contains something I don't see

I have been looking for this problem since a while so I guess I stuck.
Case is: I'm importing a large csv file into mysql database with Bigdump (thanks to A. Ozerov), delimiter is |, all is fine, this works.
In my last varchar field the values are usually: '', 'X', '1', '0'. Problem is if I do a select query to this field and look up values with '', I find none or one only. I checked a few lines one by one and found that the phpmyadmin shows a "textarea" instead of a textbox. I went and selected the field data and nothing was there (not even a carriage return). Still I could save the line and reopen it, when the textarea changed to textbox.
I wonder if anyone ever saw this error, and if there is a way to fix this database runtime from php (part of daily process), not line-by-line.
I even tried to copy paste both the csv and the database field to text editor to see if a char is there that I don't see.
The data I want to use is:
0 if the value is empty, 1 if the value is anything else. Currently I am not able to separate this two for the above reason.
Thank you in advance!
Check for hexcidecimal values in the column by doing this:
SELECT HEX(columnname)
Then use REPLACE to change the Hex values to Null or ''

Categories