how to insert multiple line textarea value in mysql table [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a textarea and I want to insert values of that textarea to a mysql table. But I want to insert each line to each field. Like the textarea has 3 lines...each line should be inserted in 3 each field in the table. Can anyone please help me with this.
Regards,

Explode the value of the textarea (see PHP manual for the syntax of explode). You will end up with a string array with 3 items. Now you can process each of these items individually.
Do you really mean columns (fields) and not rows? If someone enters 100 lines in the textarea you would neet 100 columns. This is considered to be bad data design.

Related

In database table not insert data(img) above number of 20 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I'm creating a database table for images, but when I am going to insert data(img) above 20 then I can't able to insert data. My table rows only able to insert data only 20. I want insert data number of 30 or 50. So how can I fix this problem.

SQL - Query to find records that contain part of the value [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 months ago.
Improve this question
I have table zipcode which has a column called code. The Code column contains the prefix of zipcodes like
395
453
302
1203
12
I want to write an SQL query that checks if the provided zipcode matches one of the values in the table. (Something like isValid)
I want to avoid writing all zip codes in the database.
Valid Input zipcode
395004
395152
3952
1256
Can anyone help me? Thanks
simple sql query:
select *
from zipcode
where '395004' LIKE CONCAT(code,'%');
references: SQL - Query to find if a string contains part of the value in Column

Mysql : duplicate last record every minute [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to duplicate the last record in my table every minute, i'm using php and mysql.
I can use a cronjob to run it every minute, i know how to do that.
But i don't know how to duplicate the last row, i only have an id that auto_increment and value column.
For example :
Id, Value
10, Green
11, Green
12, Green
13, Green
I think select into is what you are looking for.
https://www.w3schools.com/sql/sql_select_into.asp

Store area unit conversion in mysql table [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have land buy/sell related website. So I want to store land area units in India and their conversion in other in units in mysql table. When user from specific area see properties list on website and if he selects acre in dropdown list then he can see the every property area in the acre though the property was listed in another unit.
So How Do I do this??
A simple two table can do this .. if you like..
Table 1:Units[id,UnitName]
Table 2:ConversionUnit[conversionId,fromUnitId,toUnitId,offset]
such as
table 1: [1,Centimetre],[2,Mitre],[3,kilometre]
table 2: [1,1,2,100],[1,3,1,0.000001]
First entry in the table to for converting CM to M and second row is to convert from KM to CM.
Hope it helps..

The database returns only the first row instead of column [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to obtain a column name EmailId from the table named Users. But it returns only the first string and nothing else?
PHP:
$sql="SELECT EmailId FROM Users;";
$result =mysqli_query($conn,$sql);
$col=mysqli_fetch_array($result);
The database has 3 email-ids but count($col) returns only 1. Why so?
Thanks in advance.
The database has 3 email-ids but count($col) returns only 1. Why so?
Because
$col=mysqli_fetch_array($result);
only fetch the first row according to the internal pointer of the dataset, and therefore
count($col)
returns 1 because $col is an array having 1 item.

Categories