LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

Rep: Reputation: 30
MySQL/PHP - checkboxes etc


Hello,

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:

Code:
<?php

$db="bibliography";
$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";
mysql_close($link);
?>
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, 05:22 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
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, 05:12 AM   #3
linuxfond
Member
 
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.
 
  


Reply


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 07:40 AM
Arrays, checkboxes in javascript & PHP Elijah Programming 21 11-16-2004 12:37 AM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 09:54 PM
php4 mysql, installation, php-pages with mysql info stay empty dnla Linux - Software 2 03-14-2004 03:54 PM
Apache Mysql Php: mysql with php doesn't work breakerfall Linux - Networking 6 12-27-2003 09:59 PM


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

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