Jump to content

LiLaaron

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

LiLaaron's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Just wondering if someone could help me with this, i want to add 2 options. Sort Username by ascending or descending in alphabetical order, So if its ascending it would show A's First or descending it would should Z's First. Sort Points by ascending or descending in numerical order, So if its ascending it would show points with 0 First or descending it would should points XXXX First. I would like the options to be a selection box, with no submit button, so it would be onChange="document.formid.submit() in the select tag. Heres my code so far, [code] <BR> <font color='FFFFFF' size='-1' face='Tahoma'><strong>List Users</strong></font><BR> <font color='FFFFFF' size='-2' face='Tahoma'><strong>All Current Users Registered</strong></font><BR> <hr color="#FFFFFF" align="left" width="80%"> <table width="50%" border="0">   <tr>     <td> <? $sql ="SELECT * FROM bb_users"; $result = @mysql_query($sql,$connection) or die(mysql_error()); while ($sql = mysql_fetch_object($result)) {     $points = $sql -> user_points;     $username = $sql -> username;     $email = $sql -> user_email;     ?> <table width="100%" border="0">   <tr>     <td width="50%" align="right"><font color='FFFFFF' size='-1' face='Tahoma'><strong>Username: </strong></font></td>     <td width="50%" align="left"><font color='FFFFFF' size='-1' face='Tahoma'><strong><? echo $username; ?></strong></font></td>     </tr><tr>     <td width="50%" align="right"><font color='FFFFFF' size='-1' face='Tahoma'><strong>Email Address: </strong></font></td>     <td width="50%" align="left"><font color='FFFFFF' size='-1' face='Tahoma'><strong><? echo $email; ?></strong></font></td>     </tr><tr>     <td width="50%" align="right"><font color='FFFFFF' size='-1' face='Tahoma'><strong>Points: </strong></font></td>     <td width="50%" align="left"><font color='FFFFFF' size='-1' face='Tahoma'><strong><? echo $points; ?></strong></font></td>   </tr> </table> <br>     <? } ?>     </td>   </tr> </table> [/code] Thanks for any help Aaron
  2. Hi, I have been building a registion form and i am near complete! but i am having a probelm with the data adding to the database correctly. First my code: [code]             $sql ="SELECT (MAX(`user_id`) + 1) FROM bb_users";             $row = mysql_query($sql,$connection) or die(mysql_error());             $user_id = $row;             $username = $_POST['username'];             $email = $_POST['email'];             $new_password = $_POST['new_password'];             $website = $_POST['website'];             $occupation = $_POST['occupation'];             $location = $_POST['location'];             $interests = $_POST['interests'];             $yim = $_POST['yim'];             $msn = $_POST['msn'];             $results = mysql_query("INSERT INTO bb_users (user_id, username, user_password, user_email, user_website, user_occ, user_from, user_interests, user_yim, user_msnm)                 VALUES ('$user_id', '".$username."', '".MD5('$new_password')."', '$email', '$website', '$occupation', '$location', '$interests', '$yim', '$msn')", $connection) or die(mysql_error());             $results1 = mysql_query("INSERT INTO bb_groups (group_name, group_description, group_single_user, group_moderator)                 VALUES ('', 'Personal User', 1, 0)", $connection) or die(mysql_error());             $sql ="SELECT MAX(group_id) AS gtotal FROM bb_user_group";             $grow = mysql_query($sql,$connection) or die(mysql_error());             $group_id = $grow['gtotal'] + 1;             $results2 = mysql_query("INSERT INTO bb_user_group  (user_id, group_id, user_pending)                 VALUES ($user_id, $group_id, 0)", $connection) or die(mysql_error());             echo "Congrats, Registration is Complete.<BR><BR>You May Now Login!"; [/code] This section here: [code] $sql ="SELECT (MAX(`user_id`) + 1) FROM bb_users";             $row = mysql_query($sql,$connection) or die(mysql_error());             $user_id = $row; [/code] Its surposed to add up all the rows in the table then add 1 too it, so then this become the user_id. But what i am getting is, you add it once and when you want to add another user, i get duplicate key. The stranges thing ever tho, [code] $sql ="SELECT MAX(group_id) AS gtotal FROM bb_user_group";             $grow = mysql_query($sql,$connection) or die(mysql_error());             $group_id = $grow['gtotal'] + 1; [/code] This works fine! but when i try and do the same with the user_id i just get the same error, add 1, next is a duplicate key. my registration is also for phpbb, my registration should be, you only register on the site, as the user wont have access to it, unless i give them permission, i got that working fine, but i just cant get this thing out of the way. Another thing, when that 1 user is registered, on the forum whos online, it doesnt update with the newest member, it should do it automatically when the new user registers, yet its not a phpbb problem due to if you register there it works. Really hope someone can help me finish this. Thanks Aaron
  3. Hi There! I am basically trying to get the value of the array only and make it a variable. First my Code: [code] <? $text = file_get_contents("../ez_sql.php"); preg_match_all('/define\s*\(([^,]+),([^\)]+)\)/i', $text, $matches); foreach($matches[1] as $key => $value) {    $value = trim(trim($value), '\'"');    $data[$value] = trim(trim($matches[2][$key]), '\'"'); } // show results: foreach($data as $key => $value) {   echo "<p>Key: $key, Value: $value !</p>\n"; } ?> [/code] This will show me 18 different defines ($keys) what i need is the first 5 values as variables so it may look like this: [code] $username = $value[1]; $password = $value[2]; $dbname = $value[3]; $server = $value[4]; $prefix = $value[5]; [/code] i would then do what i need to do with them, just i am finding it hard to make the value a variable. Thanks Aaron
  4. this may help [a href=\"http://us3.php.net/highlight_string\" target=\"_blank\"]http://us3.php.net/highlight_string[/a] Aaron
  5. Hi, [code] <?php if ($_SERVER['SERVER_ADDR'] == "216.40.250.54") {     echo "<strong>Not Found</strong>"; } else {     echo "<strong>We Got It!</strong>"; } ?> [/code] That should do it Aaron
×
×
  • 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.