User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 427,812 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,845 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums

mySQL database searching for registration

Join Date: Apr 2004
Location: Tracy
Posts: 744
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Rep Power: 7
Solved Threads: 32
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: mySQL database searching for registration

  #5  
Jun 16th, 2004
heres the error i get

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM reg_info WHERE usr_name = 'michael'' at line 1

and heres the code that gives it.



[php]mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); //connecting to the database using the variable set
@mysql_select_db("$DBName") or die("Unable to select database $DBName"); //at connection to the databse select DBNAME (phpforms) or tell that it couldnt connect
$sqlquery = "SELECT COUNT(usr_name) as FROM $Table WHERE usr_name = '$usr_name'";
if (!$sqlquery)
{
echo(mysql_error());
}
else
{
$results = mysql_query($sqlquery);
if (!$results)
{
echo(mysql_error());
}
else
{
$user_count = mysql_fetch_assoc($results);
if (!$user_count)
{
echo(mysql_error());
}
else
{
echo "current user name " . $_POST['usr_name'] . "<br />";
echo "query returned " . $sqlquery . "<br />";
echo "query returned " . $results . "<br />";
echo "array returned " . $user_count . "<br />";
}
}
}
[/php]

i think my main problem is that im new to php and mysql, and i dont quite no all of the syntax.


sort ($user_count)
foreach ($user_count as $array)

if ($array >= 1)

stop

else

continue.
Last edited by samaru : Jun 16th, 2004 at 9:42 pm.
!!!!! WARNING YOUR COMPUTER MAY BE INFECTED WITH SPYWARE!!!! PAY AN OVER PRICED AMMOUNT TO HAVE SOMTHING FIXED WE PLACED THERE IN THE FIRST PLACE!!!!!!!!!

sound familiar, know how to block yourself and keep yourself clean.
_____________________
http://www.lavasoftusa.com/ -->adaware
http://www.safer-networking.org/en/index.html -->spybot S&D
http://www.javacoolsoftware.com/spywareblaster.html -->spywareblaster
http://www.javacoolsoftware.com/spywareguard.html -->spywareguard
_____________________
and dont forget to spread the reputation to those that deserve!
Reply With Quote  
All times are GMT -4. The time now is 2:30 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC