Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2005, 07:56 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select * from column

I'm trying to write a bit of code and if possible I want to generalise the search query.

I have this query at the moment:
$query = "SELECT * FROM Table_Article WHERE Article_ID='$Article_ID_Value'";

Which is fine if $Article_ID_Value="1" or "2" or "1500" but if I want to get a full list * this isn't working.. possibly because MySQL is looking for "*" in the Article_ID column and not returning me all (*) the result

Is there a way to do this?

thks.
 
Old February 25th, 2005, 10:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm not an expert on MySQL, but try a LIKE query instead of an = query.
$query = "SELECT * FROM Table_Article WHERE Article_ID LIKE '$Article_ID_Value'";

Then the wildcard you want for all records is % not *
 
Old February 25th, 2005, 06:14 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks- Works perfectly!

I tried
$query = "SELECT * FROM Table_Article WHERE Article_ID='$Article_ID_Value'";
using % but that didn't work but your LIKE just did it :D





Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box to Show Multi Column Info After Select Coby Excel VBA 0 August 14th, 2007 05:23 PM
Select a Column of DataGrid thomaz C# 0 June 29th, 2005 01:59 PM
Select distinct data from one column madkaikar_ashish SQL Server 2000 1 December 17th, 2004 10:25 AM
How to actually select ONE column Piblon Excel VBA 4 June 29th, 2004 08:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.