473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Database and Check box

18
Hi all,
i had written a query.
Expand|Select|Wrap|Line Numbers
  1. $sql3="select userid from projectassign where projectassign='$projectassign'";
  2.      mysql_error();
  3.     $result3=mysql_query($sql3);
  4.     $num1=mysql_num_rows($result3);
  5.     $i=0;
  6.     while ($i < $num1)
  7.     {
  8.         $userid=mysql_result($result3,$i,"userid");
  9.         echo $userid;
  10.         $i++; 
  11.     }
so now i am getting some userid's. Now there are some checkboxes present in a table of users.Based on the query, userid's obtained i need to have them checked.
Example:
i got the userid's as 1,2,3 from the query.
Now there is checkbox to each users with userid 1,2,3,4,5. so wat i need is i need users having userid's 1,2,3 as checked in their checkboxes. so can any one please....
Thank u..
Jun 8 '10 #1
2 1096
dlite922
1,584 Expert 1GB
use an if statement and use PHP's in_array() function to check if a value is in the array, if it is, echo check="checked" in the checkbox tag.

Dan
Jun 16 '10 #2
Dormilich
8,658 Expert Mod 8TB
echo check="checked" in the checkbox tag.
or echo " checked";, if you’re writing HTML.
Jun 17 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Lane Beneke | last post by:
All, New to the list and a relative newbie to PostgreSQL. Please forgive stupid questions. Designing an application server for a work order processing (et al) database. I have a good handle...
3
by: Sam | last post by:
I have developed a small database which is setup with the front end and backend files. There are 12 linked tables withe the datafile located on our server. Now the boss wants to be able to...
3
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be...
4
by: Bryan Powell | last post by:
Is it possible to grab data from a MySQL database and print it on the screen with VC++? The database is on a linux server if that would make any difference.
2
by: jritacco | last post by:
I have a user that is somehow managing to open multiple copies of a single Access database. We are using Access 2003 and everything I have tried makes it IMPOSSIBLE to open the same database more...
10
by: Jay | last post by:
In C# I can set up an Enum so that number are represented as keywords, which is very useful. Is there such a datatype in a database? I suppose I could use an extra table, with the ID column as...
2
by: azmiza | last post by:
Hi everybody, I need your help. I want to view my sql database and its work very well which is display in my web browser but once I want to press button yes, its not working, I check the...
5
by: dani kotlar | last post by:
I run the following code: this.carsBindingSource.EndEdit(); this.carsTableAdapter.Update( this.vehiclesDataSet.Cars ); in order to save changes in the dataset to the database, but the changes...
1
by: =?Utf-8?B?SGF3aw==?= | last post by:
Hello, I have been trying to get a duplicate field checker to work within my gridview using a custom validator. However with the code I have I am getting an error error: Object reference not...
3
by: lucky33 | last post by:
My employer has asked me to create a database that will keep track of the employee attendance. Time off / Time earned, excused / unexcused, etc. At my company from the 6th month of employment to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.