See below...
Ron Piggott wrote:
Take a look at my if ( ) syntax line below. I am wondering if I have it
wrong in same way. What I am trying to achieve is if the alias the user
enters is already found in the database I want the words "Alias already in
use" to be shown on the screen; otherwise
you need to check the num of rows returned, since the query always(if it
works) returns true
$result = mysql_query($query);
if (($result)&&(mysql_num_rows($result)==1))
{
echo "Alias already in use";
} else {
echo "Unique alias";
mysql_close();
}
Bastien
From: "Ron Piggott" <[EMAIL
think this is wrong ... as it gives unique alias even if the query is not
executed ..
rajesh
On Sun, 2 Oct 2005, Bastien Koert wrote:
you need to check the num of rows returned, since the query always(if it
works) returns true
$result = mysql_query($query);
if (($result)&&(mysql_num_rows(
Please PMJI, but I'm new to PHP but have a little experience with databases,
and I have a question:
Is there a particular reason that LIKE is used in the query? Let's say you had
the contrived alias value in the table, 'a', and one wanted to add the
alias, '' (or fewer 'a's). Wouldn'
Actually, if I had spent more time thinking about it, I could have come up with
an example less contrived than the alias, ''. Let's say the first entry in
the table is the alias, 'williamson.' Based on the current query, there can be
no:
'williams'
'william'
'willi'
'will'
My p
true, i suppose,
A better example would be
$result = mysql_query($query);
if ($result){
if (mysql_num_rows($result)>0)
{
echo "Alias already in use";
} else {
echo "Unique alias";
}
}else{
echo " db error:".mysql_error();
}
mysql_close();
bastien
From: RaJeSh VeNkAtA <[EMAIL