# PHP Madness!

**URL:** <https://forum.kirupa.com/t/php-madness/163769>\
**Category:** programming\
**Created:** [September 26, 2005, 5:13am UTC](https://forum.kirupa.com/t/php-madness/163769 "2005-09-26T05:13:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pbrollwitme](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pbrollwitme](https://forum.kirupa.com/u/pbrollwitme)\
**Post date:** [September 26, 2005, 5:13am UTC](https://forum.kirupa.com/t/php-madness/163769/1 "2005-09-26T05:13:57Z")

</div>

Can someone tell me what is wrong with this? Its gotta be something small, but its driving me crazy! Thanks in advance!

```php
<?php
$db = mysql_connect("localhost", "user","password");
mysql_select_db("theoldd_members",$db);
$checkuser = mysql_query("SELECT username FROM users WHERE 
username='$username'"); 
$username_exist = mysql_num_rows( $checkuser );
if($username_exist > 0){
   echo "I'm sorry but the username you specified has already 
been taken. Please pick another one.";
   unset($username);
	exit();
}else{
$target_path = "uploads/memberspics/";
$_FILES['uploadedfile']['tmp_name'];
$file = $_FILES['uploadedfile']['name'];
$file = eregi_replace('[^a-z0-9A-Z./],'',$file);
$namedfile = $target_path . $file;
$target = $FILES['uploadedfile']['tmp_name'];
if(move_uploaded_file($target , $namedfile)){
	 echo "pic uploaded successfully!";
}else{
print "upload failed";
}
}
?> 

```
