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
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
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)
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
$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
> 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."%'":
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=(
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]');
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
9 matches
Mail list logo