Jump to content

Adrienk

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Adrienk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This, from my understanding - correct me if I am wrong. sais: delete all files except the directory I'm deleting files in. Which is fine. how ever I need to delete a;ll files in said directory EXCEPT for specified files. So essentially: AISISCORE would be empty - EXCEPT for the files I don't want deleted. maybe I missed something in your example? thanks for the help
  2. So I assume no? I have noticed this form moves fast - hence the bump. sorry for rule breaking. kinda need an answer - dont hate me.
  3. So I am having issues. like mental issues over this.... I found a piece of code on the php manual site in relation to recursively deleting directories and modified it to this: function delete_contents_in_folder($path_to_dir){ if(is_file($path_to_dir)){ return @unlink($path_to_dir); } elseif(is_dir($path_to_dir)){ $scan = glob(rtrim($path_to_dir,'/').'/*'); foreach($scan as $index=>$path){ $this->delete_contents_in_folder($path); } if($path_to_dir == AISISCORE){ return; }else{ return @rmdir($path_to_dir); } } } essentially AISISCORE is the directory i want it to IGNORE. so essentially it deletes every file, sub directory and so on in AISISCORE but does not delete the root directory, in the end AISISCORE is left as an empty folder. What's the issue? I want to tell it to delete everything in AISISCORE as it already does BUT ignore specific files when doing so, that's the part I can't figure out how to do. Your help is appreciated.
  4. There is no edit button? Any ways I just realized the link was broken for the pastebin.... So http://pastebin.ca/2139415 Any ways, OP still counts. you'd just have to uncomment out the echo. How ever I have come across an interesting problem...you see here how I am returning this all to an array? (essentially this function returns an array of all the images in said directory) Well if I use that method and walk through the returned array on the front end I get i instead of image1.jpg How ever if I just do an echo on this method I get back image1.jpg instead of image1.jpgimage2.jpg which is insanly odd....Im thinking its my loop. because if I echo out images as you see in the class then I get image1.jpgimage1.jpgimage2.jpg and if I return this function and walk through it I get i also why is there no edit button - or am I blind >.> (edit button for the OP)
  5. So I have a folder with two images. What happens with the code on pastebin is that it goes through checks the directory, checks for files in the folder with the extension.jpg and then prints them out into a image tag. I understand the for loop is probably a no no in php and we should use for each, but I like this way better >_>. Aside from that, this whole this works, it goes through gets the images. Problem? It prints the first image twice and the second once. So: $this->get_images_in_dir[0] results in 2 images (the image printed twice) where as $this->get_images_in_dir[1] results in one. why? It should only print it once. like: $this->get_images_in_dir[0] results in image1.jpg $this->get_images_in_dir[1] results in image2.jpg instead of image1.jpg, image1.jpg, img2.jpg Ideas?
  6. So I wrote this piece of code that for the most part works. The problem is two things. One if I print out say $dir[$i] I get 7 directories back. if I try and store that in an array to later be access by some other function I get up to 24+ C's instead of C:/Path... public function aisis_get_dir_array($dir){ if(!is_array($dir)){ aisis_get_dir($dir); return; } $count = count($dir); for($i = 0; $i<$count; $i++){ if(!is_dir($dir[$i])){ _e('Specified dir' . $dir[$i] . 'is not a directory.'); } $this->directory_list = $dir[$i]; //store these $handler = opendir($dir[$i]); while($file = readdir($handler)){ if($file != "." && $file != ".."){ $this->files[] = $file; } } } return $this->files; } right under the line: $this->directory_list = $dir[$i]; //store these if You put in echo $dir[$i] you get back directories. How ever down in this function: public function load_if_extentsion_is_php($dir, $array = false){ $list = array(); $list_dir = array(); if($array == true){ $list = $this->aisis_get_dir_array($dir); $list_dir = $this->directory_list; } else{ $list = $this->aisis_get_dir($dir); } $count = count($list); for($i = 0; $i<$count; $i++){ if($array == true){ $countdir = count($this->directory_list); for($j = 0; $j<$countdir; $j++){ echo $list_dir[$j]; //echo $list_dir[$j]; //echo $list[$i]; } } //if(substr(strrchr($list[$i],'.'),1)=="php"){ //echo $list[$i]; //require_once($dir . $list[$i]); //} } } echoing out: echo $list_dir[$j]; gets you up to 24+ C's instead of the directories that are stored. You can view the whole class at Paste bin - there is an expiry: 12 hours. Essentially you call load_if_extentsion_is_php($dir, $array = false) pass it an array of directories and set the array part to true. To Summarize: If you pass in an array of directories you should get back: a echoed list of directories a echoed list of php files belonging in those directories. Currently you get the later and a series of C's for the first. Why?
  7. Ill deal with the code cleaning later. The second page is giving me the MYSQL error that you see and he first page posted is not giving me a forum populated with movie information based on the selection you make from the drop down list
  8. I have two scripts. One uses a drop down list to populate a forum while the other makes you enter in a value and populates the forum below with all the data in that table where the input matches the requested number. So lets get down to it shall we? 1st up we have a movies list. <?php include('CheckLogin.php'); include ('databaseconfig.php'); $query = mysql_query("select title from movies"); if (isset($_POST['submitSearch'])) { $query2 = mysql_query("select * from movies where title = ". $_POST['list']); } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Home </title> <script type="text/javascript" src="javaScript/jquery-min.js"></script> <script type="text/javascript" src="javaScript/corners.js"></script> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header> <div id="header"> <h1 id="logo">RAY AND CARLS </h1> <p class="description"><?php echo check();?><br/> </p> </div> </header> <nav> <ul id="nav"> <li> <a href="index.php">Home </a> </li> <li> <a href="#">Customer Registration </a> </li> <li> <a href="#">View Movies </a> </li> <li> <a href="#">View Games </a> </li> <li> <a href="#">Rent </a> </li> <li> <a href="#">Login </a> </li> <li> <a href="#">Admin </a> </li> </ul> </nav> <article> <section> <div class="cornerBox cBox3"> <div class="cornerBox-content"> <div class="List"> <form class="cmxform" id="commentForm" action="action" method="post"> <p> <select name="list"> <?php while ($row = mysql_fetch_array($query)) { echo "<option>$row[title]</option>\n"; } ?> </select> </p> <p><input name="submitSearch" type="button" value="submit"></p> </form> <p> </p> <form class="cmxform" id="commentForm" action="action" method="post"> <h2>The Movie Selected </h2> <p> <?php while ($row2 = mysql_fetch_array($query2)){?> <label for="cname">Movie ID: </label> <em>* </em> <input id="cname" name="movieid" size="4" class="required" minlength="2" value="<?php echo $row2[0];?>"> </p> <p> <label for="cemail">Rented <em> 0 for n, 1 for y</em> </label> <em>* </em> <input id="cemail" name="rented" size="2" class="required email" value="<?php echo $row2[1];?>"> </p> <p> <label for="curl">Title </label> <em>* </em> <input id="curl" name="title" size="30" class="url" value="<?php echo $row2[2];?>"> </p> <p> <label for="curl">Category </label> <em>* </em> <input id="curl" name="category" size="15" class="url" value="<?php echo $row2[3];?>"> </p> <p> <label for="curl">Director </label> <em>* </em> <input id="curl" name="director" size="15" class="url" value="<?php echo $row2[4];?>"> </p> <p> <label for="curl">Leading Actors </label> <em>* </em> <input id="curl" name="leadingactors" size="50" class="url" value="<?php echo $row2[5];?>"> </p> <p> <label for="curl">Supporting Actors </label> <em>* </em> <input id="curl" name="supportingactors" size="50" class="url" value="<?php echo $row2[6];?>"> </p> <p> <label for="curl">Run Time <em>in minutes</em> </label> <em>* </em> <input id="curl" name="runtime" size="4" class="url" value=""><?php echo $row2[7];?></input> </p> <p> <label for="curl">Rating </label> <em>* </em> <input id="curl" name="rating" size="6" class="url" value="<?php echo $row2[8];?>"> </p> <p> <label for="curl">Release Date </label> <em>* </em> <input id="curl" name="releasedate" size="10" class="url" value="<?php echo $row2[9];?>"> <?php } ?> </form> </div> </div> </div> </section> </article> <footer> <div id="footer"> <div class="footer1"> <h2> About </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <div class="footer2"> <h2>Other places </h2> <p> <ul> <li> <a href="#">Link 1 </a> </li> <li> <a href="#">Link 2 </a> </li> <li> <a href="#">Link 3 </a> </li> <li> <a href="#">Link 4 </a> </li> </ul> </p> </div> <div class="footer3"> <h2> Other information </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <p class="credits">© <a href="http://bwshome.byethost5.com/blogs">Adam Balan - BLACKANDWHITE </a> <span>• </span> Powered by <a href="http://bwshome.byethost5.com/blogs">BLACKANDWHITE </a> <span>• </span> </div> </footer> </div> </body> </html>] This script populates a list with movie names with the select statement of select * from movies; What I want to do is select a movie from this list and have the page refresh with a forum full of the details based on the movie title, hence the select * from movies where title = title statement. What it currently does is populates a drop down list with titles of movies in the data base but not the forum.... 2nd up we have the customer details The second script is similar but now we want to populate a forum based on user input of a customer id. So lets say we have an ID of 10, we enter 10 hit enter and the forum bellow should populate with all the customer info based on that id allowing me to edit and update (I haven't got to the update part yet, still trying to populate a forum) <?php session_start(); include('CheckLogin.php'); include('databaseconfig.php'); if (isset($_POST['searchSubmit'])) { $query = mysql_query("select * from customer where customer_id =".$_POST['cust_id']); } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Home </title> <script type="text/javascript" src="javaScript/jquery-min.js"></script> <script type="text/javascript" src="javaScript/corners.js"></script> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> </script> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header> <div id="header"> <h1 id="logo">RAY AND CARLS </h1> <p class="description"> <?php echo checkAdmin();?> <br/> </p> </div> </header> <nav> <ul id="nav"> <li> <a href="index.php">Home </a> </li> <li> <a href="#">Customer Registration </a> </li> <li> <a href="#">View Movies </a> </li> <li> <a href="#">View Games </a> </li> <li> <a href="#">Rent </a> </li> <li> <a href="#">Login </a> </li> <li> <a href="#">Admin </a> </li> </ul> </nav> <article> <section> <div class="cornerBox cBox3"> <div class="cornerBox-content"> <p>All updates to the Data base can be done here. Keeping in mind specific relationships with The back end data bases. </p> <p>Some common tasks are below. This page allows you to add, edit and delete customers/movies and games. </p> <div class="cornerBox2 cBox3"> <div class="cornerBox-content"> <h1>Menu </h1> <ul> <h2>Customers </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> <h2>Movies </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> <h2>Games </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> </ul> </div> </div> <div class="Forum"> <h2>Search</h2> <form class="cmxform" id="commentForm" method="post" action=""> <p> <label for="cname">Customer ID: </label> <em>* id's must be > 0 </em> <input id="cname" name="cust_id" size="25" class="required" minlength="2" /> </p> <p> <input class="submit" type="submit" value="Submit" name="searchSubmit"/> </p> </form> <h2>Edit Customer </h2> <?php $resualt = mysql_query($query); while($row = mysql_fetch_array($resualt)) { ?> <form class="cmxform" id="commentForm" method="post" action=""> <p> <label for="cname">Customer ID: </label> <em>* </em> <input id="cname" name="cust_id" size="25" class="required" minlength="2" value="<?php $row[0]?>"/> </p> <p> <label for="cemail">First Name </label> <em>* </em> <input id="cemail" name="fname" size="25" class="required email" value="<?php $row[1]?>"/> </p> <p> <label for="curl">Last Name </label> <em>* </em> <input id="curl" name="lastname" size="25" class="url" value="<?php $row[2]?>"/> </p> <p> <label for="curl">Address </label> <em>* </em> <input id="curl" name="address" size="25" class="url" value="<?php $row[3]?>"/> </p> <p> <label for="curl">Postal Code </label> <em>* </em> <input id="curl" name="postalcode" size="7" class="url" value="<?php $row[4]?>"/> </p> <p> <label for="curl">Phone Number </label> <em>* </em> <input id="curl" name="phonenumber" size="11" class="url" value="<?php $row[5]?>""/> </p> <p> <input class="submit" type="submit" value="Submit" name="submit"/> </p> </form> <?php } ?> <?php if (!mysql_query($query)) { echo("<h1>Possible Errors </h1>"); //Echo errors echo mysql_error(); echo ("<p>"); } else { echo("<h2>Customer was added</h1>"); } ?> </div> </div> </div> </section> </article> <footer> <div id="footer"> <div class="footer1"> <h2> About </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <div class="footer2"> <h2>Other places </h2> <p> <ul> <li> <a href="#">Link 1 </a> </li> <li> <a href="#">Link 2 </a> </li> <li> <a href="#">Link 3 </a> </li> <li> <a href="#">Link 4 </a> </li> </ul> </p> </div> <div class="footer3"> <h2> Other information </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <p class="credits">© <a href="http://bwshome.byethost5.com/blogs">Adam Balan - BLACKANDWHITE </a> <span>• </span> Powered by <a href="http://bwshome.byethost5.com/blogs">BLACKANDWHITE </a> <span>• </span> </div> </footer> </div> </body> </html> Now when I enter 10 into the search I get an error of: "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 'Resource id #5' at line 1" I was told to make another thread for my question(s) and since these are in relation to each other (populating a forum and all) I thought it best to combine two into one.
  9. It all works now, thank you all for your help. I have other questions on other scripts Should I post those here or make a new thread?
  10. Ok so i made the modification to the code. But How will this display "sucess" or the error BELOW the forum after hitting submit? It wont, in my experience. but this whole thread is about why will this insert statement not work when I hit submit? <?php session_start(); include('CheckLogin.php'); include('databaseconfig.php'); if (isset($_POST['submit'])) { $resault = mysql_query("insert into customer(cust_id, first_name, last_name, adress, postal_code, phone_number,user_name,user_pass) values('" .$_POST['cust_id'] ." ','" .$_POST['fname'] ." ','" .$_POST['lastname'] ." ','" .$_POST['address'] ." ', '" .$_POST[ 'postalcode'] ." ','" .$_POST['phonenumber'] ." ','" .$_POST['fname'] ." ','" .$_POST['lastname'] ." ')"); if(!$resault) { echo mysql_error(); } else { echo "<p>successfully added</p>"; } } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Home </title> <script type="text/javascript" src="javaScript/jquery-min.js"></script> <script type="text/javascript" src="javaScript/corners.js"></script> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> </script> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header> <div id="header"> <h1 id="logo">RAY AND CARLS </h1> <p class="description"> <?php echo checkAdmin();?> <br/> </p> </div> </header> <nav> <ul id="nav"> <li> <a href="index.php">Home </a> </li> <li> <a href="#">Customer Registration </a> </li> <li> <a href="#">View Movies </a> </li> <li> <a href="#">View Games </a> </li> <li> <a href="#">Rent </a> </li> <li> <a href="#">Login </a> </li> <li> <a href="#">Admin </a> </li> </ul> </nav> <article> <section> <div class="cornerBox cBox3"> <div class="cornerBox-content"> <p>All updates to the Data base can be done here. Keeping in mind specific relationships with The back end data bases. </p> <p>Some common tasks are below. This page allows you to add, edit and delete customers/movies and games. </p> <div class="cornerBox2 cBox3"> <div class="cornerBox-content"> <h1>Menu </h1> <ul> <h2>Customers </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> <h2>Movies </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> <h2>Games </h2> <li> <a href="#">edit </a> </li> <li> <a href="#">Add New </a> </li> </ul> </div> </div> <div class="Forum"> <h2>Add New Customer </h2> <form class="cmxform" id="commentForm" method="post" action=""> <p> <label for="cname">Customer ID: </label> <em>* </em> <input id="cname" name="cust_id" size="25" class="required" minlength="2"/> </p> <p> <label for="cemail">First Name </label> <em>* </em> <input id="cemail" name="fname" size="25" class="required email"/> </p> <p> <label for="curl">Last Name </label> <em>* </em> <input id="curl" name="lastname" size="25" class="url" value=""/> </p> <p> <label for="curl">Address </label> <em>* </em> <input id="curl" name="address" size="25" class="url" value=""/> </p> <p> <label for="curl">Postal Code </label> <em>* </em> <input id="curl" name="postalcode" size="7" class="url" value=""/> </p> <p> <label for="curl">Phone Number </label> <em>* </em> <input id="curl" name="phonenumber" size="11" class="url" value=""/> </p> <p> <input class="submit" type="submit" value="Submit" name="submit"/> </p> </form> </div> </div> </div> </section> </article> <footer> <div id="footer"> <div class="footer1"> <h2> About </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <div class="footer2"> <h2>Other places </h2> <p> <ul> <li> <a href="#">Link 1 </a> </li> <li> <a href="#">Link 2 </a> </li> <li> <a href="#">Link 3 </a> </li> <li> <a href="#">Link 4 </a> </li> </ul> </p> </div> <div class="footer3"> <h2> Other information </h2> <p> Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. </p> </div> <p class="credits">© <a href="http://bwshome.byethost5.com/blogs">Adam Balan - BLACKANDWHITE </a> <span>• </span> Powered by <a href="http://bwshome.byethost5.com/blogs">BLACKANDWHITE </a> <span>• </span> </div> </footer> </div> </body> </html>
  11. Sorry for the double post, but adding the name submit doesnt change the outcome of the statement never getting executed
  12. Thanks but by moving that echo statement you now make it echo at the top of the page and not where I had it before
  13. So how would you guys take the forum input and make it into a insert query in php? I know this is basically "please give me the code" but I am running out of ideas, and not understanding what I am doing. Checklogin just checks if the user is logged in, if not - return you to the login page. databaseconfig just connects you to the data base. there auto run scripts.
×
×
  • 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.