Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-06-2004, 04:12 PM   #1
Registered: Jan 2003
Location: Belgium
Distribution: Mandrake 9.2
Posts: 475

Rep: Reputation: 30
MySQL/PHP - checkboxes etc


Sorry for not doing my homework. Naturally, I should figure this out myself, but at this moment I got no time for this, hence I ask for your, LQ experts', help.

Here is a simple code:


$link = mysql_connect("localhost","root","");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT * FROM periodicals" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=70% border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
print "</table>\n";
Obviously, it connects to the database "bibliography" and produces an HTML output with the contents of the table "periodicals". All this is perfect, but, not useful. I need the results to appear in a table containing a form, which will display a checkbox next to each raw so that I can check it and insert into the next page by hitting on Subimt button. I might need to check a few checkboxes in order to pick up more than one record. Tonight I spent well over four hours, and I am still not arriving at anything working. A little hint would get me started. Thank you.
Old 05-06-2004, 04:22 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,571

Rep: Reputation: 180Reputation: 180
One of the rules is that we don't do homeworks, so you'll get a tip...For every entry you get from your SELECT create a checkbox with an unique name. When you then click 'submit' your next script will have the values of checked checkboxes.
Old 05-07-2004, 04:12 AM   #3
Registered: Jan 2003
Location: Belgium
Distribution: Mandrake 9.2
Posts: 475

Original Poster
Rep: Reputation: 30
Thanks. I will try that. In a mean time try to bundle ODBC with the OpenOffice. Maybe that's the tool wich I could customise to do what I need.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
checkboxes in php [on/off] ALInux Programming 1 11-09-2005 06:40 AM
Arrays, checkboxes in javascript & PHP Elijah Programming 21 11-15-2004 11:37 PM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 08:54 PM
php4 mysql, installation, php-pages with mysql info stay empty dnla Linux - Software 2 03-14-2004 02:54 PM
Apache Mysql Php: mysql with php doesn't work breakerfall Linux - Networking 6 12-27-2003 08:59 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration