MySQL unrepeatable rows search query [closed] - php

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I save some images in my database. Each images have a "tags" property.
I'm gonna show "search by tags" result to users, but there is a problem.For example, "IMAGE1" has "c#, programming, scripting" tags and I'm gonna show every images which have "programming" and "scripting" tags. So If I do that, "IMAGE1" will be duplicated.
So how can I prevent this duplicating ?!
Thanks !!

You can use DISTINCT operator of MySQL to retrieve non-duplicates
SELECT DISTINCT `imagename`
FROM `images`
WHERE (`tags` = 'programming') OR (`tags` = 'scripting')
The conditions for WHERE may be different depending on your PHP code.

Related

mySQL query from a table [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 days ago.
Improve this question
A company maintains the data of its customers in the CUSTOMER table. write a query to print the ids and the NAMEs of he customers who are from the USA and whose credit limit is greater than 100000, ordered by increasing ID number
TRIED TO query it from one table but checking the validation is hard for me

XCRUD : how to insert html? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I use an old library xcrud (php) from https://codecanyon.net/item/xcrud-data-management-system-php-crud
And I fo try to insert some HTML tags, but they are all stripped.
Any idea on how to avoid stripping html tags ?
Regards
There is a new Version of Xcrud that could work better for your need. You can find it here www.xcrud.net and they still offer support.
To also avoid the tags from being stripped, you can use tinyMCE by specifying a column to be text.

How to put more than one specicfication after the WHERE part when selecting data in php pdo [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am creating a website that takes data from the user and searches in some database for a hall that meets all the users specifications so I search in the database using php pdo method by typing
(SELECT * FROM thetablename WHERE place=$place,category=$category)
But it doesn't work, I want the choose raw to have a hall name that I will get later and this hall contains all the specifications of the user together.
(SELECT * FROM thetablename WHERE place=$place AND category=$category)
You need to use the AND keyword.
You could of answered this with some simple searching.
SQL Where

php - data entry and order issue [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Im having a little trouble with a php script ive made.
you can see all the relevant info at http://click-media.co.uk/Client/Lisa/Admin/admin.php (password: "hey")
I basically need the classes to be ordered by day/time when a new class is created, either by changing the column names in the database to a timestamp or something or by making a new column to and ordering it by this.. then using the php to switch the order values when the admin clicks "moveup"/"move down" next to the row.
any help would be much appreciated.
Thanks
You can implement this by doing the following:
Add a column in the database and call it class_order
Your SQL query should have ORDER BY class_order
Moving up UPDATE table set class_order = THE_ORDER_OF_THE_CLASS_ABOVE WHERE id = TARGET_CLASS and UPDATE table set class_order = TARGET_CLASS_ORDER WHERE id = THE_CLASS_ABOVE
Moving down is the opposite of moving up

PHP read specific row [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have a PHP script that displays data read from a MySQL database. I want to filter the output to only show rows where two columns contain specific values. How do I do this?
Add a WHERE clause, e.g., WHERE column1 = 'specific-value1' AND column2 = 'specific-value2'
Here's a link to MySQL's SELECT syntax:
http://dev.mysql.com/doc/refman/5.1/en/select.html
(and in German):
http://dev.mysql.com/doc/refman/5.1/de/select.html
no idea why you are posting in german on an english site and then translating it to english. But what you need to do is something like "select * from table where column1='val' and column2='val'". Though it sounds like you have a large set of data pulled off already and you want to filter that. I don't see why you shouldn't just query what you need from the database instead of pulling everything off and then filtering.

Categories