Jump to content

MinusMyThoughts

Members
  • Posts

    227
  • Joined

  • Last visited

Posts posted by MinusMyThoughts

  1. alright, so i'm still getting something wrong......this is my confirm.php file in its entirety. try not to laugh too hard...

    <?php  session_start();  $page_mode = $_POST['page_mode'];?><html><head>  <title>Updating The Nate Green Experience</title></head><body><?phpswitch ($page_mode){ case "Confirm":  $mysql_user = 'user';  $mysql_pass = 'pass';  $mysql_host = 'host';  $connect = mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die("Could not connect. " . mysql_error());  $db_select = mysql_select_db('database', $connect) or die("Could not select database. " . mysql_error());  $query = "update content set contentText = '"	.mysql_real_escape_string($_SESSION['homeBody'])	."' where contentID = '"	.mysql_real_escape_string($_SESSION['contentID'])	."'";  $result = mysql_query($query);  if($result)	header("Location: update.php");	exit();	break; case "Cancel":	header("Location: update.php");	exit();	break; default:	echo "Unknown page mode: {$page_mode}";	break;}	?></body></html>

    ...when i go to this page, i end up left on a plain white page. none of the code seems to be executed, but i'm not getting errors, either......did i completely botch that?...thanks again!love,jason

  2. is this right?

    <?php  session_start();  $homeBody = $_POST['homeBody'];  $contentID = $_POST['contentID'];  $_SESSION['homeBody'] = $homeBody;?><html>...formatting content...<?php  echo '<div class="content"><p class="content"><i>This is your content as it will be displayed.'	.' Click "Confirm" to finalize your changes or "Cancel" to start over.</i></p>'	.'<p class="content" name="homeBody">'	.stripslashes(nl2br($homeBody))	.'</p>'	.'<form action="confirm.php" method="post">'	.'<input type="submit" class="updateBTN" name="page_mode" value="Confirm">'	.'<input type="submit" class="updateBTN" name="page_mode" value="Cancel"></form></div>';?></body></html><?php  session_write_close();?>

    thanks!love,jason

  3. i think the book i'm using is proving severely outdated......i'm using the second edition of PHP and MySQL Web Development by Luke Welling and Laura Thomson. it's 3 years old, so i've been seeing a lot of things it recommends either 1) simply not work, or 2) require a lot of unnecessary/deprecated steps (i.e. $HTTP_POST_VARS instead of $_POST)......is there a newer, better book? i'd love to be able to leave you guys alone and figure all this out on my own. not that i don't love our conversations. :)love,jason

  4. so, i thought i had this under control......i'm trying to create a preview page for users to see what they're about to post before it's written to the database. i worked out all the bugs to go from my user's text input -> database -> output on somepage.php, and now i'm trying to add another link in the chain:input -> PREVIEW PAGE -> database -> output on somepage.phpi'm falling apart, i hope, here: i think i'm losing the values of my variables when i try to pass them from update.php -> preview.php -> confirm.php. i'm 90% sure that's the problem......does it work to put a variable from a previous page in a form to be sent to a third page?...here's the code for my preview page. everything is passing just fine from update.php -> preview.php, and i know i screwed up somewhere in here, but this is what i'm working with...

    <?php  echo '<div class="content"><p class="content"><i>This is your content as it will be displayed.'	.' Click "Confirm" to finalize your changes or "Cancel" to start over.</i></p>'	.'<p class="content" name="homeBody">'	.stripslashes(nl2br($homeBody))	.'</p>'	.'<form action="confirm.php" method="post">'	.'<input type="hidden" name="homeBody" value="'	.$homeBody	.'">'	.'<input type="submit" class="updateBTN" name="page_mode" value="Confirm">'	.'<input type="submit" class="updateBTN" name="page_mode" value="Cancel"></form></div>';?>

    as you can see, i thought that by placing my variable inside the form, i'd be able to pass it through. i was given the suggestion to "stick it in the session," but i don't know what that means or how to go about it......thanks for any help you can give me! i know i'm asking tons of questions, and i really appreciate all the help i'm receiving...love,jason

  5. another question: how do i check the value? can i use value as a POST variable, like this?$value = $HTTP_POST_VARS['value'];will that leave me with $value = (the value of the button pressed)?thanks!love,jasonoh, so i use $page_mode to get the value?...this is starting to make sense. you rock.love,jason

  6. that's kind of what i thought was going to happen. so now i'm in the wrong forum, but how do i make menu.php redirect to a particular page?...i think i've got how to update the database and populate my textarea when they go to the update page, but URL redirection has never really come up, and i definitely don't know how to do it......thanks!love,jason

  7. i don't need anything. i had asked for suggestions on better methods of dealing with my site, and phpMyAdmin was brought up. And my host is ... difficult, to say the least......it took me two separate phone calls and an hour and a half just to figure out that my package didn't allow C-Prompt access to my database. neither of the tech people i talked to were familiar with MySQL, and both of them had REALLY thick accents, so there was a lot of repetition and "Are you sure that NO ONE there knows how to use MySQL?"...long story short, i'm trying to circumvent the problem by turning a server i have lying around into a hosting service. but that's a whole other nightmare i'll have to deal with later on...love,jason

  8. Hopefully, this is an extremely simple question.i just created my first database-driven site, and i'm trying to add a preview page, where the user can either confirm their changes (i figured this part out) or press Cancel to return to the update page without changes, or press Edit and make more changes......what's the best move for the Cancel and Edit buttons? i've never used either before, and i'm unfamiliar with using input buttons for navigation or really anything but updating my databases......thanks for the help!love,jason

  9. unfortunately, i won't be able to use that......the only way that i can alter my databases (without spending extra money every month) is through the host's web-based copy of phpMyAdmin. it might actually be the same program......i'll survive. the only thing that sucks about it is the timeout for my login session. i get booted after ten minutes, so i end up logging in ten or eleven times......thanks for your help, guys!love,jason

  10. worked like a charm......thanks so much!...any tips for the database and/or interface? i think i've got it from here, but it seems like anything i can do, everyone on here can do faster and easier. :)love,jason

  11. i took your advice and set up a database for my site. it's set up like this:(contentID, contentText)1, Home text.2, About text.3, Services text....there'll be more to it after i figure everything out. i've already run into a problem, though. i can't seem to update the database. something is wrong, but i'm not sure what. i'm not getting any errors, but i'm also not getting to the end of my script (my last 'echo' statement isn't working......do you see a problem straightaway?

    <?php  $mysql_user = 'user';  $mysql_pass = 'pass';  $mysql_host = 'host';  $connect = mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die("Could not connect. " . mysql_error());  $db_select = mysql_select_db('database', $connect) or die("Could not select database. " . mysql_error());  echo 'Echo test.';  $contentUpdate = 'Web-uploaded content.';  $query = "update content set contentText = ".$contentUpdate." where contentID = 1";  $result = mysql_query($query);  if($result)	echo $contentUpdate;?>

    ...thanks so much for your help!love,jason

  12. sorry. i was making up words......is there a tutorial on putting MySQL results into an array?...also, i set up the BCC the same way as TO, right?

    $bcc = "BCC: ".myArray;

    i'll have to look into arrays, as i've got zero experience with them. but thanks for the push in the right direction...love,jason

  13. so instead of writing to a text file, i should just create the single-item database and allow the user to update that?...does the formatting work the same for that?...and will i need a unique identifier for a one-row table?...are these all dumb questions? :) i swear i'm starting to learn this stuff, if slowly...love,jason

  14. I'm trying to make my site dynamically generate its content from a .txt file that my user can edit from a separate form......i thought a flat file would be better than a database because there's only one entry that needs to be overwritten every time the entry is edited. if you know a better method, i'm all ears......my question at hand, though, is this: how can i get the entered text to maintain its line breaks? i tried nl2br() with no luck. i can use HTML, but i want to assume that my user doesn't know any......as an additional problem, the file reads correctly, but then tacks on the character count of the entry at the end, like so: "TEST TEXT.10"here's my code:

    <?php  $fp = fopen("home.txt", 'r');  $home= fpassthru($fp);  echo nl2br($home);?>

    probably due to my own error, i could only get fpassthru() and readfile() to work. the nl2br() is still there for now, but i haven't been able to make it work. i left it in hopes of being told i placed it incorrectly and can solve all of my problems with a copy paste. :)...thanks!love,jason

  15. what would "large" mean?...the site i'm developing for has only been around for a week and already has 100+ subscribers to the newsletter......how would i do an array mailer? even if i don't end up using it for this project, i'd love to learn how to do it for future reference...love,jason

  16. alright, so let me try this. i don't have too many folks to write to, so i'll use a loop and the mail function for now...

    $i = 0;while ($i < $mailID) {  mail($email, $subject, $body);  $i++; }

    i've never written a while statement before, but i've read them on here. am i even close?love,jason

  17. i don't know if this actually matters at all in coding a page, but when i was testing my database, i submitted a handful of entries into the database, which i've since deleted. however, the auto_increment value is still sitting where it was when all those values were in the database......first question: will this cause problems if i try to run a while command and it searches "1" and can't find it?...second question: how hard is it to reset the auto_increment to "0"?...thanks!love,jason

  18. i found it on here a few days ago, but now my search is coming up with different topics......i'm building my first newsletter system. i've gotten my code correct up to the point of being able to store user input in a database with two columns, the mailID (auto_increment) and the email......what i'm looking to do, hopefully, is run a while command to count up the mailID and send out an email to all the users on that list......my table is called "email" ......if someone knows the thread i found earlier, please link me to it. i'd love you forever if you could help me out......thanks!love,jason

  19. EDITthanks to the code jblack had up in another forum, i was able to get the code working. i gave you credit, jblack, in case anyone's wondering......thanks to justsomeguy for helping me determine that it wasn't just me that couldn't connect to the darn thing...love,jason

  20. i called tech support and figured out that my hosting package doesn't allow C-Prompt access, but they've got a tool on their site that allows me to build my tables......they said i should be able to connect to the database via PHP, however......so now i might be asking the wrong question in the wrong forum, but when i attempted to connect to the database with PHP, it's not finding the database yet again......i'm pretty sure my syntax is correct:

    <?php  $emailList = $HTTP_POST_VARS['emailList'];@ $db = mysql_pconnect('http://db525.perfora.net', 'username', 'password');  if (!$db)	{	echo 'Error: could not connect to the database. Please try again!';	exit;	}  mysql_select_db('email');  $query = "insert into email values		('".$emailList."')";  $result = mysql_query($query);  if($result)		  echo 'Thank you for signing up!<br/><br/>';	  echo 'The email address you submitted was: <b>'.$emailList.'</b><br/><br/>';	  echo '<a href="http://www.thenategreenexperience.com">Click here to be redirected back to the Nate Green 		Experience.</a>';?>

    ...my table structure is extremely basic:email(mailID, email)mailID is the primary key, auto_increment. email is supposed to store the email address entered in my input box when the user clicks "Sign Up!"...did i screw something up in my code?...any help is greatly appreciated...love,jason

  21. so, the hostname i was given is "db525.perfora.net"...do i need something other than that? because that's exactly what i've been entering and it fails. i tried it once with "http://" in front, but that failed after thinking for a long time......any ideas? or should i start harassing my hosting service's tech support?...thanks!love,jason

  22. so, i'm working on my first MySQL project and i'm already stumped. i got a MySQL database up and running on my computer, and i've been able to work with that without problems. now i'm trying to get connected to my online database, and i can't......when i attempt to connect it tells me:"ERROR 2003 (HY000): Unknown MySQL server host 'myhostname' (11004)"i'm using both the C-Prompt and the MySQL Command Line Client that came with my download, both to no avail. my format is:>mysql connect -h hostname -u username -p...right off the FAQs. what am i doing wrong?...thanks so much for any help!love,jason

×
×
  • Create New...