Re: [PHP] newbie php/mysql need help

2005-03-13 Thread Burhan Khalid
p80 wrote: I do a mysql request like this one: SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where category like 'sold' group by brand" Try adding aliases to your query, such as : SELECT DISTINCT (brand), COUNT (brand) AS brand_count FROM `machines` WHERE `category` LIKE 'sold' GROUP BY

RE: [PHP] newbie php/mysql need help

2005-03-13 Thread Robbert van Andel
Simple but should work. $query = " SELECT DISTINCT (brand), COUNT( brand )FROM `machines` where category like 'sold' group by brand;"; $result = mysql_query($query) or die(mysql_error()); While($data = mysql_fetch_array($result)) { echo "{$data[0]} - {$data[1]}\n"; } -Original Messa

Re: [PHP] Newbie: PHP/MySQL (SELECT)

2002-11-22 Thread Marek Kilimajer
if one of $titulotxt or $cdstxt is not set, your query will look something like this: SELECT * FROM divx WHERE && cds like '$cdstxt' ORDER BY titulo As you see, there is unnecessery &&. I build my search queries using this form: $query_cond=''; foreach($_GET as $col => $val) { switch($col)

Re: [PHP] Newbie: php/mysql (Select)

2002-11-20 Thread Ernest E Vogelsinger
At 20:23 20.11.2002, Mr. BuNgL3 said: [snip] >Hi... >I'm with a little sintax problem... >The question is that i have two search fields (titulotxt and cdstxt) and i >want to create an mysql condition... i trying: > > $sql1=($titulotxt) ? "titulo like '%".$tit

RE: [PHP] Newbie: PHP/MySQL (SELECT)

2002-11-20 Thread Van Andel, Robert
$sql1 = "titulo like '%$titulotxt%'" $sql2 = "cd like '$cdstxt'"; $sql = "SELECT * FROM divx WHERE $sql1 AND $sql2 ORDER BY titulo"; I think you are getting the error because of the ($titulotxt) ? portion of your sql statements. You really only need the two statements listed above and then put in

Re: [PHP] Newbie: PHP/MySQL (SELECT)

2002-11-20 Thread DL Neil
> On Thursday 21 November 2002 03:53, Mr. BuNgL3 wrote: > > Hi... > > I'm with a little sintax problem... > > The question is that i have two search fields (titulotxt and cdstxt) and i > > want to create an mysql condition... i trying: > > > > $sql1=($titulotxt) ? "titulo like '%".$titulotxt."%'":

Re: [PHP] Newbie: PHP/MySQL (SELECT)

2002-11-20 Thread Jason Wong
On Thursday 21 November 2002 03:53, Mr. BuNgL3 wrote: > Hi... > I'm with a little sintax problem... > The question is that i have two search fields (titulotxt and cdstxt) and i > want to create an mysql condition... i trying: > > $sql1=($titulotxt) ? "titulo like '%".$titulotxt."%'":""; > $sql2=(

Re: [PHP] newbie: php/mysql

2002-10-28 Thread Marek Kilimajer
The usual way of doing logins with encrypted/hashed passwords is adding new user into the table: INSERT users SET username='$_POST[username]', password=MD5('$_POST[pwd]'); checking if username/password match: SELECT * FROM users WHERE username='$_POST[username]' AND password=MD5('$_POST[pwd]');

Re: [PHP] Newbie - PHP & MySQL

2002-01-11 Thread Henning Sprang
Ben Clumeck wrote: > When using MySQL to Authenticate users for a specific directory (i.e. > www.mysite.com/user) how would it know to go to that directory ("/user"). > How would it know to not let someone access a file directory in that > directory (i.e. www.mysite.com/user/page2.php)? this