Wintergreen
Members-
Posts
107 -
Joined
-
Last visited
Never
Everything posted by Wintergreen
-
for one, at the very top: <?php instead of <php? Also, echo is not a function that uses () as far as I know, it's echo "This will be printed";
-
Why not just add the merchant code after they've input their code? Let them input ABC123 and whatever other details and submit it, and then just add the prefix right before you insert it to the DB
-
when you end your echo, you need "; not just a period
-
Problem with flat file being read by Flash
Wintergreen replied to m00gzilla's topic in PHP Coding Help
instead of str_replace try ereg_replace("\s+", " ", $string); That should take any tabs, newlines and white space and convert it to a single space -
Obsidian's method looks good
-
Does it matter why he wants to show it?
-
After playing around a bit I've found that for some reason there are elements in the array that are blank after each element that contains a real value, so if I set the for loop to do $i += 2 it seems to work correctly, however if anyone can point out why I'm getting blank array elements I'd be grateful
-
Here's an example pic: [attachment deleted by admin]
-
I have a page where I can post pictures, and in order to have them displayed, all you do is paste the URL, one per line and it will auto turn it into a link using the URL pasted, modifying it for the thumbnail and then putting it into a table. If I post more than one it seems that it posts extra blank pictures in between them, I have no idea what's going on. It turns them into a checker pattern. The <tr> is working correctly after each 7 passes, but for some reason it's putting blank pictures in between the real ones The full code is: [code] <?php session_start(); if( !empty($_POST['posttitle']) && !empty($_POST['bodytext']) && !empty($_SESSION['user_level'])) { include 'db.php'; $posttitle = mysql_real_escape_string(strip_tags($_POST['posttitle'])); $post_body = mysql_real_escape_string(strip_tags($_POST['bodytext'])); $poster = $_SESSION['screenname']; $posttype = $_POST['posttype']; $post_time = date("Y-m-d H:i:s"); /* Formatting pics on pics page */ if(($posttype == 1) && ($_POST['pic_align'])) { if(!empty($_POST['number'])) { $number = $_POST['number']; } else { $number = 7; } $newlines = array("\n", "\r"); $body_text = str_replace($newlines, "|", $_POST['bodytext']); $body_text = explode("|", $body_text); $counter = count($body_text); $new_row = 0; $post_body = "<table>"; for($i = 0; $i < $counter; $i++){ $temp = str_replace(".jpg", "s.jpg", $body_text[$i]); // Auto makes s img url $final_string = "<td><a href=$body_text[$i]><img src=$temp></a></td>"; // Completes each link with TD if($new_row == 0) $post_body .= "<tr>"; $post_body .= $final_string; $new_row++; if($new_row == $number) { $post_body .= "</tr>"; $new_row = 0; } } if($new_row != 0) $post_body .= "</tr>"; $post_body .= "</table>"; } //Enter info into the db mysql_query("INSERT INTO posts (title, post_body, post_time, post_type, poster_name) VALUES('$posttitle','$post_body','$post_time','$posttype','$poster')") or die(mysql_error()); } header("location: index.php"); exit(); ?> [/code] Anyone have a clue what's going on?
-
But if you're grouping by points where != '-1' doesn't that mean it ignores the negatives? My suggestion would be to remake your system a little and have it modify the points directly instead of always adding another row. This way each user has their own row with their total score already calculated
-
If your only choices for points are 1 or -1, couldn't there potentially be hundreds of people with the 'most' points?
-
mysql_result should work
-
www.php.net Useful functions would be strtotime(), date() and mktime()
-
For everything (even gifs I guess if the person is that motivated) they can always just press print screen and resave the picture
-
You can't echo something to be displayed and then use the header function, at least that's what I've found
-
Data won't be saved onto mysql database
Wintergreen replied to bertieboy_93's topic in PHP Coding Help
Use mysql_real_escape_string on the input and it should take care of it. If that makes it start printing extra slashes when you print the input from the DB later, use stripslashes() before you print it. For example $string = mysql_real_escape_string($string); or when you print it, $string = stripslashes($string); -
Data won't be saved onto mysql database
Wintergreen replied to bertieboy_93's topic in PHP Coding Help
Try adding [code] or die(mysql_error());[/code] to the end of your mysql_query line. That way if there's an error it might give a hint as to what went wrong -
When I do like </td> or any closing tag I'll add \n which is newline, and then tab it in a bit with \t So it looks like [code] echo "</td>" . "\n" . "\t\t"; [/code]
-
Just change the wherever.php to the name of the page you want them to go to and that should work
-
I'm not sure why your mail would get marked as junk, but I'm leaning a bit towards there not being a way. If there was a way to not get directly into the inbox every time, it would defeat the purpose of the junk box in the first place. However it is odd that your mail would get flagged
-
Two things with your code, then. What happens if there are more pics than just the first row? Your TRs aren't in any sort of loop. The problem with your code is your if else statement in the loop. You're incrementing the $numcol only in the IF part, but not in the ELSE part, which is what would give you problems. [code] while ($numcol < 5) { if($numpicsleft > 0) { echo "<td width=\"162\" bgcolor=\"#e6e6e6\" valign=\"top\"><p align=\"center\">"; echo "<img border=\"0\" src=\"images/somepic.jpg\" width=\"150\" height=\"113\"><br>"; echo "<span class=\"text1\"><b>some text</b><br>some text<br>some text<br></span>"; echo "</p></td>"; $numpicsleft--; } else { echo "<td width=\"162\"></td>"; } $numcol++; } [/code]
-
Instead of your 'Comment added!' line, do header('location:wherever.php'); That should fix it
-
The problem with that is that anyone can change anyone else's password just by knowing their e-mail address
-
if($numcol != 0) { $temp = $numpics % 4; $left = 4 - $temp; for($i = 0; $i < $left; $i++) { echo "<td></td>"; } echo "</tr>"; } Replace the last part with this.