Jump to content

popcop

Members
  • Posts

    35
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

popcop's Achievements

Member

Member (2/5)

0

Reputation

  1. im using these headers in my PHP to make sure that emails are avoiding the junk mail folder but they dont seem to be working very well. $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: hello@somebodylovesyou.co.uk <hello@somebodylovesyou.co.uk>\r\n"; $headers .= "Reply-To: hello@somebodylovesyou.co.uk <hello@somebodylovesyou.co.uk>\r\n"; $headers .= "Return-Path: hello@somebodylovesyou.co.uk <hello@somebodylovesyou.co.uk>\r\n"; $headers .= "X-Priority: 3\r\n"; $headers .= "X-MSMail-Priority: Normal\r\n"; is there anythin from the above code that u would change or remove that might help this work?
  2. ive updated my code to this now and still nothing is displaying.... <?php // since the id is being passed in the url, you will need to declare it using the get method $rand = $_GET['rand']; $action = $_GET['action']; // if an id was sent to the script, then execute it if ($rand) { // connection vars $host = "localhost"; $user = "****"; $password = "****"; $dbname = "****"; $tablename = "cards"; $mysql = new mysqli('$host, $user, $password'); $result = $mysql->query('SELECT * FROM $tablename WHERE rand = $rand'); while (($row = $result->fetch_assoc()) !== null) { print_r($row); $youremail = urlencode($row['youremail']); $name = urlencode($row['name']); $receiveremail = urlencode($row['receiveremail']); $message = $row['message']; // replace non flash line breaks with the flash \r newline $message = str_replace('\n', '\r', $message); $message = str_replace('\r\n', '\r', $message); $message = str_replace('<br>', '\r', $message); $message = str_replace('%0D%0A', '\r', $message); } // if there was a result echo the stuff below if($result) { // if we have a result we can show the movie and pass the vars along in the strings // a set back with this is that you can only pass so much data in the string, think its like 256 characters, but Im not sure. echo "Hello, $name <br />"; echo "$message"; ?> <?php exit(); } mysql_close(); } ?>
  3. thanks for that, its going slightly over my head though... can anyone give me a quick explaination on howd id change that?
  4. thats the code that pulling the data from the database
  5. This was code i did years ago and im re-using it for something im working on, im not really a PHP developer so im just looking for some advice
  6. i created a webpage with a form which submits data to a datbase and also sends a URL to an email address with random ID at the end which will link to specific data from the database when viewed in a browser when i try and pull the data nothing seems to display, heres my code: <?php // since the id is being passed in the url, you will need to declare it using the get method $rand = $_GET['rand']; $action = $_GET['action']; // if an id was sent to the script, then execute it if ($rand) { // connection vars $host = "localhost"; $user = "****"; $password = "****"; $dbname = "****"; $tablename = "cards"; // connect to and select the database @mysql_connect($host,$user,$password) or die("&success=no&"); @mysql_select_db($dbname) or die("&success=no&"); // query the database and return an array of data $result = @mysql_query("SELECT * FROM $tablename WHERE rand = $rand") or die("&success=no&"); // break the array down into the parts you need while($row = mysql_fetch_array($result)){ $youremail = urlencode($row['youremail']); $name = urlencode($row['name']); $receiveremail = urlencode($row['receiveremail']); $message = $row['message']; $message = str_replace('\n', '\r', $message); $message = str_replace('\r\n', '\r', $message); $message = str_replace('<br>', '\r', $message); $message = str_replace('%0D%0A', '\r', $message); } // if there was a result echo the stuff below if($result) { echo "my name is ", $name, " my email address is ",$youremail," " ; ?> <?php exit(); } mysql_close(); } ?> This is how im adding to the databse // insert your data here with $rand as the id $youremail = mysql_real_escape_string($_POST['youremail']); $name = mysql_real_escape_string($_POST['name']); $receiveremail = mysql_real_escape_string($_POST['receiveremail']); $message = mysql_real_escape_string($_POST['message']); $query="INSERT INTO $tablename (rand, youremail, name, receiveremail, message) VALUES ('".$rand."', '".$youremail."', '".$name."', '".$receiveremail."', '".$message."')";
  7. im currently using this code... // connect to and select the database @mysql_connect($host,$user,$password) or die("&success=no&"); @mysql_select_db($dbname) or die("&success=no&"); // query the database and return an array of data $result = @mysql_query("SELECT * FROM $tablename WHERE rand = $rand") or die("&success=no&"); i keep getting told not to use it and to now use PDO instead, can someone please show me exactly how i change the above code to PDO
  8. Currently im pulling all of the data from the database and displaying it on the page but i want to be able to split it up and display it depending on the date. I want to be able to click on the january button for example and it will display all the data stored in the database with a january date. Hopefully someone can help heres my code that im using : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link type="text/css" rel="stylesheet" href="css/master.css" /> <link rel="Stylesheet" type="text/css" href="css/counter.css"></link> <script language="Javascript" type="text/javascript" src="js/jquery-1.4.1.js"></script> <script language="Javascript" type="text/javascript" src="js/jquery.lwtCountdown-1.0.js"></script> <script language="Javascript" type="text/javascript" src="js/misc.js"></script> <title>Untitled Document</title> </head> <body> <div id="container"> <div id="topbar"></div><!-- close topbar --> <div id="main-body"> <div id="toppanel"> <img src="images/can-you-guess-small.png" width="458" height="102" alt="can you guess" /> <br/><br/><br/><br/> <table width="350" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="170" valign="top"> </td> <td width="144" valign="top"><img src="images/share-twitter-small.png" width="116" height="12" alt="share on twitter" style="margin-bottom:5px;"><br/> </td> <td width="36" valign="top"><g:plusone size="medium"></g:plusone></td> </tr> </table> </div><!-- close toppanel --> <div id="leftsection"> <div id="buttons"> <img src="images/check-predictions-header.png" width="291" height="39" style="margin-bottom:5px;" /> <table width="291" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="28" align="left" valign="top"><img src="images/august-2011.png" width="143" height="23" alt="August 2011" /></td> <td height="28" align="right" valign="top"><img src="images/september-2011.png" width="143" height="23" alt="September 2011" /></td> </tr> <tr> <td height="28" align="left" valign="top"><img src="images/october-2011.png" width="143" height="23" alt="October 2011" /></td> <td height="28" align="right" valign="top"><img src="images/november-2011.png" width="143" height="23" alt="November 2011" /></td> </tr> <tr> <td height="28" align="left" valign="top"><img src="images/december-2011.png" width="143" height="23" alt="December 2011" /></td> <td height="28" align="right" valign="top"><img src="images/january-2012.png" width="143" height="23" alt="January 2012" /></td> </tr> <tr> <td height="28" align="left" valign="top"><img src="images/february-2012.png" width="143" height="23" alt="February 2012" /></td> <td height="28" align="right" valign="top"><img src="images/march-2012.png" width="143" height="23" alt="March 2012" /></td> </tr> <tr> <td height="28" align="left" valign="top"><img src="images/april-2012.png" width="143" height="23" alt="April 2012" /></td> <td height="28" align="right" valign="top"><img src="images/may-2012.png" width="143" height="23" alt="May 2012" /></td> </tr> </table> </div><!-- close buttons --> <div id="countdown"> <span class="countheader">Days left of Season 2011 - 2012</span> <!-- Countdown dashboard start --> <div id="countdown_dashboard"> <div class="dash weeks_dash"> <div class="digit">0</div> <div class="digit">0</div> </div> <div class="dash days_dash"> <div class="digit">0</div> <div class="digit">0</div> </div> <div class="dash hours_dash"> <div class="digit">0</div> <div class="digit">0</div> </div> <div class="dash minutes_dash"> <div class="digit">0</div> <div class="digit">0</div> </div> <div class="dash seconds_dash"> <div class="digit">0</div> <div class="digit">0</div> </div> <br/> <table class="counter-text" width="270" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="54">Weeks</td> <td width="54">Days</td> <td width="54">Hours</td> <td width="54">Minutes</td> <td width="54">Seconds</td> </tr> </table> </div> <script language="javascript" type="text/javascript"> jQuery(document).ready(function() { $('#countdown_dashboard').countDown({ targetDate: { 'day': 15, 'month': 6, 'year': 2012, 'hour': 12, 'min': 0, 'sec': 0 } }); $('#email_field').focus(email_focus).blur(email_blur); $('#subscribe_form').bind('submit', function() { return false; }); }); </script> </div><!-- close countdown --> <?php $con = mysql_connect("localhost", "user", "pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); $result = mysql_query("SELECT * FROM tablename"); $num_rows = mysql_num_rows($result); echo "So far only ", $num_rows, " have guessed " ; ?> </div><!-- close leftsection --> <div id="rightsection"> <span class="months">September 2011</span> <br/><br/> <?php $con = mysql_connect("localhost", "user", "pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); $result = mysql_query("SELECT * FROM tablename ORDER BY date"); $num_rows = mysql_num_rows($result); echo "<table border='0' cellspacing='0'>"; while($row = mysql_fetch_array($result)) { $i++; if($i%2==0) $class="cell1"; else $class="cell2"; echo "<tr class='$class'>"; echo "<td>".$row["firstname"]." ".$row["lastname"]." thinks that it will happen on <span class=datecolor>".$row["date"]."</span></td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </div><!-- close rightsection --> <div class="clear"></div> </div><!-- close home --> </div><!-- close container --> </body> </html>
  9. i have a page with a form where people submit their name and a predicted date is there a way i can echo back the date that has be picked the most by the users?? for example if there are more rows in the database with the date of 31/07/11 i would like to echo back so far people think it is going to happen on 31/07/11 how would i write this in php?
  10. thats seems to have worked how would i give a class to the date varible so that i can stlye it differently??
  11. im havin a problem with displaying some text with data from the database the text on my page should display like this example : John Smith thinks that this will happen on Wednesday 14th August 2011 this is the code i have echo "<tr class='$class'>"; echo "<td>" . $row['firstname'] . . $row['firstname'] . "thinks that this will happen on " . $row['date'] . "</td>"; echo "</tr>"; hope you can help
  12. sorry im gettin totally confused now... how do i assign the class instead of the $color1 & $color2 also i tried just adding thr text after the vaiables but it returned an error
  13. ahhhh but what if ive made 2 classes in the css to style the cells? as they should have a border bottom and also padding? also, how would i display the full line of text including varibles in the one cell? in the code i posted it only is 2 varibles posted into 2 cells. I need the full sentence like the images i attached thanks for ur help
×
×
  • 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.