Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Change if ( $QUESTIONS['ch.$count'] == "Question" ) { to if ( $QUESTIONS['ch'.$count] == "Question" ) {
  2. <?php $sql = "SELECT * FROM suns WHERE main_cat = '$catid'"; $res = mysql_query($sql); while($row = mysql_fetch_assoc($res)){ $subid[] = $row['id']; $subname[] = $row['name']; /* for($i = 0; $i < count($words); $i++){ echo "<span class='small-links'>"; echo "$subname[$i]"; echo "</span>"; } }*/ $words = implode(", ", $subname); echo $words; // this will list "cat1, cat2, cat3" ?>
  3. Did you read the link: To extend your explanation, yes XOR is the same as ^.... but ^ is on the bitwise level, whereas XOR is a normal logical operator for any non-bitwise comparisons. Bitwise: echo "hallo" ^ "hello"; // Outputs the ascii values #0 #4 #0 #0 #0 // 'a' ^ 'e' = #4 Comparison, normal use: if(!$var XOR !$var2) { // if one is false and other is not false, but not both
  4. Sessions aren't the answer to everything. As much as you may think so, they aren't. You could use file_get_contents(), perform the search & add in values, then file_put_contents(). Search for $db_name, $db_user, $db_pass, $db_table etc... If the values exist -change the values to the ones you want to set. Otherwise (if they messed with the file before hand) -insert them in
  5. Should be pretty simple: <?php include("class.xml.parser.php"); include("class.weather.php"); $weather_chile = new weather("CIXX0020", 3600, "C"); // LocationCode, seconds of cache lifetime, TempUnit (F or C) $weather_chile->parsecached(); ?> Change "CIXX0020" to whatever city code you need (find that on Yahoo), and then if you want it in Fahrenheit, change the "C" to "F"
  6. Take a look at mysql's lock tables
  7. echo out $query, and see what it says, and change: $result = mysql_query($query); $result = mysql_query($query) or die(mysql_error());
  8. As the error states: Call to undefined function dircopy... you're missing the underscore, '_'. However, looking through the code, and seeing there is no line 60 in the one you provided.... is there somewhere else where you tried to call the function?
  9. Update: http://ilovejackdaniels.com/cheat-sheets/ moved to http://addedbytes.com/cheat-sheets/ (Gotta love them trademark teams )
  10. That space before it will throw it off. Besides trimming the space, which could lead to problems when you want the space at the beginning (not very often... but it could happen), look into where you're setting your array at. See what could be causing a space to appear there.
  11. Yeah, that's more of a band aid fix though. Let's say you start banning more people, and the list is long, you won't need the <br />'s. .twoColHybLt #sidebar1 { float: left; width: 12em; /* since this element is floated, a width must be given */ background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */ padding: 15px 0; /* top and bottom padding create visual space within this div */ } I want to say, if you change it to the following it should be fixed: .twoColHybLt #sidebar1 { float: left; display: block; /* added this, to make it fit inside the block, instead of overflowing */ width: 12em; /* since this element is floated, a width must be given */ background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */ padding: 15px 0; /* top and bottom padding create visual space within this div */ }
  12. @premiso- http://img211.imageshack.us/img211/8271/originaltj0.jpg and http://img259.imageshack.us/img259/8615/wrongbs5.jpg @OP - I think this is more of a CSS question. Since the box on the left is taller, and it is essentially overflowing. Try adding in .twoColHybLt #sidebar1 display: block;
  13. <?php $test1 = $songsalt[4]; $query = "SELECT * FROM `songs` WHERE `songtitle`='$test1'"; echo $query; // does this output correctly? $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo $row['songID']; } ?>
  14. Something like: <?php // ... code up here for mysql // What Id? $id_to_find = '75'; // set counter $i = 0; while($row = mysql_fetch_assoc($resource)) { if($row['id'] == $id_to_find) { // do some stuff break; } $i++; } echo $i; // row number // OR.... // this should work too... // set id to find $id_to_find = '75'; // set counter $rownum = 0; // run loop for(;$row = mysql_fetch_assoc($resource) && $row['id'] != $id_to_find; $rownum) { } echo $rownum; // row number ?> I think that should work, I'm pretty drowsy from work, so I apologize if it doesn't. In my head it works.
  15. You're trying to run the query twice: $sql2=mysql_query("delete FROM specific_prompts where id='".$del['id']."'"); $res=mysql_query($sql2)or die (mysql_error()); Change it to: $sql2="DELETE FROM specific_prompts WHERE id='".$del['id']."'"; $res=mysql_query($sql2)or die (mysql_error());
  16. Change: if(!is_array($_GET['referral'])) to: if(isset($_GET['referral']) && !empty($_GET['referral']))
  17. you could always do something like usleep(1), which would "pause" execution for 1ms. That's about the most 'dummy' like function I can think of (maybe like $i = 1, or something like that)
  18. Could anything in the other two scripts cause it to die/exit? include('Connect.php'); include('top.php'); Check it by changing: error_reporting(E_ALL); ini_set('display_errors','On'); to: error_reporting(E_ALL); ini_set('display_errors','On'); echo 'test';
  19. Change: // CHECK ID echo $ID; to: // CHECK ID echo 'ID is: ',$ID;
  20. <?php error_reporting(E_ALL); ini_set('display_errors','On'); include('Connect.php'); include('top.php'); $ID= $_COOKIE['UserID']; // CHECK ID echo $ID; // ADDED MYSQL_ERRORS $Chuunin_Result= mysql_query("SELECT * FROM Chuunin_Exams WHERE ID='$ID'") or die(mysql_error()); $Chuunin_Rows= mysql_fetch_array($Chuunin_Result); if(!isset($ID)) { echo "Sorry, you must be logged in to view this page."; include('bottom.php'); exit; } $ID= mysql_real_escape_string($ID); $Chuunin1= $Chuunin_Rows['Chuunin_1']; $Chuunin2= $Chuunin_Rows['Chuunin_2']; $Chuunin3= $Chuunin_Rows['Chuunin_3']; $Submit1= $_POST['Submit1']; $Submit2= $_POST['Submit2']; $Submit3= $_POST['Submit3']; if($Chuunin1=="") { if(!isset($Submit1) { echo "Hello. these are the Chuunin Exams. You must battle 3 people to pass the exams. The recommended level is 20 for these exams."; echo "<form method='POST'><input type='submit' name='Submit 1' value='First Battle!'></form>"; } else { mysql_query("DELETE FROM Battle_Information WHERE ID='$ID'") or die(mysql_error()); $Enemy_ID="0"; $Enemy_ID= mysql_real_escape_string($Enemy_ID); $Enemy_Name="Chuunin Enemy 1"; $Enemy_Name= mysql_real_escape_string($Enemy_Name); $Enemy_Element="Fire"; $Enemy_Element= mysql_real_escape_string($Enemy_Element); $Enemy_Weapon="Kunai"; $Enemy_Weapon= mysql_real_escape_string($Enemy_Weapon); $Enemy_Taijutsu="Punch"; $Enemy_Taijutsu= mysql_real_escape_string($Enemy_Taijutsu); $Enemy_Ninjutsu="Fire Ball Jutsu"; $Enemy_Ninjutsu= mysql_real_escape_string($Enemy_Ninjutsu); $Enemy_Genjutsu="Substitute"; $Enemy_Genjutsu= mysql_real_escape_string($Enemy_Genjutsu); $Enemy_Clan="None"; $Enemy_Clan= mysql_real_escape_string($Enemy_Clan); $Enemy_Chakra="27"; $Enemy_Chakra= mysql_real_escape_string($Enemy_Chakra); $Enemy_HP="2219"; $Enemy_HP= mysql_real_escape_string($Enemy_HP); $Enemy_Level="18"; $Enemy_Level= mysql_real_escape_string($Enemy_Level); $Enemy_Ninjutsu_Power="0"; $Enemy_Ninjutsu_Power= mysql_real_escape_string($Enemy_Ninjutsu_Power); $Enemy_Genjutsu_Power="0"; $Enemy_Genjutsu_Power= mysql_real_escape_string($Enemy_Genjutsu_Power); $Enemy_Taijutsu_Power="0"; $Enemy_Taijutsu_Power= mysql_real_escape_string($Enemy_Taijutsu_Power); $Enemy_Weapon_Power="2219"; $Enemy_Weapon_Power= mysql_real_escape_string($Enemy_Weapon_Power); mysql_query("INSERT INTO Battle_Information (Enemy_ID, Enemy_Name, Enemy_Element, Enemy_Weapon, Enemy_Taijutsu, Enemy_Ninjutsu, Enemy_Genjutsu, Enemy_Clan, Enemy_HP, Enemy_Max_HP, Enemy_Chakra, Enemy_Max_Chakra, Enemy_Level, Enemy_Ninjutsu_Power, Enemy_Taijutsu_Power, Enemy_Genjutsu_Power, Enemy_Power, ID) VALUES('$Enemy_ID', '$Enemy_Name', '$Enemy_Element', '$Enemy_Weapon', '$Enemy_Taijutsu', '$Enemy_Ninjutsu', '$Enemy_Genjutsu', '$Enemy_Clan', '$Enemy_HP', '$Enemy_HP', '$Enemy_Chakra', '$Enemy_Chakra', '$Enemy_Level', '$Enemy_Ninjutsu_Power', '$Enemy_Taijutsu_Power', '$Enemy_Genjutsu_Power', '$Enemy_Weapon_Power', '$ID')") or die(mysql_error()); header ('Location: battle.php'); } } include('bottom.php'); ?> Does that return anything?
  21. You're missing a period: "Lender: $lend2\n" . "Loan Type: $type2\n" "----------------------- OTHER INFO -----------------------\n\n" .
  22. It works, but you don't need to open and close the tags that many times. Also, I would include a catch-all. A final else statement that will display whatever you want incase the argument doesn't match: <?php if($_GET['page_id'] == 2) { include("decor_leftnav.php"); } else if($_GET['page_id'] == 3) { include("maintest.php"); } else { include("404.php"); } ?> Or use a switch, which is easier to maintain IMO. Honestly, I would go with Snowmiser's code, it's going to be a lot easier and cleaner in the long run.
  23. On your form, the email field is named "email2" not "email", thus PHP will always return you back to the form because there is no "email".
  24. You already have a table called "users" (or similar) that has a record for each user looking something like: USER_ID USER_NAME 1 Mark Baker 2 Angelina Jolie 3 Jessica Alba 4 Charlize Theron 5 Thandie Newton You create a new table called "friends" Data would look like: USER_ID FRIEND_ID 2 1 3 1 4 1 1 5 5 1 Which says that users 2 (Angelina Jolie),3 (Jessica Alba), 4 (Charlize Theron) and 5 (Thandie Newton) are all friends with user 1 (Mark Baker); and that user 1 (Mark Baker) is friends with user 5 (Thandie Newton). Use the same type as you did with the other table - USER_ID. You most likely used INT.
  25. $q = $db->query("UPDATE `users` SET `active` = '1' AND `active_hash` = '' WHERE username = ? AND active_hash = ?", array($user, $hash)) What DB errors are you getting, if any? I'm pretty sure you can't update the column thats part of the WHERE clause, but I could be wrong. A quick check on PHPMyAdmin throws some whacky errors.
×
×
  • 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.