wmguk Posted August 20, 2007 Share Posted August 20, 2007 I get a blank page so it must be a bad php code, however im looking at it and just cant see it? while($row = mysql_fetch_array($result)) { $email = $row['email']; $groom_firstname = $row['groom_firstname']; $groom_surname = $row['groom_surname']; $bride_firstname = $row['bride_firstname']; $bride_surname = $row['bride_surname']; if ($groom_firstname == 'X') { $title = "$row['bride_firstname'] . ' ' . $row['bride_surname']"; } else { $title = "$row['bride_firstname'] . ' ' . $row['bride_surname'] . ' and ' . $row['groom_firstname'] . ' ' . $row['groom_surname']"; Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/ Share on other sites More sharing options...
chocopi Posted August 20, 2007 Share Posted August 20, 2007 You gonna need to post more code, and can you please post the error message you recieve, Thanks ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328746 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 hey, i dont get any error at all, just a blank white page. <?php $login = $_GET['login']; //Make Connection include "scripts/connection.php"; if (!$con) { die( 'Could not connect: ' . mysql_error() ); } mysql_select_db($db, $con); $result = mysql_query("SELECT * FROM album WHERE login = '$login'"); while($row = mysql_fetch_array($result)) { $email = $row['email']; $groom_firstname = $row['groom_firstname']; $groom_surname = $row['groom_surname']; $bride_firstname = $row['bride_firstname']; $bride_surname = $row['bride_surname']; if ($groom_firstname == 'X') { $title = "$row['bride_firstname'] . ' ' . $row['bride_surname']"; } else { $title = "$row['bride_firstname'] . ' ' . $row['bride_surname'] . ' and ' . $row['groom_firstname'] . ' ' . $row['groom_surname']"; ?> you can then <?php echo $title ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328749 Share on other sites More sharing options...
chocopi Posted August 20, 2007 Share Posted August 20, 2007 1. well you should get errors with that code seeing as you are missing to curly braces at the end, so im assuming this isnt the whole code. 2. Are you sure that $_GET['login'] actually equals anything, in which case your query and while loop would both not function. 3. why do you set $row['bride_firstname'] to $bride_firstname yet you still use $row['bride_firstname']. This isnt wrong it just seems pointless ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328752 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 ok, now have this: <?php $login = $_GET['login']; //Make Connection include "scripts/connection.php"; if (!$con) { die( 'Could not connect: ' . mysql_error() ); } mysql_select_db($db, $con); $result = mysql_query("SELECT * FROM album WHERE login = '$login'"); while($row = mysql_fetch_array($result)) { $email = $row['email']; $groom_firstname = $row['groom_firstname']; $groom_surname = $row['groom_surname']; $bride_firstname = $row['bride_firstname']; $bride_surname = $row['bride_surname']; if ($groom_firstname == 'X') { $title = "'$bride_firstname' '$bride_surname'"; } else { $title = "'$bride_firstname' '$bride_surname' and '$groom_firstname' '$groom_surname'"; ?><html><link href="http://demo.iwphoto.co.uk/styles.css" rel="stylesheet" type="text/css" /> <?php $mime_boundary = "IW Photo".md5(time()); # -=-=-=- MAIL HEADERS $to = "$email"; $subject = "Your album is now live"; $headers = "From: Imagine Wedding Photography <info@iwphoto.co.uk>\n"; $headers .= "Reply-To: Imagine Wedding Photography <info@iwphoto.co.uk>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n"; # -=-=-=- HTML EMAIL PART $message .= "--$mime_boundary\n"; $message .= "Content-Type: text/html; charset=UTF-8\n"; $message .= "Content-Transfer-Encoding: 8bit\n\n"; $message .= "<html>\n"; $message .= "<body style=\"font-family:Verdana, Verdana, Geneva, sans-serif; font-size:14px; color:#666666;\">\n"; $message .= "<table width='800' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td height='80' align='left' valign='top' background='http://demo.iwphoto.co.uk/images/top.jpg'><p> </p></td></tr><tr><td align='left' valign='top' background='http://demo.iwphoto.co.uk/images/middle.jpg'>"; $message .= "<table width='800' border='0' cellspacing='0' cellpadding='0'><tr><td width='20'> </td>"; $message .= "<td class='main'><p>Dear "; $message .= "<p>Dear $title,"; $message .= "<p>We are please to announce that your album has been made live now.</p>"; $message .= "<p>Please click <a href='http://demo.iwphoto.co.uk/emailgallery.php?login=$login'>HERE</a> to view your album. </p>"; $message .= "<p>You can also now tell all your family and friends about your new album by clicking HERE. </p></td><td width='20'> </td></tr></table></td></tr>"; $message .= "<tr><td align='left' valign='top' background='http://demo.iwphoto.co.uk/images/bottom.jpg'> </td></tr></table>"; $message .= "</body>\n"; $message .= "</html>\n"; # -=-=-=- FINAL BOUNDARY $message .= "--$mime_boundary--\n\n"; # -=-=-=- SEND MAIL $mail_sent = @mail( $to, $subject, $message, $headers ); echo $mail_sent ? "Mail sent" : "Mail failed"; echo $to ; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328757 Share on other sites More sharing options...
itsmeArry Posted August 20, 2007 Share Posted August 20, 2007 try replacing your if and else with this if ($groom_firstname == 'X') { $title = $row['bride_firstname'] . ' ' . $row['bride_surname']; } else { $title = $row['bride_firstname'] . ' ' . $row['bride_surname'] . ' and ' . $row['groom_firstname'] . ' ' . $row['groom_surname']; Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328759 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 try replacing your if and else with this if ($groom_firstname == 'X') { $title = $row['bride_firstname'] . ' ' . $row['bride_surname']; } else { $title = $row['bride_firstname'] . ' ' . $row['bride_surname'] . ' and ' . $row['groom_firstname'] . ' ' . $row['groom_surname']; nope, still nothing, just a white page - it must be a php coding error, i know the login variable is being passed through it... Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328761 Share on other sites More sharing options...
chocopi Posted August 20, 2007 Share Posted August 20, 2007 From what I can see you still havent closed your while loop, but if its not giving an error ??? then i guess it does not matter. Can you echo $login to make sure it has a value: $login = $_GET['login']; echo $login; Also, can you add or die(mysql_error()); After you query ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328762 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 From what I can see you still havent closed your while loop, but if its not giving an error ??? then i guess it does not matter. Can you echo $login to make sure it has a value: $login = $_GET['login']; echo $login; Also, can you add or die(mysql_error()); After you query ~ Chocopi the $login is working, basically I am going to the script via "http://www.website.co.uk/email.php?login=demo" and added the or die, but still white Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328766 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 From what I can see you still havent closed your while loop, but if its not giving an error ??? then i guess it does not matter. ~ Chocopi also, right at the bottom of the original script there is the last while closer.. is that the right place, its after the email gets sent Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328767 Share on other sites More sharing options...
chocopi Posted August 20, 2007 Share Posted August 20, 2007 can you replace while($row = mysql_fetch_array($result)) with while($row = mysql_fetch_assoc($result)) As on my browser mysql_fetch_array doesnt actually work, so it might be the same for you ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328768 Share on other sites More sharing options...
chocopi Posted August 20, 2007 Share Posted August 20, 2007 also, right at the bottom of the original script there is the last while closer. isnt that the one that closes this else statement <?php if ($groom_firstname == 'X') { $title = "'$bride_firstname' '$bride_surname'"; } else { // this one is the one closed at the bottom of the page $title = "'$bride_firstname' '$bride_surname' and '$groom_firstname' '$groom_surname'"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328769 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 ah ha, got it - you were right, i was missing the } if ($groom_firstname == 'X') { $title = $row['bride_firstname'] . ' ' . $row['bride_surname']; } else { $title = $row['bride_firstname'] . ' ' . $row['bride_surname'] . ' and ' . $row['groom_firstname'] . ' ' . $row['groom_surname']; } // This one was missing, its now working woo hoo, just need to get the page background to go grey now thank you guys ! Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328770 Share on other sites More sharing options...
chocopi Posted August 20, 2007 Share Posted August 20, 2007 Bizarre, I guess you have error_reporting turned off, oh well im glad you were able to fix it ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/65803-solved-daft-error-varible-error/#findComment-328774 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.