Jump to content

Ken2k7

Members
  • Posts

    5,196
  • Joined

  • Last visited

    Never

Everything posted by Ken2k7

  1. How about creating the table like this: <?php mysql_query("CREATE TABLE memberID (realName varchar(255), IDname varchar(255), IDnum mediumint()"); ?> Then you can just loop through there and see if the name John Doe exists: <?php $name = "John Doe"; $idNum = 1; $sql = mysql_query("SELECT * FROM memberID") or die(mysql_error()); while ($row = mysql_fetch_assoc($sql)) if ($row['realName'] == $name) if ($row['IDnum'] > $idNum) $idNum = $row['IDnum']; // at the end, $idNum will have the next available ID number.
  2. Yes, that helps tremendously, thank you! I just didn't know how to make the links. Do I really need the ampersand (&) in the <a href>?
  3. Well I haven't done much of the code since I'm already stuck at the link part of it. But I'll give you a general look without the real links: <table width='100%' border='0'> <tr> <td width='30%'> <a href='_link_here'>Profile Edit</a> <a href='_link_here'>Reports</a> </td> <td width='70%'> // contents displayed upon link </td> </tr> </table> I know there aren't any php there but that's because I don't even know how to use php and get that to work. That's just an example. It's not the real thing, but if you can help me on that one, I can do the rest. I just need to know what link to put in the <a> tag and how it will be used to get the contents onto the other <td> tag.
  4. No, the links, I would put them in myself, but the contents are mostly received from the database. Sorry for the late reply. It's like a forum's usercp. The left panel contains the links and the right side contains the contents where you can edit.
  5. I'm talking about the HTML table, not the database table. Unless you did get me, which in that case, I apologize. And if so, I don't even understand what you said.
  6. Okay, this is pretty much a newbie question but say I have the url - http://blah.com/usercp.php? - and in that page, I have a table with 2 columns - one for navigation and the other for content - like the usercp of a forum. How do you php code it such that when a link is clicked, the content on the second column changes? Thanks in advance.
  7. No, you have to put session_start(); as the first PHP line. Also, I'm not sure about $result2 = mysql_fetch_array($result); Normally people use that as a loop. In your case, I'm not sure what's it for.
  8. <?php if (isset($_GET['id'])) mysql_query("DELETE FROM purchase WHERE sale_id = '{$_GET['id']}'") or die(mysql_error()); ?>
  9. The variable $type doesn't contain anything in that code. <?php $sql = "UPDATE table SET column_name=value WHERE column_name=admin/user"; mysql_query($sql) or die(mysql_error()); ?>
  10. How's this method? <?php $filter = array('onmouseout', 'onmouseover', 'onclick', 'ondblclick', 'onkeydown', 'onkeypress', 'onkeyup', 'onmousemove', 'onmouseup', 'onmousedown' ); $replace = ""; $string = "onMouseOut"; for ($i=0; $i < sizeof($filter); $i++) if (strtolower($string) == $filter[$i]) $string = $replace; ?>
  11. Oh, I see. But it's ridiculous to make a lot of if statements. Would this work on inserting values if the field is not empty? I'm not sure if php can use void functions since this one, if it works, doesn't return anything. <?php function all_empty_post() { $empty = true; foreach ($_POST as $v) if (!empty($v)) { mysql_query("INSERT INTO tableName ($v) VALUES ($_POST[$v])") or die(mysql_error()); $empty = false; } return $empty; } if (all_empty_post()) { echo "no fields where filled in"; } ?>
  12. Oh no, I know how to make a function, I just don't know what parameter I would give this one, if any that is.
  13. OH...I see. Thanks so much. Say, is there a way to make that a function so I don't have to type that over and over everytime?
  14. Say I have a form, a really long form, is there a way to check if all the fields in the form are empty without saying a million if statements?
  15. Perfect! MadTechie, you're the best!
  16. Ah, I see. Thanks. My last question will be is there a way php can get the URL of the page without me typing '%www.\.blah\.com etc?
  17. Thanks for the quick reply, MadTechie. Uh, just a few questions on that. 1. What's $regs? 2. Can this not be a conditional statement?
  18. That's oddly specific. I'm guessing there's nothing in the id column.
  19. Is there a way to get the URL of a page without actually typing it out and then store that in a variable $url? If so, how can I strip the URL? For example: say the URL is: www.blah.com/ken2k7/page1.php Say I want to get the ken2k7 part and store that into a variable $user, how would I do that? And the URL won't always be that, it can be www.blah.com/newuser/page2.php I just need an efficient way to get the name. Thanks in advance.
  20. Just 1 please. For example: I store the person's name into the database when they register but then I want to display that person's ID# when they log in. But I don't know how to pull just that one entry directly out of the database.
  21. Say I have a database with a table named members with columns - id, member name, age etc.. Is there a way I can get the member name from the table members and store it in a variable $name without looping?
×
×
  • 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.