Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. You never defined $row. <?php //Start session session_start(); //Connect to mysql server $link=mysql_connect("localhost","###","###"); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db=mysql_select_db("bbmembers"); if(!$db) { die("Unable to select database"); } $userid = $_SESSION['SESS_MEMBER_ID']; $qry="SELECT * FROM members WHERE id='$userid'"; $result=mysql_query($qry); if (mysql_num_rows($result) > 0){ $row = mysql_fetch_assoc($result); echo $row['firstname']; } else { echo "No results found in the DB"; } ?>
  2. <?php $userID = $_SESSION['ID']; $query = "SELECT * FROM table WHERE userID='$userID'"; $result = mysql_query($query); ?> To echo the ID, you would just do this. echo $_SESSION['ID'];
  3. Try mysql_fetch_assoc() instead of array. Show the code to your drop-down.
  4. Are there any files included? The function could possibly be in one of those files. When you take out: echo password('$password'); Do you get an error in the code, or does it work fine?
  5. <?php if (isset($_POST['submit'])){ //check if they put yes to pepsi if (isset($_POST['y_pepsi'])){ //update DB to '1' } } ?> <form> Do you like Pepsie? <input type="checkbox" name="y_pepsi"> Yes <input type="checkbox" name="n_pepsi"> No <p> <input type="submit" name="submit"> </form> Is that what your looking for?
  6. What do you mean "nothing". Is there at least a text box showing up? Or is the text box not showing the $value variable, if not then your variables don't hold a value.
  7. I don't see how it's possible not to mix the two. The HTML is for formatting, and the PHP is for the sites function. If you have to organize your data that comes from PHP into a table, what are you going to do, include a file that opens your table, then include another file that closes it? It wouldn't make sense not to mix them. You could have a PHP class that calls the HTML, then whenever you want to edit the HTML you just go into the class and edit it.
  8. You just check if the query returned any results. <?php if (mysql_num_rows($query) < 1){ echo "Sorry we have no record"; } else { //code to display record data goes here } ?>
  9. echo "<tr><td>$field:</td><td><input type='text' field='$value' value='$value' /></td></tr>";
  10. PHPfreaks has a tutorial on this, and there are plenty out there if you google it. http://www.phpfreaks.com/tutorials/73/0.php
  11. Post the code you have, also tell us what type of DB field is it?
  12. Are you sure your typing the correct path in the address bar? Give us he exact path to your script, then tell us what your putting in the address bar.
  13. Well, are you wanting the page to reload without having to refresh the browser? If that is what your after, your going to need AJAX or JavaScript. If it doesn't matter if the page has to refresh, then the method I supplied should work fine.
  14. Sounds like your on the right path. $thisimage = $_GET['imagenumber'] should be placed above the line where you display the image, as long as you have that, you should be good. Yes, because it will know what array value to pull by taking it from the URL. <?php $images = array("1.jpg", "2.jpg", "3.gif"); $thisimage = (isset($_GET['imagenumber']) ? $_GET['imagenumber'] : 0; echo "<img src='".$images[$thisimage]."'>"; ?>
  15. Are the people voting required to be logged into an account? If so, that would make this whole thing easier. If they don't need to be logged in, then you might have some issues with this. You could log IP addresses, but some people have the same one, plus they are always changing...so that wouldn't work very well.
  16. Your going to have to explain better than that.
  17. http://php.net/strstr http://www.php.net/manual/en/function.strpos.php http://www.php.net/manual/en/function.strrchr.php Those are all string searching functions.
  18. <?php if (eregi('Y', $setts['enable_cat_counters'])) echo ($catBrowse['items_counter']!=0)."(".$catBrowse['items_counter']."".$catBrowse['items_counter'].")"; ?>
  19. echo ($catBrowse['items_counter']!=0)."(".$catBrowse['items_counter'].")".$catBrowse['items_counter'].")";
  20. Whats the ":" in the middle for? If your trying to display that, you need to have it between the quotes. Try this: ".$catBrowse['items_counter'].")".$catBrowse['items_counter'].")"; If thats not right, give an example of what you want the display to look like. Also, show the rest of the code that goes along with that.
  21. Are you sure you don't have another loop surrounding the while loop? Why do you have all those continues in there? It should do just fine without them. I tested your code on my server, just replaced everything with my DB information and it worked fine.
  22. <?php $query = "SELECT date, description, user_id, ip_addr, data_id FROM table"; $result = mysql_query($query)or die(mysql_error()); while ($row = mysql_fetch_assoc($result)){ echo $row['date'].'<br>'; echo $row['ip_addr'].'<br>'; echo $row['description'].'<p>'; } ?> That will display the data like you listed above. You might have to format your date/time how you want it, I'm not sure how you have that stored in the DB.
  23. I guess I can just do this: $error = array_merge($error, $user->error); Thanks for the 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.