Jump to content

renfley

Members
  • Posts

    89
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.dailyfunnies.ca

Profile Information

  • Gender
    Not Telling

renfley's Achievements

Member

Member (2/5)

0

Reputation

  1. Hey Ignace insnt the default of mkdir() already set to 0777?
  2. Thanks Psycho... is was my error, your snippet does loop perfectly i wasn't closing the while correctly Thanks again.
  3. I did i made sure that the actual folder was missing 3 dirs but when i run the script it only creates the first missing one leaving the other not to be created. i am still stuck on this ill try again this morning but any input is awesome Thanks
  4. Ok so guys im a little stuck on some code here and could use some help.. ok so i have 3 rows in column and created 3 folder to match them /ticket/ ->folder1 ->folder2 ->folder3 Now at the end of day i might have more folders, folder4,5,6,7 ect... I want to be able to check and create missing folders based on whats missing but i also want it to catch any folders that might have been deleted. here is my code, the reason it doesnt work is that as soon as it finds a folder that doesn't exists, it creates 1 folder but wont create more then that because the confition was met. and the code stops. I have tried many different alternative any input would be awesome //Query DB $sql = "SELECT DISTINCT tn from tic"; $result = mysql_query($sql) or die(mysql_error()); $loc = "../tickets/"; while ($row = mysql_fetch_assoc($result)){ $dir = $loc . $row['tn']; if(!is_dir($dir)){ mkdir($dir); } elseif(is_dir($dir)){ } } exit();
  5. no it isnt showing any filename
  6. Thanks ive made the chage but issue is still happening.. no file is being downloaded.
  7. Hey guys im trying to download an excel sheet from the db and it keeps displaying the entire content on page and would like to just download but it aint working. $DB_Server = "localhost"; $DB_Username = "root"; $DB_Password = ""; $DB_DBName = "test"; $DB_TBLName = "tickets"; $filename = "MasterBackup"; //create MySQL connection $sql = "Select * from $DB_TBLName"; $Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password) or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno()); //select database $Db = @mysql_select_db($DB_DBName, $Connect) or die("Couldn't select database:<br>" . mysql_error() . "<br>" . mysql_errno()); //execute query $result = @mysql_query($sql, $Connect) or die("Couldn't execute query:<br>" . mysql_error() . "<br>" . mysql_errno()); //create query to select as data from your table $select = "SELECT * FROM $DB_TBLName"; //run mysql query and then count number of fields $export = mysql_query ( $select ) or die ( "Sql error : " . mysql_error( ) ); $fields = mysql_num_fields ( $export ); //create csv header row, to contain table headers //with database field names for ( $i = 0; $i < $fields; $i++ ) { $header .= mysql_field_name( $export , $i ) . ","; } //this is where most of the work is done. //Loop through the query results, and create //a row for each while( $row = mysql_fetch_row( $export ) ) { $line = ''; //for each field in the row foreach( $row as $value ) { //if null, create blank field if ( ( !isset( $value ) ) || ( $value == "" ) ){ $value = ","; } //else, assign field value to our data else { $value = str_replace( '"' , '""' , $value ); $value = '"' . $value . '"' . ","; } //add this field value to our row $line .= $value; } //trim whitespace from each row $data .= trim( $line ) . "\n"; } //remove all carriage returns from the data $data = str_replace( "\r" , "" , $data ); //create a file and send to browser for user to download header("Content-type: application/vnd.ms-excel"); header("Content-disposition: csv" . date("Y-m-d") . ".csv"); header( "Content-disposition: filename=".$file_name.".csv"); print "$header\n$data"; Any help would be awesome
  8. i should also mention hosting is with 1and1
  9. Ok so it gives me a internal 500 error and ive tried a few different methods still no luck My Test site is spaxus.com if you click the home menu button... it go to http://spaxus.com/?page=home I would like it to show http://spaxus.com/page/home/ So can anyone help me out?
  10. yea i have quite a few that call on admin and page, Also others i will need to automate it but that's on me, Gotta learn by figuring out the basics first... I will test and let you know how it goes, Thanks
  11. Hey guys i need to change the url field. This is what i currently have, site.com/?page=home and site.com/?admin=home Here is the .htaccess RewriteEngine On #Look for the word "wiki" followed by a slash, and then the article title RewriteRule ^?admin=home /admin/home dunno if im on the write track but ive never done url rewrites. i would like to see site.com/page/home
  12. Well another issue fixed... For those wondering. I found a lib called dispatch, Does exactly what i need... // include the library include 'dispatch.php'; // define your routes get('/greet', function () { // render a view render('greet-form'); }); // post handler post('/greet', function () { $name = from($_POST, 'name'); // render a view while passing some locals render('greet-show', array('name' => $name)); }); // serve your site dispatch(); You can find the files here... http://noodlehaus.github.io/dispatch/ This will be perfect for my framework...
  13. LOL just notice my phrase... What i meant was I want to use a controller that sees the url as www.example.com/post/2 instead of www.example.com/?page=2 and include that post and 2. Can i take a controller or write a new one without having to incorporate MVC?
  14. Hey guys, when every i create a new page we currently pass it via the url like... <a href="?page=home">home</a> So by using the following code. if (isset($_GET['page'])) { include ("includes/" . $_GET['page'] . ".php"); } else{ echo "Welcome Home"; } This method looks like this www.example.com/?page=2 Is there a way other to apply a complete MVC to use only the controler to change the view? so i would have www.example.com/article/ and use a controler to just include?
  15. if you declare your value a = a you can then use this! if (isset($row['status'])) { $estatus = $row['status']; } else{ $estatus = ''; } quick short and work, just need to make sure your variable is equal to value
×
×
  • 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.