Jump to content

ssmK

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ssmK's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks to btherl and Daniel0, that solution worked, I was unaware that PHP and MySQL shared the ' ' vs " " trait.  And thanks to kalivos for the eval() heads up! That worked as well.
  2. Thanks, guys! I'll give this a try and report back.
  3. Hi there, I don't mean to pester you guys with these questions, I usually try to figure this stuff out myself, but this one has me stumped.  I'm making an automated email system for communicating with customers, and have got the mail() function working well.  And, I'd like to store the contents, subjects for different types of email in a MySQL database. Here's my problem: [code]mail("Line1\nLine2\nLine3");[/code] will send this email: Line1 Line2 Line3 Now, say I store 'Line1\nLine2\nLine3' as a TEXT, and then do something like this (assuming, of course, that I've pulled what I need to into $row...) [code]mail($row[3]);[/code] This is what arrives in my mailbox Line1\nLine2\nLine3 I am also having the same problem with variables.  I can not figure out how to store something like this (stored in MySQL as TEXT) 'Hi, $first_name, thanks...' and then have it be of any use to me without str_replace().  I'm guessing I need something of a reverse escape string function, or something that will tell PHP to re-parse the string.  Anyone know how to do this? Thanks! Rob Edit:  I just realized the syntax for mail() all wrong... but hopefully you guys get the idea... thanks again!
  4. Hi there, I've been developing a DB Maintenance interface on my dev machine here at work.  Everything runs fine on dev machine.  I installall Apache, PHP, MySQL onto our server and move everything over there to get it all ready for primetime.  One of the forms now produces this error: Warning: Header may not contain more than a single header, new line detected. in C:\server\htdocs\edit.php on line 140 Does anyone know what could be going on? I am well aware of the headers already sent error, but as you can see this seems to be a different error.  Any pointers would be *greatly* appreciated. -Rob
  5. The book is written with the beginner in mind.  It's what I use.  I knew nothing about PHP a month ago, now I do.  Would recommend it, also, read the Amazon reviews.
  6. In order to get PHP & MySQL to work correctly togethere, there's a good amount that has to happen first, you have to have a web server (apache) set up.  Then you have to install PHP.  Then you have to install MySQL.  Then you have to know how to tie all of them together. Might I recommend picking up a book on the subject if you're really interested in learning this stuff.  You could try 'PHP and MySQL for Dynamic Web Sites' by Larry Ullman.  Amazon.com.
  7. I open it up and start coding a PHP file in code view, and even though auto indent is enabled, it does absolutely nothing in the way of indentation, besides the obvious check box (checked) next to Auto Indent, does anyone know how I could perhaps get this up and running? Thanks, BTW, what are your favorite IDEs for PHP editing?
  8. [code]<?php // UNTESTED CODE DEFINE ('DB_USER', 'username'); DEFINE ('DB_PASSWORD', 'password'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'sitename'); $dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() ); @mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() ); $query = "SELECT l.listing_number, a.agent, c.name FROM listings AS l, agents AS a, categories as c WHERE l.agent_id = a.id AND l.category_id = c.id;"; $result = @mysql_query($result); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {   //DO SOMETHING WITH UR ROWS HERE   //$row['agent'] for example } if($result) {   //THE QUERY WAS SUCCESSFUL } else {   //IT WAS NOT SO SUCCESSFUL } ?> [/code]
  9. SELECT l.listing_number a.agent, c.name FROM listings AS l, agents AS a, categories as c WHERE l.agent_id = a.id AND l.category_id = c.id;
  10. [quote author=SharkBait link=topic=99049.msg389912#msg389912 date=1151705377] Wierd because I do the same thing you do with no issues: [code] header("Location: ". $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) ."myfile.php?id=3&num=45"); exit(); [/code] Seems to work for me :) [/quote] Works for me too, but it doesn't work if you actually put variables in there.  Works just fine entering it as plain text.
  11. [quote author=jworisek link=topic=99049.msg389911#msg389911 date=1151705270] headers should be called like this: [code] header (Location: "http://www.blahblah.com"); [/code] yours is printed as this: [code] header (Location: http://www.blahblah.com); [/code] [/quote] Thank you for the reply, however, this is different from how my book describes header(); usage.  I tried this anyway, and it doesn't work.  Thank though.
  12. btw, this echoes TRUE .... [code]<?php if ('Location: http://127.0.0.1/oti/view_items.php?s=100&np=3&sort=d'==$header){echo 'TRUE';} ?>[/code]
  13. [code]<?php $s=$_GET['s']; $np=$_GET['np']; $sort=$_GET['sort']; $url = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/view_items.php?s='.$s.'&np='.$np.'&sort='.$sort; $header = 'Location: '.$url; header($header); //This produces problem described ?> <a href="<?php echo $url; ?>">Click</a> //This takes me right where I need to go[/code]
×
×
  • 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.