Jump to content


Photo

NOt pulling the info form the databass


  • Please log in to reply
2 replies to this topic

#1 bob2006

bob2006
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationFlorida

Posted 08 September 2006 - 05:08 PM

$check=mysql_query("SELECT * FROM `admin` WHERE userid = '$id'")or die(mysql_error()); $Numb=mysql_num_rows($check);

if($CNumb == '1')  {
echo("<a href='http://www.freehosting.citrushostingplus.com/admin/?sid=$sid'>Go back</a> username is taken!");
}

--Sam Mesic--

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 08 September 2006 - 05:19 PM

Try this...

$query = "SELECT * FROM admin WHERE userid = '$id'";
$result = mysql_query($query);
if (!$result){
   die('Could run query: ' .mysql_error());
}
   
if(mysql_fetch_row($result)){ // We're only expecting one row, so mysql_fetch_row should be fine
   echo '<a href="form.php">Go back</a> username is taken!
}

Regards
Rich
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 bob2006

bob2006
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationFlorida

Posted 08 September 2006 - 05:56 PM

thanks it help
--Sam Mesic--




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users