| | |
sql query into textarea
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 0
hallo there.
i am new in programming so i ask for your understanding
i want to put the results from a sql query into a textarea. then i want to be able to pick one of the records of textarea and delete it (textarea and database). (i dont have to use textarea i just thouhgt it would be a good idea)
something is not right. this is my code
i receive:
can u help me? what should i do to see the records and be able to pick one of then in order to delete it (from database and textarea)?
i am new in programming so i ask for your understanding
i want to put the results from a sql query into a textarea. then i want to be able to pick one of the records of textarea and delete it (textarea and database). (i dont have to use textarea i just thouhgt it would be a good idea)
something is not right. this is my code
php Syntax (Toggle Plain Text)
echo "<form method=post name=f2 action='dd-delete.php'>"; $qry="SELECT id, member, math, bathmos FROM bathmoi"; echo '<textarea name="show" rows="20" cols="70" readonly="readonly">'; while($result = mysql_fetch_array($qry)) { echo "$result[id], $resuld[memeber], $result[mathima]"; } echo "</textarea>"; echo "<input type=submit value=Submit>"; echo "</form>";
i receive:
PHP Syntax (Toggle Plain Text)
<br /> <b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>C:\xampp\htdocs\admin\drop_down\dd.php</b> on line <b>118</b><br />
can u help me? what should i do to see the records and be able to pick one of then in order to delete it (from database and textarea)?
Last edited by peter_budo; Dec 29th, 2008 at 5:50 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Dec 2008
Posts: 20
Reputation:
Solved Threads: 1
$qry="SELECT id, member, math, bathmos FROM bathmoi";
$handle=mysql_query($qry);
echo '<textarea name="show" rows="20" cols="70" readonly="readonly">';
if(mysql_num_rows($handle) > 0)
{
while($result = mysql_fetch_array($handle))
{
echo "$result[id], $resuld[memeber], $result[mathima]";
}
}
echo "</textarea>";also it is not a good practice to allow user to delete records through a text box, the possibilities of error will increase.
you can list result in tabular form and display a delete link in the last column of each record rows.
Last edited by manish.s; Dec 25th, 2008 at 2:34 pm.
-- Manish Singh
manish.s@neuralit.com
manish.s@neuralit.com
•
•
Join Date: Feb 2008
Posts: 30
Reputation:
Solved Threads: 4
hi there,
you get error at this line becuase in mysql_fetch_array($result) function can takes only result variable which holds output generated by $result=mysql_query($qry);
hope you understand.
Now for deleting part ,me also suggest make table which contain each row returned by query and last column contains link which hold link of php processing page and primary key of that row in the form of querysting.
please check this Url
http://www.experts-exchange.com/Web_..._23328726.html
Hope this will help you.
Thanks & Regards
Dilip Kumar Vishwakarma
you get error at this line becuase in mysql_fetch_array($result) function can takes only result variable which holds output generated by $result=mysql_query($qry);
hope you understand.
Now for deleting part ,me also suggest make table which contain each row returned by query and last column contains link which hold link of php processing page and primary key of that row in the form of querysting.
please check this Url
http://www.experts-exchange.com/Web_..._23328726.html
Hope this will help you.
Thanks & Regards
Dilip Kumar Vishwakarma
Last edited by dilipv; Dec 29th, 2008 at 2:46 am.
Dilip Kumar Vishwakarma
Programmer
.Net Consulting
If this post is answer for your query then don't forget to mark as an answer.
Programmer
.Net Consulting
If this post is answer for your query then don't forget to mark as an answer.
![]() |
Similar Threads
- Multiple SQL Queries in PHP page (PHP)
- Retrving data from database to form (PHP)
- Help with Database Query... (MS SQL)
- Need help for sending data in address bar and retrieving it with query string (ASP)
- how to select the isbn number in table and get all books of isbn selected (JSP)
- SQL Query inserts junk data as well (ASP)
- Error while trying the update query (ASP)
- autogenerated mysql query with javascript (PHP)
- Newbie Question. how to put url into echo $row (PHP)
- Unable to insert form data into a database (ASP)
Other Threads in the PHP Forum
- Previous Thread: connectivity problem
- Next Thread: Adding multiple images
| Thread Tools | Search this Thread |
apache api array auto beginner binary broken cache cakephp checkbox class cms code codingproblem cron curl customizableitems database date display dynamic echo email error errorlog file files filter folder form format forms forum function functions gc_maxlifetime global google headmethod href htaccess html image include insert ip javascript joomla limit link login mail malfunctioning memmory memory menu method mlm multiple mysql nodes oop parameter parsing paypal pdf php phpmysql popup query radio random recursion recursiveloop remote script search select server sessions snippet source space sql static survey syntax system table trouble tutorial up-to-date update upload url validator variable video web youtube





