Jump to content

PC Nerd

Members
  • Posts

    1,122
  • Joined

  • Last visited

    Never

Everything posted by PC Nerd

  1. i just relised that the error log array was from an earlier error reporting thingy but its irreleve=ant and isnt used so its just taking up space,
  2. its from the require file at the top of my sfript ( not shown on this post.) i include it qhenever i need to connect to a database so all i have to do on the page is to include it and send sql queries, not connecgt all the time its code is: <?php $host="localhost"; $account="root"; $password="PASSWORD"; $dbname="battle-ages_db"; $Error_Log[1] = ""; $Error_Log[2] = ""; $DB_Server = mysqli_connect($host, $account, $password); if(empty($DB_Server)){ die("There was an error in connecting to the database. Please try again later");} $DB = mysqli_select_db($DB_Server, $dbname); if(empty($DB)){ die("There was an erro in selecting the database. Pleae try again later.");} ?> its called Database_link.inc thankx
  3. ok code is else { $start_page = $_GET['page']; } $lower_page_num = $start_page * 20; $higher_page_num = ($start_page + 1) * 20; $curr_page_SQL = "SELECT User_Name, Points, Rank, Resource_1 FROM General_Stats WHERE Rank > ".$lower_page_num." AND < ".$higher_page_num." ORDER BY Rank DESC"; #$curr_page_query = mysqli_query($DB_Server, $curr_page_SQL); #if(empty($curr_page_query)) { # die("ERROR 9 There wat an error in collecting the page information from the database. Please try again later.".mysqli_error($curr_page_SQL)); #} $curr_page_query = mysqli_query($DB_Server, $curr_page_SQL) or die("Query died: ".mysqli_error($curr_page_query)); if(mysqli_num_rows($curr_page_query) < 1) { die("ERROR 9 There was an error in collecting the page information from the database. Please try again later."); } and the error is Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in C:\xampp\xampp\xampp\htdocs\Battle-Ages\B_A-Attack.php on line 120 Query died: ive never come across query died before, what does it mean and how do i fix it
  4. tanx, that sorta helped, but wasnt very clear. this is what i get now Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in C:\xampp\xampp\xampp\htdocs\Battle-Ages\B_A-Attack.php on line 115 ERROR 9 There wat an error in collecting the page information from the database. Please try again later.\ any more suggestions???
  5. i know of addyour.net, but its not very reliable
  6. hey guys, this is prpbably a stupid error that im overlooking, but im receiving the following error: Fatal error: Function name must be a string in C:\xampp\xampp\xampp\htdocs\Battle-Ages\B_A-Attack.php on line 115 this only happens when i put in the error message by php ( ie WARNING .....) but i still get the ERRO 9 coming up when i dont, so either way there is an error. this is my code else { $start_page = $_GET['page']; } $lower_page_num = $start_page * 20; $higher_page_num = ($start_page + 1) * 20; $curr_page_SQL = "SELECT User_Name, Points, Rank, Resource_1 FROM General_Stats WHERE Rank > ".$lower_page_num." AND < ".$higher_page_num." ORDER BY Rank DESC"; $curr_page_query = mysqli_query($DB_Server, $curr_page_SQL); if(empty($curr_page_query)) { die("ERROR 9 There wat an error in collecting the page information from the database. Please try again later.".$mysqli_error($curr_page_query)); } ### ### Display the table of results ### ....... and there is one hell of a lot more blow and above. now that code starts from line 105 ( the else) and ends on line 120 ( the second ###) thanks for your help PC Nerd
  7. jstu quickly, can you have mulit, multi dimensional arrays ie $ARRAY['index1']['index2']['index3'] = 'value' thanks PC Nerd
  8. {its pretty much like you said.... but it goes like...... if ($Error1 = True ) {MESSAGE}
  9. ok, its || and all the records are being echod. ive also tried to create the $Error variables before any of the assigning in the if's like $Error = "";  and it still doesnt work.... so does this mean that its not registering the value??? thanks
  10. if you send your form stuff to the php via post... than it would be something like this. ( i dont know anything much abobut file writing only databases) fwrite($_POST['field1']); fwrite($_POST['field2']); f_write("/n/n"); goodluck ps that doesnt iclude any validation
  11. ok, were getting somewhere.... now tehe first time i did it.... the Valid array wasnt showing up(not ewchoing), and i discovered thathe name had its first char uppercase..... not lower.... but im still getting the error message ( i copied the rest of the code from my original.....ie, to display the errors.) i also tried changeing the || to a && but still nothing. thanks though, i think were getting somewhere
  12. well if the fields are empty (any one of them) , then it turns the error 1 variable to true, the then a later part on the script sayt if error1 is true, display message saying that you havent entered all the information., its all in the script posted above
  13. still raises the $ERROR1 variable. and delivering the error message
  14. ok, thats not working.... changing to if(empty($VAR) || .............) thanks anyway........
  15. yes i know about the header errors, but there is NO OUTPUT AT ALL. and im only bumping it every 4-6 hours. so .............. does anyone have anything to suggest
  16. well thats eccentially wat ive got..... but i use variables instead of arays....thats why im askin if there is nother error in my code
  17. does anyone have any more ideas on this problem.... thanks
  18. ok, i prefer to use the if's and individual variables just for reference...... but thats just my personal preference... but if its that thats cauaseing the error...then ill have to change it. i tried the isset ( )  ( but for the first if where its testing if the field is empty it wold have to be "if !isset($VAR_NAME)) and it doesnt work thanks for your help.... any more suggestions??? thanks
  19. does anyone have any ideas...... i think on the attached file to my previous post.... that the if testing if the fields were empty.... all contitions had the !empty()......, not just the frirst.. so that wont make any differenece thanks for any help
  20. soz guys, its not actually solved, i made a mistake. my code is as follows and always returns $Error1 as TRUE.... even if i lnow it isnt..... could this be something with the previous page becauase the data isnt being sent correctly.? [code]<?php if(!empty($_POST['User_Name']) && empty($_POST['Password']) && empty($_POST['Valid'])) { $img_post_valid = "B_A-Login_".$_POST['IMG_Valid']; $Image_Validate = $IMAGES["B_A-Login_$img"]; if($_POST['IMG_Valid'] = $Image_Validate) { $SQL_Login = "SELECT User_Name, `Password` FROM General_Stats WHERE User_Name = '".$_POST['User_Name']."'"; $Login_Query = mysqli_query($DB_Server, $SQL_Login); if(!empty($Login_Query)) { $DB_Login = mysqli_fetch_array($Login_Query); if(!empty($DB_Login)) { require("inc_files/B_A-Create_Cookies.inc"); header("Location: B_A-Base.php"); } else { $Error = True; $Error4 = True; } } else { $Error = True; $Error3 = True; } } else { $Error = True; $Error2 = True; } } else { $Error = True; $Error1 = True; }[/code] thanks for all your help, the entire document is attached [attachment deleted by admin]
  21. dont worry.... i embeded the if's validating the login, in themselves... creating a sort of heirachy... this way the relocation can only happen if the rest of the stuf is incorect, ie the validation works. thanks anyway PC NERd
  22. ok, well there are definately no spaces or anything outside of the <?php tags ( at the begining ) so that is probably not the problem.... ill attach the file to this reply.... so you can see the full thing if you want [attachment deleted by admin]
  23. the problem is that if i dont put on output buffering, i get the header error becauase variables and things have made output ( although i havent used echo or anytghing) amd if i do have it on, it just does the relkocation and header stuff .... even if there are errors...... can anyone help on this
  24. hi guys.  im creating a login script..... basically going like: if ( errors, create relevent variable warning.) else(cookies and re;locate user) BUT becauase im creating the variables, i think PHP thinks im creating output, it obvious;ly doesnt work.....  ( header();  ) but ob_start() wont work because it would use the header information anyway, and basically relocate before validation........ this is my code.... does anyone have any ideas on how to do this... ( validate andthen relocate if neccisary.) [code]<?php ob_start(); include("inc_files/Database_link.inc"); $Error1 = ""; $Error2 = ""; $Error3 = ""; $Error4 = ""; if(empty($_POST['User_Name']) || empty($_POST['Password']) || empty($_POST['Valid'])) { $Error1 = "True"; $Error = "True"; } require("inc_files/Login_Pics.inc"); $img_post_valid = "B_A-Login_".$_POST['IMG_Valid']; $Image_Validate = $IMAGES["B_A-Login_$img"]; if($_POST['IMG_Valid'] != $Image_Validate) { $Error2 = "True"; $Error = "True"; } $SQL_Login = "SELECT User_Name, `Password` FROM General_Stats WHERE User_Name = '".$_POST['User_Name']."'"; $Login_Query = mysqli_query($DB_Server, $SQL_Login); if(empty($Login_Query)) { $Error3 = "True"; $Error = "True"; } $DB_Login = mysqli_fetch_array($Login_Query); if(empty($DB_Login)) { $Error4 = "True"; $Error = "True"; } if($Error != "True") { require("inc_files/B_A-Create_Cookies.inc"); header("Location: B_A-Base.php"); } ob_end_clean(); ?> .....html output if necisary here[/code] thanks for any 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.