Jump to content

Skatecrazy1

Members
  • Posts

    126
  • Joined

  • Last visited

Everything posted by Skatecrazy1

  1. wow this is simple. don't make posts every 10 minutes just because you haven't gotten an answer yet. try something like this. [code] <?php $string = "filename.php"; $string = rtrim($string, ".php"); echo $string; ?> [/code] i tested that and it worked.
  2. Well how exactly are you retrieving the data from the user?  because GET will only work if you use method="url" in the form.  I suggest using the post method, then the way to count the string length of the submitted stuff is: [code] <?php $fav_book = $_POST['book']; $fav_meal = $_POST['meal']; $book_length = strlen($fav_book); $meal_length = strlen($fav_meal); //then echo it echo("<p>Your favorite book is $fav_book.</p>"); echo("<p>Your favorite meal is $fav_meal.</p>"); //and use the length variables however you want, you didn't really go into detail on that ?> [/code] plus, the count function is used to count the number of values in an array, so it wouldn't be of use here.
  3. Yes, I know all about how .htaccess works: I'm trying to visit the directory the .htaccess is in when it contains this code: [code] Options +FollowSymLinks RewriteEngine On [/code] Which is what the tutorial at [url=http://www.tutorio.com/tutorial/enable-mod-rewrite-on-apache]http://www.tutorio.com/tutorial/enable-mod-rewrite-on-apache[/url] said would have no errors (when i tried to view the directory) if mod_rewrite were successfully enabled. but, when I simply try to access the directory, it gives me a 500
  4. because you don't use [/url] for one thing, you use [code]</a>[/code]. also, anchor tags aren't self closing, so there shouldn't be a slash at the end of your link tag.
  5. okay well this script here should upload any file. [code] <?php //where you want the files 2 go $dir = "uploads/"; if( $_FILES['file']['name'] != "" )   {     copy($_FILES['file']['tmp_name'], "$dir".$_FILES['file']['name'])  or die("Couldn't upload .swf"); } else { die("Error:  You either didn't specify a file."); } ?> [/code]
  6. generally in programming: int = 1234567890 (no decimals) float = 3.4 or 2.32135 etc. (a decimal)
  7. try [code] <?php //where you want the files 2 go $dir = "uploads/"; if( ($_FILES['file']['name'] != "" ) && ($_FILES['file']['size'] < 102400))   {     copy($_FILES['file']['tmp_name'], "$dir".$_FILES['file']['name'])  or die("Couldn't upload .swf"); } else { die("Error:  You either didn't specify a file, or the file is too large.  Please try again."); } ?> [/code]
  8. try [code] <?php if (($_REQUEST['e'] == "y") && (($city == null) || ( nl2br( $city ) == "<br />"))){ echo "bgcolor=\"#FF9999\""; } else { echo "bgcolor=\"#FFFFFF\""; } ?> [/code]
  9. if you want to show a page only if it is between 8 am and 8 pm, then do this [code] <?php $hr = date("G"); if($hr < 20 && $hr > 7){ //show the page } else { echo('Sorry, page closed'); } ?> [/code] p.s. doublecheck the numbers in my if statement, they should be accurate but I'm not exactly certain. also if you need to modify your timezone, say you're on PST and your server is EST, do this: [code] <?php $hr = date("G"); $offset = $hr - 3; ?> [/code] also, freeloader, when you put a date function in a variable, using " instead of ' is more error-proof and the H format in date uses leading zeros, keep that in mind.
  10. tried that, but I get a 500 when trying to view my test .htaccess file....
  11. your end php tag shouldn't be <?PHP it should be ?> also try putting your starting <?php tag in lowercase. and the random [/url] bbcode tags can't be helping either.
  12. just strrev the backwards text.... and yes, unicode-bidi is used for languages that read right to left.  nothing to do with backwards text.
  13. oh i'm sorry, i was confused as to what you were trying to do: this doesn't have to be in a form at all what you need to do is still keep the loop that shows the info for each row, that part is fine make a file called edit.php (you'll know what to do with this in a second) now instead of a button, i'd use a link that says "edit";  now, inside the while loop where you have the link make it <a href="edit.php?id=$row['itemID']">(with the properly escaped characters of course) now in your edit.php file, where you have the text form to update the row, use the following query to select the row: [code] <?php $id = $_GET['id']; //put your connection stuff and all that here, i'll skip to the query $sql = "SELECT * FROM `products` WHERE `itemID`=\"$id\""; //then echo the data into your textarea ?> [/code] hopefully i've cleared up the method of using the id in a link as you can see, all you do is call the itemID value into the edit.php?id=itemID part of the link, and that value is picked up by the $_GET variable in edit.php, and used to select the data from that row.
  14. Hey, i have xampp and I was going into the httpd.conf file and uncommenting the LoadModule line for mod_rewrite, but I've heard you have to also uncomment AddModule mod_rewrite.c and ClearModuleList. only problem for me is that I can't find either of those lines in my httpd.conf file.  help would be greatly appreciated.
  15. UPDATE `table_name` WHERE id=$id_variable SET `field_you_are_editing`=$new_data LIMIT 1 assuming you have a form that gets the old data, & posts it as $new_data when it has been edited and submitted.  That's just the SQL.  if you need some help with the php, i'll help you, but as long as you have that SQL, all you should do is really just run the query.
  16. okay, thanks for the help, but called godaddy, found out upgrading to the new server configuration (and PHP 5) was an option i had not yet enabled. but, I used what you said and it worked fine. thanks though.
  17. as far as I can see, there are no errors in your syntax... that truly is a weird error... all I would say is check your connect.php file, use `'s around your field names (for example INSERT INTO personal_data (`fname`, `lname`, `email`, `character`, `sex`, `bday`)), and to also make sure you reference your connection in the mysql query (if your connection is in a variable, reference it as mysql_query($sql, $connection)) and if it's not in a variable, also make sure to close your connection at the end.
  18. no problem tell me if it works out
  19. so what would i replace my $dom = new DomDocument; with, in this case?
  20. okay, so first you need to get the data from your `users` (i'm presuming) table [code] <?php //connect to mysql $conn = @mysql_connect("host", "username", "password") or die(mysql_error()); //select your database $rs = @mysql_select_db("database_name", $conn) or die(mysql_error()); //setup sql to retrieve info $sql = "SELECT * FROM `users` WHERE `username`=$username"; //execute query $rs = @mysql_query($sql, $conn) or die(mysql_error()); //get data in array $row = mysql_fetch_array($rs); //set data into variables //this is just an example, change variables/array values as needed $userid = $row['id']; $comment_text = $row['comment']; $date_entered = $row['date_entered']; /*now make some more SQL that inserts the newly retrived data into your comment table*/ $insert = "INSERT INTO `commentpost` (`articleid`, `userid`, `comment`, `date_entered`) VALUES ('', '$userid', '$comment_text', '$date_entered')" //now execute the query to insert the data into the target table @mysql_query($insert, $conn) or die(mysql_error()); ?> [/code] after that you can do whatever you want as far as sending the user to another page, that's just the general code to take the data out of the user table and insert it into the commentpost table make sure you edit some of the values (i arbitrarily decided on some of the names, so if you're using something different, go ahead and change it so it works)
  21. wait wait wait make sure before you use that, put [code]LIMIT 1[/code] at the end of the query.  otherwise all of the entries in that table will be dropped.
  22. probably just echo some root tags, then use a foreach to echo the tags that go around the info, plus the info.
  23. usually the simplest way to transfer data table to table would be to extract it from the source table then insert it into the target table, I imagine.  if you need some code tell me, but i'm figuring you know what you're doing.
  24. okay here's my php info [url=http://www.snapskate.com/info.php]http://www.snapskate.com/info.php[/url] i can't really get anything from it as to why my code to parse the xml isn't working, so if anyone knows I'd appreciate some insight :P apparently goDaddy still uses php 4
×
×
  • 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.