
MatthewJ
Members-
Posts
803 -
Joined
-
Last visited
Never
Everything posted by MatthewJ
-
Um... no, he was stating that the whole row was printing when he only wanted the first fields data. Exactly why I suggested mysql_fetch_array as it returns an array accessible by numeric key.
-
mysql_fetch_row... I think you mean mysql_fetch_array()?
-
You can populate a mailto link... but I'm not sure why you would want to... it sounds like this is going to a single person to check for invitations being submitted? If so, then why not just tell outlook it isn't junk and move on? If that isn't an option, check that you are setting a From header. If it is omitted, it will send the email as the [email protected] etc.
-
How to text-indent with carriage returns
MatthewJ replied to floridaflatlander's topic in PHP Coding Help
Well, then they have to be separate paragraphs... again, text-indent indents the first line of a pragraph -
How to text-indent with carriage returns
MatthewJ replied to floridaflatlander's topic in PHP Coding Help
You use a margin or padding... text indent is supposed to do exactly what you're saying (indent the first line of the text like proper paragraph formatting calls for). In order to achieve what you're looking for, I would think you just need to split them into multiple paragraphs. -
changing every other row bg color in while loop.
MatthewJ replied to seany123's topic in PHP Coding Help
$counter = 0; echo "<table>" do { $bgclass = ($counter % 2 == 0) ? 'color1' : 'color2'; //echo row and set the class equal to $bgclass echo "<tr class='$bgclass'><td>" . $row['databasefield'] . "</td></tr>"; $counter++; } while ($row = mysql_fetch_assoc()); echo "</table>"; Something like that maybe? -
Also, I would try the From: header as the email address only and remove it from the < > like the manual example.
-
I had the same problem on a host a year or so ago... if I recall, I got it fixed by adding the php-version header to the mail headers. Almost like if it didn't know what php version was sending the mail, it defaulted. Example from the PHP manual <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Maybe that will help?
-
You can get decent hosting for < $5 a month... it may be time to just bite the bullet.
-
You just need to get the contents of that file into a variable, and use the same content-header method to display it for print/save.
-
http://www.freeopenbook.com/php-hacks/phphks-CHP-5-SECT-16.html
-
With the image tag?
-
if (isset($_POST["name"]) && $_POST["name"] != "") { //Do whatever } else { echo "Error!"; }
-
Well, put them into an array and return the array Almost anything is better than setting them as global.
-
Well, and to actually answer the question you asked... in this situation you could do something like <?php function function_1() { $variable_1 = "hello world"; return $variable_1; } function function_2($output) { echo $output; } $var1 = function_1(); // This will make $var1 equal to the value returned from function_1 function_2($var1); //This will "pass" the variable that now contains the result of function_1 to function_2 to be displayed ?> Hope that helps
-
Use full open tags.. it will save you from headaches down the road. <?php } ?>
-
Hmm, maybe put in a $_SESSION var a flag that video 1 has already been viewed... refresh the page, check for the flag, and display the appropriate vid based on the flag?
-
It depends on how you mean... If you're looking to show a video randomly, sure, just put the video links into an array and pick a random element from it for linking in. If you want someone to see the first video until they have watched it, but then they only see the next video, etc. then you could set a cookie on their system with the id or name of the last vid they watched. Check that cookie when they get back, and load the next video instead.
-
http://www.html-form-guide.com/php-form/php-form-submit.html
-
if(time() <= strtotime("4/8/2011")) { echo "It is before 4/8/2011"; } else { echo "It is after 4/8/2011"; }
-
Post the source code of the parsed page... And use code tags
-
<html> <head> <title>Page Title</title> <style> .gray { backgroundcolor: gray; } .white { backgroundcolor: white; } </style> </head> <body> <?php $connection = mysql_connect("localhost", "username", "password"); mysql_select_db("articles", $connection); $query="SELECT * FROM articles WHERE id=1"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?> <table border="1" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">Article</font></th> <th><font face="Arial, Helvetica, sans-serif">Year</font></th> <th><font face="Arial, Helvetica, sans-serif">Description</font></th> <th><font face="Arial, Helvetica, sans-serif">Location</font></th> </tr> <?php $i=0; while ($i < $num) { $backgroundclass = (($i % 2) == 0) ? 'gray' : 'white'; $f1=mysql_result($result,$i,"article"); $f2=mysql_result($result,$i,"year"); $f3=mysql_result($result,$i,"description"); $f4=mysql_result($result,$i,"location"); $f5=mysql_result($result,$i,"link") ?> <tr class='<?php echo $backgroundclass ?>'> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td ><font face="Arial, Helvetica, sans-serif"><?php echo "<a href=\"$f5\" target=\"_blank\">$f4</a>"; ?></font></td> </tr> <tr> </tr> <?php $i++; } ?> </body> </html>
-
You could do something like <?php $i=0; while ($i < $num) { $backgroundclass = (($i % 2) == 0) ? 'gray' : 'white'; $f1=mysql_result($result,$i,"article"); $f2=mysql_result($result,$i,"year"); $f3=mysql_result($result,$i,"description"); $f4=mysql_result($result,$i,"location"); $f5=mysql_result($result,$i,"link") ?> <tr class='<?php echo $backgroundclass ?>'> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td ><font face="Arial, Helvetica, sans-serif"><?php echo "<a href=\"$f5\" target=\"_blank\">$f4</a>"; ?></font></td> </tr> <tr> </tr> Then just create css classes called gray and white and have them set the color appropriately.