Inserting data from text area into database [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Hi I want to insert data from text are into database but what I want is every line of text are should occupy a new row in the database. e.g
number one
number two
number three
this is the content of the text area and should be inserted into three different rows of the table.

Use PHP's explode() to split the textarea's content up at each line break. So something like:
$lines = explode("\n", $textarea_content);
$lines will then be an array.

Related

How to store a text in mysql separated by a comma [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i have a query that in table replies i have to add few words seperated by commas
Like a user said
How are you
so it should store the txt like 'how,are,you'
...
and how will i fetch the the text from the cell
Basically it should be like
User submits a reply to a bot in which
the bot will give the reply on the bases of the words ...
You can use str_replace so you can replace all spaces with commas.
Something like
str_replace(' ', ',', $userstring)

Create individual variables for each row in table? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a table, codes, with 3 columns (code, email, sent).
How do I call on the first X number of rows of table codes and assign each individual code (in code column) a variable with ordered numbers? (ie $code1, $code2, $code3, $code4)
Now, I will be calling on a multiple of 10 rows (10 rows, 20 rows, 30 rows) at a time so I need to be able to call on these codes individually for other procedures.
Thanks so much for the help!
Try putting the results in an array. Then call on them by using $code['1'] or what ever you are looking for

rotating list per refreshing page [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Lets say there are three rows of information that loads on a site, and on the site, you only want 1 of the 3 rows to load each time the page gets refreshed, so it probably should be sorted by random or something better. what is the best code for this?
Go for array_rand()
<?php
$arr=array("Offer 1","Offer 2","Offer 3");
$val=array_rand($arr,1);
echo $arr[$val];

How To Pass Multiple Variables In One value in php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have 3 requested variables in php code, use blow,
$boddate=$_REQUEST['boddate'];
$bodmonth=$_REQUEST['bodmonth'];
$bodyear=$_REQUEST['bodyear'];
I want to get that 3 variables on one value. ($dateofbirth=) How to coding in php for send mysql database.
And I have imported question is that value , first and third characters want displayed and other characters removed using "substr" php commend , I want check for first in removed character,
Eg- I have value "America"
I want get using substr commend "A" and "E" characters,
$cu = "America";
$country1= substr($cu, 0,1);
$country2= substr($cu, 2,1);
I'm not sure how to all variables get in one and three characters,
You can just concatenate them using the ..
$birthdate = $boddate."-".$bodmonth."-".$bodyear; // D-M-Y
$birthdate=$_REQUEST['bodyear'].'-'.$_REQUEST['bodmonth'].'-'.$_REQUEST['boddate'];

Retrieve mysql data that doesn't contain number [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to retrieve a list of words, but don't want any words that contain a number or numbers in them.
The idea is very simple, but I'm not even sure how to try. I have one column of words some of which have numbers in them. I only want to retrieve the ones without numbers.
How would I do this in my SQL query?
Thanks
Use a regular expression, either with php's preg_match, or with REGEXP in mysql.
SELECT list_col FROM list_table WHERE list_col NOT REGEXP '[0-9]'

Categories