Jump to content

ldb358

Members
  • Posts

    199
  • Joined

  • Last visited

    Never

Posts posted by ldb358

  1. i have a database that im using for my site first i have my table "users" that stores all of my data for the user on my site username password ect. then each user has a table that is used to store the information about all of there uploaded files but now i need a way to save messages to a database how can i do this

     

    should i use a type collum in the user's table so i can put type=message type=photo in the same table or will this slow it down to much

  2. looks pretty good, although i dont know if you did it intetionally but the black box when you click on a page only goes down to about the bottom of you logo at least in ie, but other than that it looks really good

     

  3. This is a site that i have been working on that is still in the very early stages but i think that it is important that some people can check it out and let me know of any glitchs, error, ect. that may be on the site. thanks foe the help for a login you can use:

     

    lane2

    enter1

     

    lbflash.summerhost.info/test

  4. i made a script to upload images to a site and for the most part every image worked but ones where the name contained (, ) , or _ whats up with this i tried to fix it with this:

    $nameFill3 = str_replace("_","",$upload['name']);
    $nameFill2 = str_replace("(","",$upload['name']);
    $nameFill = str_replace(")","",$upload['name']);
    

  5. i want it to list the first 10 results

    thanks in advanced

     

    heres my code:

    function runBrowse($search){
    $qSearch = mysql_query("SELECT * FROM users WHERE username LIKE '%$search%'");
    $results = mysql_fetch_array($qSearch);
    if($results['username'] != ""){
    echo $results['username'];
    }else{
    echo "no results";
    }
    }
    
    
    

  6. The problem is that i need to return a varable to create a button for every image in a loop but right now it only loads the first button heres my code:

     

    
    function userPage(){
    
            $username = $_SESSION['username'];
    
            $qFirst = mysql_query("SELECT firstName FROM users WHERE username='$username'");
    
            $qLast = mysql_query("SELECT lastName FROM users WHERE username='$username'");
    
            $qEmail = mysql_query("SELECT email FROM users WHERE username='$username'");
    
            $firstb = mysql_fetch_array($qFirst);
    	$first = $firstb['firstName'];
    
            $lastb = mysql_fetch_array($qLast);
    	$last = $lastb['lastName'];
    
            $emailb = mysql_fetch_array($qEmail);
    	$email = $emailb['email'];
    
            $qgetImagesrc = mysql_query("SELECT * FROM ".$username." WHERE id='1'") or die(mysql_error());
    
            $qImagesrc = mysql_fetch_array($qgetImagesrc);
            //working on designing the page here
    
    echo "<div class='body3'><div style='width:800px; height:20px;'></div><div class='pictureFill'><img src='". $username . "/" . $qImagesrc['name'] ."' style='width:100; height:150;'/></div><div class='userInfo'><blockquote><h3>$username</h3><p>$first $last<br/>$email<h4>$rating</h4></p></blockquote></div><br/><div class='pictureSelect' id='picSelect'>".loadImages($username)."</div><div class='pictureGallery'><img  name='mainImage' /></div></div>";
    
    //add an if(isset(img1) else load upload first page
    
    }
    
    function loadImages($username){
    $numberOfImages = mysql_query("SELECT imgNumber FROM users WHERE username='$username'");
    $numImages2 = mysql_fetch_array($numberOfImages);
    $numImages = (int)$numImages2['imgNumber'];
    for( $i=1; $i<=$numImages; $i++){
    	$getName = mysql_query("SELECT name FROM ".$username." WHERE id='$i'");
    	$loadName = mysql_fetch_array($getName);
    	$name = $loadName['name'];
    	$output = "<input type='button' value='$name' onClick=\"mainImage.src='" . $username . "/" . $name . "' \"/><br/>";
    	return $output;
    }
    }
    
    

     

    would it be something like this

     

    function userPage(){
    
            $username = $_SESSION['username'];
    
            $qFirst = mysql_query("SELECT firstName FROM users WHERE username='$username'");
    
            $qLast = mysql_query("SELECT lastName FROM users WHERE username='$username'");
    
            $qEmail = mysql_query("SELECT email FROM users WHERE username='$username'");
    
            $firstb = mysql_fetch_array($qFirst);
    	$first = $firstb['firstName'];
    
            $lastb = mysql_fetch_array($qLast);
    	$last = $lastb['lastName'];
    
            $emailb = mysql_fetch_array($qEmail);
    	$email = $emailb['email'];
    
            $qgetImagesrc = mysql_query("SELECT * FROM ".$username." WHERE id='1'") or die(mysql_error());
    
            $qImagesrc = mysql_fetch_array($qgetImagesrc);
            //working on designing the page here
    
    echo "<div class='body3'><div style='width:800px; height:20px;'></div><div class='pictureFill'><img src='". $username . "/" . $qImagesrc['name'] ."' style='width:100; height:150;'/></div><div class='userInfo'><blockquote><h3>$username</h3><p>$first $last<br/>$email<h4>$rating</h4></p></blockquote></div><br/><div class='pictureSelect' id='picSelect'>".loadImages($username)."</div><div class='pictureGallery'><img  name='mainImage' /></div></div>";
    
    //add an if(isset(img1) else load upload first page
    
    }
    
    function loadImages($username){
    $numberOfImages = mysql_query("SELECT imgNumber FROM users WHERE username='$username'");
    $numImages2 = mysql_fetch_array($numberOfImages);
    $numImages = (int)$numImages2['imgNumber'];
    for( $i=1; $i<=$numImages; $i++){
    	$getName = mysql_query("SELECT name FROM ".$username." WHERE id='$i'");
    	$loadName = mysql_fetch_array($getName);
    	$name = $loadName['name'];
    	$output$i = "<input type='button' value='$name' onClick=\"mainImage.src='" . $username . "/" . $name . "' \"/><br/>";
    	return $output$i;
    }
    }
    
    

  7. what this is should do is echo the put the output in the picSelect div but instead they apear on top see what i mean on my site:

     

        username:Lane

        password:enter1

     

     

    heres my code:

     

    
    function userPage(){
    
            $username = $_SESSION['username'];
    
            $qFirst = mysql_query("SELECT firstName FROM users WHERE username='$username'");
    
            $qLast = mysql_query("SELECT lastName FROM users WHERE username='$username'");
    
            $qEmail = mysql_query("SELECT email FROM users WHERE username='$username'");
    
            $firstb = mysql_fetch_array($qFirst);
    	$first = $firstb['firstName'];
    
            $lastb = mysql_fetch_array($qLast);
    	$last = $lastb['lastName'];
    
            $emailb = mysql_fetch_array($qEmail);
    	$email = $emailb['email'];
    
            $qgetImagesrc = mysql_query("SELECT * FROM ".$username." WHERE id='1'") or die(mysql_error());
    
            $qImagesrc = mysql_fetch_array($qgetImagesrc);
            //working on designing the page here
    
    echo "<div class='body3'><div style='width:800px; height:20px;'></div><div class='pictureFill'><img src='". $username . "/" . $qImagesrc['name'] ."' style='width:100; height:150;'/></div><div class='userInfo'><blockquote><h3>$username</h3><p>$first $last<br/>$email<h4>$rating</h4></p></blockquote></div><br/><div class='pictureSelect' id='picSelect'>".loadImages($username);."</div><div class='pictureGallery'><img  name='mainImage' /></div></div>";
    
    //add an if(isset(img1) else load upload first page
    
    }
    
    function loadImages($username){
    $numberOfImages = mysql_query("SELECT imgNumber FROM users WHERE username='$username'");
    $numImages2 = mysql_fetch_array($numberOfImages);
    $numImages = (int)$numImages2['imgNumber'];
    for( $i=1; $i<=$numImages; $i++){
    	echo $i;
    	$getName = mysql_query("SELECT name FROM ".$username." WHERE id='$i'");
    	$loadName = mysql_fetch_array($getName);
    	$name = $loadName['name'];
    	echo "<input type='button' value='$name' onClick=\"mainImage.src='" . $username . "/" . $name . "' \"/><br/>";
    }
    }
    
    

  8. that is actually a variable from a different part of the script it is fixed now but still wont work

     

    function upload($maxsize, $upload){
    
    if((($upload['type'] == "image/jpeg") || ($upload['type'] == "image/pjpeg") || ($upload['type'] == "image/gif") || ($upload['type'] == "image/png")) && ($upload['size'] < "104857600")){
    
    	if($upload['error'] == 0){
    
    			$newSrc = $username . "/" . $upload['name'];		
    
    			if(!file_exists($newSrc)){
    
    			$nameFill = $upload['name'];
    
    			$artistFill = $_SESSION['username'];
    
    			$sizeFill = (int)$upload['size'];
    
    			$check = mysql_query ("SELECT * FROM ".$artistFill." LIMIT 0,1"); 
    
    			if($check){
    			echo $upload['tmp_name'];
    			$thisdir = getcwd(); 
    			mkdir($thisdir ."/" . $artistFill);
    			move_uploaded_file($upload['tmp_name'], $artistFill . "/" . $upload['name']);
    			mysql_query("INSERT INTO ".$artistFill." ( name, fType, fSize, artist) VALUES( '$nameFill', 'photo', '$sizeFill', '$artistFill');") or die(mysql_error());
    			//move_uploaded_file($upload['tmp_name'],"/users" . $upload['name']);
    			mysql_query("INSERT INTO ".$artistFill." ( name, fType, fSize, artist) VALUES( '$nameFill', 'photo', '$sizeFill', '$artistFill');") or die(mysql_error());
    			echo "file uploaded";
    			}else{
    
    			//if table doesnt exsist
    			$thisdir = getcwd(); 
    			mkdir($thisdir ."/" . $artistFill, 777);
    			move_uploaded_file($upload['tmp_name'],"/" . $artistFill. "/" . $upload['name']) or die("cant copy file");
    			mysql_query("CREATE TABLE ".$artistFill."(id INT(10) NOT NULL AUTO_INCREMENT, name VARCHAR( 30 ) NOT NULL ,fType VARCHAR( 30 ) NOT NULL ,fSize INT NOT NULL ,artist VARCHAR( 30 ) NOT NULL ,fDesc TEXT NOT NULL ,rating INT(10) NOT NULL ,PRIMARY KEY (id))") or die(mysql_error()); 
    
    			mysql_query("INSERT INTO ".$artistFill." (name, sType, fSize, artist) VALUES ('$nameFill', 'photo', 'sizeFill', '$artistFill');") or die(mysql_error());
    
    			echo "added";
    
    			}
    
    			}
    
    		}
    
    	}
    
    }
    

  9. heres the error i got

     

    Warning: move_uploaded_file(/Copy of Cross3Trans.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/vol4/summerhost.info/sum_2677639/htdocs/test/functions.php on line 339

     

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpOwiLML' to '/Copy of Cross3Trans.jpg' in /home/vol4/summerhost.info/sum_2677639/htdocs/test/functions.php on line 339

  10. this probably a simple issue but what the code is supposed to do is a) check if the user has a table if he doesn't it creates one then b) it creates a new directory for the file c) moves the temporary file there then finally inserts all the information about the file in the database but the problem is all of it works but the file doesn't exists afterwards

     

    function upload($maxsize, $upload){
    
    if((($upload['type'] == "image/jpeg") || ($upload['type'] == "image/pjpeg") || ($upload['type'] == "image/gif") || ($upload['type'] == "image/png")) && ($upload['size'] < "104857600")){
    
    	if($upload['error'] == 0){
    
    			$newSrc = $username . "/" . $upload['name'];		
    
    			if(!file_exists($newSrc)){
    
    			$nameFill = $upload['name'];
    
    			$artistFill = $_SESSION['username'];
    
    			$sizeFill = (int)$upload['size'];
    
    			$check = mysql_query ("SELECT * FROM ".$artistFill." LIMIT 0,1"); 
    
    			if($check){
    			echo $upload['tmp_name'];
    			$thisdir = getcwd(); 
    			mkdir($thisdir ."/" . $artistFill);
    			move_uploaded_file($upload['tmp_name'], $username . "/" . $upload['name']);
    			mysql_query("INSERT INTO ".$artistFill." ( name, fType, fSize, artist) VALUES( '$nameFill', 'photo', '$sizeFill', '$artistFill');") or die(mysql_error());
    			//move_uploaded_file($upload['tmp_name'],"/users" . $upload['name']);
    			mysql_query("INSERT INTO ".$artistFill." ( name, fType, fSize, artist) VALUES( '$nameFill', 'photo', '$sizeFill', '$artistFill');") or die(mysql_error());
    			echo "file uploaded";
    			}else{
    
    			//if table doesnt exsist
    			$thisdir = getcwd(); 
    			mkdir($thisdir ."/" . $artistFill, 777);
    			move_uploaded_file($upload['tmp_name'],"/" . $artistFill. "/" . $upload['name']) or die("cant copy file");
    			mysql_query("CREATE TABLE ".$artistFill."(id INT(10) NOT NULL AUTO_INCREMENT, name VARCHAR( 30 ) NOT NULL ,fType VARCHAR( 30 ) NOT NULL ,fSize INT NOT NULL ,artist VARCHAR( 30 ) NOT NULL ,fDesc TEXT NOT NULL ,rating INT(10) NOT NULL ,PRIMARY KEY (id))") or die(mysql_error()); 
    
    			mysql_query("INSERT INTO ".$artistFill." (name, sType, fSize, artist) VALUES ('$nameFill', 'photo', 'sizeFill', '$artistFill');") or die(mysql_error());
    
    			echo "added";
    
    			}
    
    			}
    
    		}
    
    	}
    
    }
    

  11. added this

    if($check){
    			mysql_query("INSERT INTO ".$artistFill." (id, name, fType, fSize, artist) VALUES(NULL, ".$nameFill.", ".photo.", ".$sizeFill.", ".$artistFill.");") or die(mysql_error());
    			}else{
    			//if table doesnt exsist
    			mysql_query("CREATE TABLE ".$artistFill."(id INT NOT NULL, name VARCHAR( 30 ) NOT NULL ,fType VARCHAR( 30 ) NOT NULL ,fSize INT NOT NULL ,artist VARCHAR( 30 ) NOT NULL ,fDesc TEXT NOT NULL ,rating INT NOT NULL ,PRIMARY KEY (id))") or die(mysql_error()); 
    			mysql_query("INSERT INTO ".$artistFill." (id, name, sType, fSize, artist) VALUES (NULL, ".$nameFill.", photo, ".$sizeFill.", ".$artist.");") or die(mysql_error());
    			echo "added";
    			}
    

     

     

    now its saying there is an error with the files im trying to up load "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 'of image.jpg, photo, 56372, lane)' at line 1"

  12. this is part of my php script that is responcable for uploading the users files up to my server and stores the information about the file

     

    //assume that all the variables are set

    <?
    $check = mysql_query ("SELECT * FROM '$artistFill' LIMIT 0,1"); 
    if($check){
         mysql_query("INSERT INTO '$artistFill' (id, name, sType, fSize, artist) VALUES('NULL', '$nameFill', 'photo', '$sizeFill', '$artistFill');") or die(mysql_error());
    }else{
    //if table doesnt exsist
    mysql_query("CREATE TABLE '$artistFill' (id INT NOT NULL, name VARCHAR( 30 ) NOT NULL ,fType VARCHAR( 30 ) NOT NULL ,fSize INT NOT NULL ,artist VARCHAR( 30 ) NOT NULL ,fDesc TEXT NOT NULL ,rating INT NOT NULL ,PRIMARY KEY (id))") or die("1"); 
    mysql_query("INSERT INTO '$artistFill' (id, name, sType, fSize, artist) VALUES('NULL', '$nameFill', 'photo', '$sizeFill', '$artist');") or die("2");
    echo "added";				
    
    ?>
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.