Jump to content

Ryoku

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    pokemon_alone@hotmail.com

Profile Information

  • Gender
    Not Telling

Ryoku's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I’m having a problem installing PHP (and subsequently mySQL though I haven’t gotten that far yet) on Windows XP x64. I get as far as installing Apache and it works up until anything PHP is added into the httpd.conf file, no matter which solution I take to install PHP it give me an error, apache won’t load what have you. When working form the installer, unless I tell it the exact folder the httpd.conf file is in it won’t add the php module information in, if I do add the full path it tells me there is a getobject error or something and common to both it says I need to manually configure the server… Does anyone have any one have any idea what minute facet of PHP is imploding on me? I have a working PHP server on my x32 os so its not that critical however I would like to get the x64 working so I can hopefully switch out permanently because of compatiblilty issues I’m having with buggy packages on x32.
  2. its worked but i got a weird result, when i uploaded the file i had to change the '-' to "-" or it didn't accept the formatting... that's kind of odd... thank you for your help! Ryoku
  3. Coming hot off the heels of the last post I made is a branched problem. I have my file uploading working currently. It renames and posts correctly however the formatting is incorrect. I have my formatting set up so that it is supposed to rename a file to the fallowing format Date.postid.ext [date(Ymd).’-‘.$postid.$ext] which outputs 20080808-2.jpg At first glance this looks correct however in my DB I want to have a padding to accommodate up to 10k posts to accomplish that and maintain organization I want to pad the number with “0” until it has the correct number of characters. (so an example of correct formatting would be 20080808-00002.jpg) Every time I have asked this people say to use the str_pad() function however I can’t seem to get it to work because when i echo it the string becomes an int and i lose my padding again. I know I'm probably doing it wrong. Can someone give me an example of how to work with integer padding?
  4. I managed to figure it out on my own after stairing at the function for a while. I don't think copy was the rite function to use. i used a move_uploaded_file() function and change the original file (['TMPfile'],['name']) to the name of the temp file (['TMPfile']['tmp_name']) and cleaned up some of those confusing variables to rename the file. if someone is looking at this as reference change the code as fallows: //from $rename = $path . $newname; $path = $path . $rename; if($oldname != none){ if(copy($oldname,$path)) //<-----line 43 { //to $path = $path . $newname; if($oldname != none){ if(move_uploaded_file($oldname,$path)) //<-----line 43 { remove the line that says $rename and change the $rename var to $newname and change copy() to move_uploded_file() and its good!
  5. I'm tinkering with file uploading on a DB on my computer before i risk destroying on on my server currently I have the fallowing script written but it give me an error (probibly more knowing my horrid typeing) though i can't seem to figure out what I messed up on this. I'm losely fallowing a tutorial found : Here since the one i did from Here worked well enough for me. I'm trying to rename the file uploaded and move it to a folder which was successful in the last incarnation of this script (at least moving it w/o renaming it. as it sits rite now I'm getting an error from my script and I can't seem to figure out how to fix it. I'm pretty sure its because something wasn't declared correctly but I can't see it. I've been farting with this for the past 5 hours and I think a fresh set of eyes could help this out (considering I've been up for the past 30) <?php /*list of recived variables from Fuploader.php Var Var is SQL ________+_____________+________________ GalDate - the date = date GalTLT - title = title TMPfile - the file = url GalCMT - the comment = comment */ //declairing short variables $oldname = $_FILES['TMPfile']['name']; //input file $path= "../fauxgal/"; //path to final resting place $postid = $row['postid'] + 1; //needs database access $fileEXT = substr($oldname, strripos($oldname, '.')); //getting extension $newname = date(Ymd) . $postid . $fileEXT; //declairing new file name eg."20080808-00001.jpg" $db = 'webserv'; //--------------------------------------------------------------------------------------------------------// // variables for db server $date = $_POST['GalDate']; // phraseing the posted variables $title = $_POST['GalTLT']; $coment = $_POST['GalCMT']; //this block connects to the DB to get the post id for file name $con = mysql_connect('localhost','',''); if(!$con){ echo "There was a problem: " . mysql_error(); }else{ mysql_select_db($db,$con); $result = mysql_query("SELECT postid FROM gallery ASC LIMIT 1"); $row = mysql_fetch_array($result); GLOBAL $row; }// end DB query for file name $rename = $path . $newname; $path = $path . $rename; if($oldname != none){ if(copy($oldname,$path)) //<-----line 43 { ?> <div style="width:300px;border:1px solid #000000;"> <?php echo ('File /" ' . $oldname . '/" moved and renamed to /" ' . $newname . '/" Sucessfuly!'); echo ('<br //><img src=/"' . $path . '/" //>'); echo ("Title/: " . $title . "<br //>"); echo ("<hr />"); echo ("Comment/: " . $coment); }else{ echo "Echo There was an error!"; } } mysql_close($con); //close mysql link ?> </div> currently i'm getting the fallowing error (image named "blank_sample.jpg" and is just a vertical image with the word "blank in it"): thank you in advance for anyone who contributes ^^ Ryoku p.s. (I know its probibly not very efficent to get the postid from the DB but I'll be storing the URL in the DB anyway so might as well open it =P )
  6. wow, completely not how i thought it was going to react. i didn't even test it because i thought it was going to error. ... um it worked correctly when i called the value twice in the same loop but for the sake of argument and example this is the snippet in question ^^; $result = mysql_query("SELECT * FROM post ORDER BY date DESC LIMIT 5 OFFSET " . $offset); while($row = mysql_fetch_array($result)) { echo $row[date] . "<br> \n"; echo $row[subject] . "<br> \n"; echo $row[body] . "<br>\n"; echo "<hr>\n"; echo $row[date]; } }
  7. I don’t know enough about arrays to use this correctly so I think I should ask someone. I have a problem with a news system I’m making, I have an array that the sql response give me and when I call them it gives me the data in the order the DB vomits. Well my problem is that I want to create an edit button for a/the post but I need to do so based off the date, the root of the problem is that if I call the date again I will get the next date in the array not the date of the post I want to edit. Essentially what I’m asking is how do I call the same data twice in the same loop?
  8. well i think i figured out a way, using mkdate() to reformat the date, if i have an idate('Y') to just call the values and manipulate them that way i throw the values back into a date('Y-m-d',mktime(0,0,0,$curmonth,$curdate,$curyear)) i get the result I'm looking for... ^solved although it still really dosen't answer my question of how to force a string length, how ever mute, =P i remember a tiny piece of the over all code to pull it off it looked something like this [/./.\\/] but that's all i remember and i have no idea what that example means...
  9. well this is the situation I'm in. I'm messing with functions I'd like to add to, my first, news script. I either have the date provided by PHP from the date() or i have the date retrieved from the entries in my DB server. I'd like the ability to post/pre-date news (to be posted) by adding or subtracting from the int date and still have it compatible with the date format of the DB server where it will end up. but when i attempt to script for pre/post any math i do to the value returns a value of a single digit not 2 digits as the DB formatting requires (to my knowledge) i get 9 where i need 09 [since i did these tests today (08/09/08)]
  10. I actualy started on the php.net manual but its didn't help me with the problem of losing my formatting when i printed the results. after i would explode() the date into an array to work with the numbers once i used any math on the values they lost their formatting. if I'm going to transpose the base date into another value i need to know how to force the length of the string.
  11. I had a book that covered this but its packed up and buried under a mountain of boxes. I'm having some problems messing around with dates. when i try to do something basic to the values PHP returns i lose my leading zero(s). how do you force/require a string to be a certain length?
  12. Well I know this is a repetitive post and more than likely in the wrong section but I need some serious help in setting up my Apache. I have it working and displaying the default HTML file for English; that’s about it for it though. What I want to do is set up a server so I can have users click and download files either from an HTML file or simply by viewing the drive/folder\'s content. I\'m so inexperienced I was easily dazed by the config file and that of any online tutorial. I can\'t understand half of it and would just like someone to help me get threw this so I can move on with the development of my site and sub-sites there of. I hope someone answers this because this is pretty much the only place I see as fitting to answer this question. I have been to about 4 other sites, going threw the hassle of registering and logging in, hunting down IRC rooms with little help or no users on and almost three weeks has past since I made any progress on my own. I really don’t understand this stuff but I’d like a little help if someone can find the kindness. Please wait till someone tries to help me before this is moved (if its in the wrong section) Thank you, Ryoku
×
×
  • 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.