Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Yes setting the forth parameter to true will always yield a new connection.
  2. if this is done while the user is typing their first/surename you wont be able to do this with PHP. You'll have to use javascript for this.
  3. The way you have coded it is wrong. Your HTML needs to be wrapped in quotes you cant do $var = <html><bah><?php echo $foo; ?></blah><html> It needs to be like $var = "<html><bah>$foo</blah><html>" However if you have lot of HTML you can use the HEREDOC sytax $var = <<<HTML <html><bah>$foo</blah><html> HTML;
  4. You'll need to post more code than that. The problem resides somewhere else in your script
  5. What text editor are using to create your .php script? You should use a plain text editor such as Notepad. Also make sure you are saving the file as ASCII encoding
  6. No I meant echo the $sql variable. That way we know how your query is being constructed once the variables witihn your query have been parsed. echo $sql;
  7. What does the query look like when you echo it before running mysql_query.
  8. The for loop within your while loop is causing the duplicate results. How your while loop should be: // initiate counter $i = 0; while($row = mysql_fetch_array($result)) { // alternete row color $bgcolor= ($i%2 == 0) ? '#adc5c8' : '#eeeeee'; echo "<tr bgcolor=$bgcolor>"; echo "<td>" . $row['event'] . "</td>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['minutes'] . "</td>"; echo "<td>" . "<a href=\"{$row['pdf']}\">Download</a>" . "</td>"; echo "</tr>"; // increment counter $i++; }
  9. String value should always be wrapped within quotes.
  10. Yes everytime you refresh the page mysql_connect will be called. However mysql_connect will not establish a new connection if there is an existing one.
  11. Adding a variable within php tags will not result in anything. If you want to print the contents of the variable to the screen you need to echo it <td> <?php echo $firstname ?> </td> This has nothing to do with PHP. This is handled by your shopping cart script.
  12. Yeah I have made mistake in that code Change $online[] to $onlineUsers[] and then change implode(',', $online) to implode(',', $onlineUsers) Should sort the error out.
  13. For looping through mysql results use a while loop rather than a for loop $online = mysql_query("SELECT username FROM online") or die(mysql_error()); if(mysql_num_rows($online) > 0) { while($row = mysql_fetch_assoc($online)) { $online[] = '<A href="member_profile.php?username='.$row['username'].'">'.$row['username'].'</a>'; } echo '<tr class="mainrow"><td>Currently active: ' . implode(',', $online) . '</td></tr>'; } else { echo '<tr class="mainrow"><td>There are currently no users logged in</td></tr>'; } echo '</table>';
  14. Your <option></option> tags need to be within your while loop, while ($crow = mysql_fetch_array ($cresult)) { $category = $crow['category']; echo "<option>$category</option>"; } Only the <select></select> tags need to be outside of your loop
  15. The error is caused be cause on line 2 in lose2.php you have some form of output. Make sure you don't have anything before your opening php tag (<?php)
  16. The setting is called short_open_tag However you should use full PHP tags. This way your code will much more portable.
  17. You could run a SELECT DISTINCT query.
  18. You can name your checkboxes as name[] that way when the form is submitted all checkbox values will be held within the $_GET['name'] array
  19. use nl2br
  20. $str should be $str[$i]
  21. If all you're doing is echo'ing a variable quotes are not necessary
  22. Don't forget you will need to define a width for your div aswell in order for auto margins to work.
  23. echo "<td>$CallNumber</td>";
  24. Maybe easier to use a definition list
  25. No. You don't need to specify the query string within your rewriteRule. All you need to do is specify the bits you're rewriting. So if you url is like this: example.com/bar/bar2/?foo3=bar3&foo4=bar4 You just need to setup your rewriteRule to match the bits highlighted above. Which is what the following rewriteRule does. RewriteRule ^(.*)/(.*)/ index.php?foo=$1&foo2=$2 [L,QSA] I have tested this and it works fine for me.
×
×
  • 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.