Jump to content

My life have ended help please


alexandre
Go to solution Solved by maxxd,

Recommended Posts

!!! I need help . I messed up forgetting to break a while loop and it crashed my pc and now my main file that was open and I was working on with the script in simply been completely erased now I can only see the number one of the first line in code editor and all the rest are dots pleeease tell me there is a way to recover It I had literally just finished it …. I wanna cry right now.

Link to comment
Share on other sites

  • Solution

Not sure how that would have happened, but dude I feel ya' - losing WIP sucks. Check to see if your editor created a temp file somewhere or if there's an automated backup. Obviously, this is one of the benefits of using git but if you're not or you didn't commit or push, it may be rough. How exactly were you running the script that an infinite loop could have wiped your file?

Edited by maxxd
  • Great Answer 1
Link to comment
Share on other sites

It’s a one file script that take the entered value of a post method and if conditions are met is stored and along with all other participants then if the 1000 highest donator at the end of the week gets something but the while loop that was unbroken was simply something I was trying to verify that the amount entered was higher than zero , I honestly have no idea how this have happened maybe because I have like 30 tab opened but still laptop just crashed and the only file wiped was the one active so it is weird 

image_2022-09-04_031156263.png

Edited by alexandre
Link to comment
Share on other sites

i have a question do this code changes the variables in which i fetched data higher in the script?

$sql = 'SELECT usernames, totaldonated FROM donationclashdetails LIMIT(1000) ORDER BY totaldonated DESC ';
     $result = mysqli_query($con, $sql);
     if (mysqli_num_rows($result) > 0) {
         while($row = mysqli_fetch_assoc($result)) {
             echo . ' - ' . $row['usernames']. $row['totaldonated']. ' - ' .'<br>';
						 $stmt->close();
         }

 

Edited by alexandre
Link to comment
Share on other sites

It still seems weird that even having to hard reboot the system would wipe out a file that clearly had been saved. Admittedly, if Windows was already having trouble it has been known to happen; it totally sucks, but yeah - computers barf sometimes.

As to your second question; no idea, dude. I do however look askance at the `$stmt->close();` line as I'm not sure one really ever needs to close a DB connection in PHP, it handles that pretty well on its own. Somebody here will I hope speak up if I'm mistaken on that.

What you've posted will overwrite variables of the same name if the code you've posted is nested. For instance, if you're looping through a result set defined as `$result` and you have the code you've posted, then yeah - `$result` will change as of the first iteration of the internal loop (the code you posted) and you'll get unexpected results. I will also say that if you're running a query within a loop based on the result of another query, there's probably a bigger issue with the code. Post what you've got.

Link to comment
Share on other sites

right now it is unfinished but heres what i got back and also the variables that i do not want to change are the ones binded or fetched to the session id related stuff 

<?php
include 'countdown-timer.php';
$DONATIONCLASHTIME = true;
$donationclash = true;
// We need to use sessions, so you should always start sessions using the below code.
session_start();
// If the user is not logged in redirect to the login page...
if (!isset($_SESSION['loggedin'])) {
	header('Location: index.html');
	exit;
}
require_once('./includes/connect_db1.php');
  if ($stmt = $con->prepare("SELECT userbalance, totaleventjoined, totalpifcoingained, totaldonationdc, userlevel, userexperience FROM accounts WHERE id = ?")) {
  // In this case we can use the account ID to get the account info.
  $stmt->bind_param('i', $_SESSION['id']);
  $stmt->execute();
  $stmt->bind_result($userbalance, $totaleventjoined, $totalpifcoingained, $totaldonationdc, $userlevel, $userexperience);
  $stmt->fetch();
  $stmt->close();
  }
if ($DONATIONCLASHTIME > 0) {
  $donationclash = true;
}
else  {
	$donationclash = false;
echo 'sorry the donation clash is not avilable at this moment';
exit;
}
 if ($_SERVER["REQUEST_METHOD"] == "POST") {
$donationamountinpending = $_POST['participation'];
}
else if ($_POST['participation'] != 0) {
echo 'please enter an amount in order to participate';
exit;
}
if ($donationamountinpending > $userbalance) {
	echo 'sorry you do not have enough Pifcoin to participate';
	echo $donationamountinpending;
	echo $userbalance;
 exit;
}
  else if ($userbalance >= $donationamountinpending and $donationclash = true){
    $donationamount = $donationamountinpending;
require_once('./includes/connect_db1.php');
}
if ($stmt = $con->prepare("INSERT INTO donationclashdetails (participationid, usernames, totaldonated) VALUES ( ?, ?, ?)")) {
// In this case we can use the account ID to get the account info.
$stmt->bind_param('isi', $_SESSION['id'], $_SESSION['name'], $_POST['participation'],);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($_SESSION['id'], $_SESSION['name'], $_POST['participation']);
}
if ($stmt = $con->prepare("SELECT participationid, usernames, totaldonated, totalpifcoincollected FROM donationclashdetails WHERE participationid = ?")) {
// In this case we can use the account ID to get the account info.
$stmt->bind_param('i', $_SESSION['id']);
$stmt->execute();
$stmt->bind_result($participationid, $usernames, $totaldonated, $totalpifcoincollected);
$stmt->fetch();
$stmt->close();
}
if ($participationid = $_SESSION['id'] and $totaldonated = 0) {
   $userbalance = $userbalance - $donationamount;
   $totaldonated = $donationamount;
   $totaldonationdc = $totaldonationdc + $donationamount;
  $userexperience = $userexperience + $donationamout;
  $userlevel = $userlevel + ($userexperience + 100) / 10;
  $totalpifcoincollected = $donationamount;
  $totaleventjoined = $totaleventjoined++;

  echo "you successfully participated to the Donation clash.<br>You can keep track of how much you donated for the week in your profile.";
  echo "or go take a look at the donation ranking page.";
}
   
elseif (isset($_POST['participation']) && $_SESSION['id'] === $participationid) {
  $userbalance = $userbalance - $donationamount;
  $totaldonated = $totaldonated + $donationamount;
  $totaldonationdc = $totaldonationdc + $donationamount;
 $userexperience = $userexperience + $donationamout;
 $userlevel = $userlevel + ($userexperience + 100) / 10;
 $totaleventjoined = $totaleventjoined++;
  $totalpifcoincollected = $totalpifcoincollected + $donationamount;
  $totaldonated = $totaldonated + $donationamount;
  echo "you successfully participated to the Donation clash.<br>You can keep track of how much you donated for the week in your profile.";
    echo "or go take a look at the donation ranking to see your updated rank.;"
}
require_once('./includes/connect_db1.php');
mysqli_select_db($con, 'donationclash');

$sql = 'SELECT * usernames, totaldonated FROM donationclashdetails ORDER BY totaldonated DESC';
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
        echo . ' - ' . $row['usernames']. $row['totaldonated']. ' - ' . '<br>';
    }
} else {
    echo 'No records found!';
}
if ($donationclash = false) {
$donationclashcompleted = true;
echo 'The donation clash of this week is now completed';
}



$sql = 'SELECT sum(totalpifcoincollected) FROM donationclashdetails';
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
       echo "the total collected this week for the donation clash:";
			 echo $row['totalpifcoincollected'];
 }
  }
    
//winners selected
     $sql = 'SELECT usernames, totaldonated FROM donationclashdetails LIMIT(1000) ORDER BY totaldonated DESC ';
     $result = mysqli_query($con, $sql);
     if (mysqli_num_rows($result) > 0) {
         while($row = mysqli_fetch_assoc($result)) {
             echo . ' - ' . $row['usernames']. $row['totaldonated']. ' - ' .'<br>';
						 $stmt->close();
         }
     }
   if ($donationclashcompleted = true) {
    $prizeamount = $row['totalpifcoincollected'];
    cal_percentage(65, $prizeamount)
		$prizeamount = $prizeamount / 1000;
    $winnersname = $row['usernames'];
		$winnersamount = $prizeamount;
   }
   
     if ($donationclashcompleted = true) {
  print $winnersname;
	print $winnersamount;
   }
     else {
         echo 'there is no winners yet!';
     }
?>

 

Link to comment
Share on other sites

14 hours ago, alexandre said:

i have a question do this code changes the variables in which i fetched data higher in the script?

i suspect you are asking this because your code and variables aren't behaving the way you expect?

the reason most of your conditional tests are not working and variables are being changed, is because one = is an assignment operator and two == is a comparison operator. when you have a statement like - if($donationclash = false), this assigns false to the variable, then tests the result, which will be a false value. all these conditional tests against variables should use two ==if($donationclash == false), this tests if the variable is equal to a false value and leaves the value in the variable as is.

a comment about the use of the $donationclash variable throughout this code. since your program logic is halting execution if the $DONATIONCLASHTIME is false, there's no point in the $donationclash variable at all. all the rest of the code on the page after the $DONATIONCLASHTIME test and its message won't be executed.

here's a list of issues with the current code -

  1. there are no helpful comments in the code describing what the goal of each section is. this makes it almost impossible for anyone to help with your code.
  2. switch to the much simpler and more consistent PDO database extension. it treats the result of a non-prepared and a prepared query identically. this alone will eliminate about half of the code dealing with database queries.
  3. don't copy variables to other variables for nothing. just use the original variables. this accounts for close to half of the existing lines of code. this is just a waste of typing and is making more work for you in keeping track of everything and makes it almost impossible for anyone to help.
  4. don't use multiple names for the same thing. this requires you to keep track of which name you are using and makes it next to impossible for someone to help.
  5. use under scores _ to separate the words making up names of things.
  6. make the database connection in an initialization section at the top of your code and don't repeatedly require (once) the connection file.
  7. only store the user's id in session variable, named user_id or similar, to indicate who the logged in user is. this will either be set or it won't.
  8. query on each page request to get any other user information, such as the username, permissions, ...
  9. you have mistakes in most of the if() comparisons. one = is an assignment operator. two == is a comparison operator.
  10. there are other logic mistakes with what the else and else if logic is doing, that would be easier to see if you consistently indent your code.
  11. use 'require' for things that your code must have for it to work.
  12. include/require are not functions. the () around the value does nothing but clutter up your code with unnecessary typing.
  13. be consistent. you are using include/require_once and echo/print at different points.
  14. don't use a loop to fetch data from a query that will match at most one row of data. just fetch the single row of data.
  15. why do you have an if() around the prepare() calls? you don't do anything if they fail and since the execute() calls can fail, why don't you have conditional tests for them too? instead of writing out conditional logic for each database statement that can fail, use exceptions for errors and in most cases simply let php catch and handle any database exception, simplifying the code.
  16. the only time your code should catch and handle a database statement error/exception is for user recoverable errors, such as when inserting/updating duplicate or out of range user submitted data. in all other cases, don't put any logic in your code and simply let php catch and handle the error/exception.
  17. build sql query statements in php variables. this will make testing easier and help to eliminate typo mistakes by separating the sql query syntax as much as possible from the php syntax.
  18. you should always fetch all the data that a query returns, which is why you went to the trouble of executing a query in the first place, so there should not be any case where you need to close a prepared query.
  19. don't store redundant data in multiple locations. you are storing the user's id in the donationclashdetails. that's all the user information you need. you can get any other user information via the user's id.
  20. any one conditional test can either be true or false. you don't need test for the false case after you have tested for the true case. if a test is not true, it must be false.
  21. the $stmt->store_result() and $stmt->bind_result() after the INSERT query don't belong there and may be producing errors. do you have php's error_reporting set to E_ALL and display_errors set to ON, preferably in the php.ini on your system, so that php will help you by reporting and displaying all the errors it detects?
  22. the SELECT ... FROM donationclashdetails WHERE participationid = ? query, right after the INSERT query, and the associated repetitive logic, is unnecessary.

the php code for any page should be laid out in this general order -

  1. initialization
  2. post method form processing
  3. get method business logic - get/produce data needed to display the page
  4. html document

post method form processing should -

  1. detect if a post method form was submitted, which you are doing. however, all the form processing code goes inside this conditional block of code. yours isn't.
  2. keep the form data as a set, in an array variable, then operate on elements in this array throughout the rest of the code
  3. trim all the inputs at once
  4. validate all inputs, storing validation errors in an array using the field name as the array index
  5. after the end of the validation logic, if there are no errors (the array holding the errors will be empty), use the submitted form data
  6. after the end of the form processing logic, if there are no errors, perform a redirect to the exact same url of the current page to cause a get request. this will prevent the browser from trying to resubmit the form data
  7.  to display a one-time success message, store it in a session variable, then test, display, and clear the variable at the appropriate location in the html document.
  8. if there are errors at step #5, the code will continue on to (re)display the html document. you would test/display any errors and redisplay the form, populating the field value(s) with any existing data.
  9. apply htmlentities() to any dynamic value when you output it in a html context

 

Edited by mac_gyver
  • Thanks 1
Link to comment
Share on other sites

the code that you see there is a totally unfinished product .. it is what i got back from my file being wiped after a crash but i do understand all your questions and this will help me to fix it better. also i started coding php at the beginning of the week so  i dont really expect to master the syntax already but i dont stop trying . thank you for taking the time to explain those.

i would maybe have a question about the pdo database extension that you noted there . i read a lot about sql injection and it seem like you reduce the risk of such threat by using prepared queries. so i was thinking to only use those prepared queries if possible. or is there situations where i cant use those prepared queries ?

Edited by alexandre
Link to comment
Share on other sites

You can use prepared queries for all query types, and if the SQL itself contains any values not hard-coded in the SQL string you absolutely should. That having been said, if you're doing a straight select without external input of any sort, don't bother. It'll just add an (admittedly small) amount of overhead. From your posted code it looks like you're actually doing that already.

As mac_gyver pointed out, you should be seeing additional PHP errors - I see several missing semicolons in what you posted. I haven't used atom, but it should be pointing out those types of errors for you.

Link to comment
Share on other sites

3 hours ago, alexandre said:

reduce the risk of such threat by using prepared queries

prepared queries provide fool-proof protection against sql special characters in a data value breaking the sql query syntax, which is how sql injection is accomplished. you are already using prepared queries with the mysqli extension. however, as stated, the PDO extension is much simpler and more consistent.

for the SELECT query that's getting the current user's row of data, this what it looks like using mysqli (with the if(){} and ->close() removed) -

$stmt = $con->prepare("SELECT userbalance, totaleventjoined, totalpifcoingained, totaldonationdc, userlevel, userexperience FROM accounts WHERE id = ?");
$stmt->bind_param('i', $_SESSION['id']);
$stmt->execute();
$stmt->bind_result($userbalance, $totaleventjoined, $totalpifcoingained, $totaldonationdc, $userlevel, $userexperience);
$stmt->fetch();

and here's what that looks like using PDO -

$stmt = $pdo->prepare("SELECT userbalance, totaleventjoined, totalpifcoingained, totaldonationdc, userlevel, userexperience FROM accounts WHERE id = ?");
$stmt->execute([ $_SESSION['id'] ]);
$user_data = $stmt->fetch();

there's no need for explicit binding of inputs or for the result. you can directly fetch data from a prepared PDO query exactly the same as for a non-prepared query.

Link to comment
Share on other sites

i updated the code a little bit since the code up there but not much, i am thinking about changing the setup around the session id related stuff and the actual event details binded to id as you said about the arrays i am trying to figure a setup but for now the code look like this. and this code right now is stopping working at the query or something , it is adding the desired values in the database but if you reload the page it keeps adding more rows and alsos i get a error saying that the number of binded variables doesnt match or something but the content still getting added to database

<?php
include 'countdown-timer.php';
include './includes/connect_db1.php';
$donationclash = $DONATIONCLASHTIME;
// We need to use sessions, so you should always start sessions using the below code.
session_start();
// If the user is not logged in redirect to the login page...
if (!isset($_SESSION['loggedin'])) {
	header('Location: index.html');
	exit;
}
  if ($stmt = $con->prepare("SELECT userbalance, totaleventjoined, totalpifcoingained, totaldonationdc, userlevel, userexperience FROM accounts WHERE id = ?")) {
  // In this case we can use the account ID to get the account info.
  $stmt->bind_param('i', $_SESSION['id']);
  $stmt->execute();
  $stmt->bind_result($userbalance, $totaleventjoined, $totalpifcoingained, $totaldonationdc, $userlevel, $userexperience);
  $stmt->fetch();
	$stmt->close();

  }
	else {
		echo 'connexion broken try again later';
	}
	$userbalance = 200;
	echo $userbalance;
if ($DONATIONCLASHTIME >= 1) {
  $donationclash = true;
  echo "<div class='formdc'><form action='#' method='post' enctype='multipart/form-data'>
      enter your amount:<input type='text' name='participation'>
	<div class='participation'><button type='submit' formenctype='text/plan' formmethod='POST'>submit participation</button></div></div>";
}
else  {
	$donationclash = false;
echo 'sorry the donation clash is not avilable at this moment';
exit;
}
 if (($_SERVER["REQUEST_METHOD"] == "POST") && $_POST['participation'] > 0 ) {
$donationamountinpending = $_POST['participation'];
}
else {
  echo "the value entered must be a number of type integer example: 1,2,3,etc..";
	exit;
}
if ($_POST['participation'] <= 0) {
echo 'please enter an amount in order to participate example: 1,2,3,etc..';
exit;
}
if ($donationamountinpending > $userbalance) {
	echo 'sorry you do not have enough Pifcoin to participate';
	echo $donationamountinpending;
	echo $userbalance;
 exit;
}
  else if (($userbalance >= $donationamountinpending) && $donationclash == true){
    $donationamount = $donationamountinpending;
	}

if ($stmt = $con->prepare("REPLACE INTO donationclashdetails (participationid, usernames, totaldonated) VALUES ( ?, ?, ?)")) {



// In this case we can use the account ID to get the account info.
$stmt->bind_param('isi', $_SESSION['id'], $_SESSION['name'], $_POST['participation'],);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($_SESSION['id'], $_SESSION['name'], $_POST['participation']);
}
else {
	echo 'connexion broken retry later';
	exit;
}
if (($participationid == $_SESSION['id']) && $totaldonated == 0) {
   $userbalance = $userbalance - $donationamount;
   $totaldonated = $donationamount;
   $totaldonationdc = $totaldonationdc + $donationamount;
  $userexperience = $userexperience + $donationamout;
  $userlevel = $userlevel + $userexperience / 10;
  $totalpifcoincollected = $donationamount;
  $totaleventjoined = $totaleventjoined++;

  echo "you successfully participated to the Donation clash.<br>You can keep track of how much you donated for the week in your profile.";
  echo "or go take a look at the donation clash ranking page.";
}

else if (isset($_POST['participation']) && $_SESSION['id'] == $participationid) {
  $userbalance = $userbalance - $donationamount;
  $totaldonated = $totaldonated + $donationamount;
  $totaldonationdc = $totaldonationdc + $donationamount;
 $userexperience = $userexperience + $donationamout;
 $userlevel = $userlevel + $userexperience +100 / 10;
 $totaleventjoined = $totaleventjoined++;
  $totalpifcoincollected = $totalpifcoincollected + $donationamount;
  echo "you successfully participated to the Donation clash.<br>You can keep track of how much you donated for the week in your profile.";
    echo "or go take a look at the donation ranking to see your updated rank.";
}
include './includes/connect_db1.php';
$sql= 'SELECT * usernames, totaldonated FROM donationclashdetails ORDER BY totaldonated DESC';
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
			//rankings
        echo   $row['participationid']. $row['usernames']. $row['totaldonated']. ' - ' . '<br>';
    }
}
else {
    echo 'No records found!';
}
$sql = 'SELECT sum(totalpifcoincollected) FROM donationclashdetails';
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
			//displaying the total amount of pifcoin collected by participants for the week
       echo "the total collected this week for the donation clash:";
			 echo $row['totalpifcoincollected'];
 }
  }
	else {
		echo 'no records found!';
	}
if ($donationclash = false) {
$donationclashcompleted = true;
echo 'The donation clash of this week is now completed';
}
else { //sinon we display rankings
	echo   $row['participationid']. $row['usernames']. $row['totaldonated']. ' - ' . '<br>';
}
//here we select the 1000 winners of the week
     $sql = 'SELECT * participationid, usernames, totaldonated FROM donationclashdetails LIMIT(1000) ORDER BY totaldonated DESC ';
     $result = mysqli_query($con, $sql);
     if (mysqli_num_rows($result) > 0) {
         while($row = mysqli_fetch_assoc($result)) {
             echo $row['participationid']. $row['usernames']. $row['totaldonated']. ' - ' .'<br>';
         }
		 }
   if ($donationclashcompleted = true) {
     $winnersparticipationid = $row['participationid'];
    $prizeamount = $row['totalpifcoincollected'];
    cal_percentage(65, $prizeamount);
		$prizeamount = $prizeamount / 1000;
    $winnersname = $row['usernames'];
		$winnersamount = $prizeamount;
   }
   if (isset($_POST['participation']) && $_SESSION['id'] == $winnersparticipationid) {
     $userbalance = $userbalance + $winnersamount;
     echo "<div class='winnersannouncement'>congratulation ". $_SESSION['name']. ", you just won:" . $winnersamount .'</div>';
   }
else if (!isset($_POST['participation']) && $_SESSION['id'] !== $winnersparticipationid) {
  echo "sorry i wish you a better luck next time, you are not a winner on this week";
  exit;
}
     while ($donationclashcompleted = true) {
  $winners = $winnersname.$winnersamount;
		echo $winners;
		break;
	}
?>

 

Edited by alexandre
Link to comment
Share on other sites

Fatal error: Uncaught ArgumentCountError: Number of bind variables doesn't match number of fields in prepared statement in C:\xampp\htdocs\container\donation-clash\donation-clash.php:63 Stack trace: #0 C:\xampp\htdocs\container\donation-clash\donation-clash.php(63): mysqli_stmt->bind_result(2, 'alexandre', '25') #1 {main} thrown in C:\xampp\htdocs\container\donation-clash\donation-clash.php on line 63

 

this is the only error appearing for me the llast time i tried

Link to comment
Share on other sites

since the error mentions the bind_result() statement, the cause of this error has already been stated -

6 hours ago, mac_gyver said:

the $stmt->store_result() and $stmt->bind_result() after the INSERT query don't belong there and may be producing errors.

an INSERT (now a REPLACE) query doesn't have a result set, so there's nothing for bind_result to bind to. at this point we are just repeating information already given. you need to spend more time on your own trying to solve problems.

Link to comment
Share on other sites

38 minutes ago, mac_gyver said:

since the error mentions the bind_result() statement, the cause of this error has already been stated -

an INSERT (now a REPLACE) query doesn't have a result set, so there's nothing for bind_result to bind to. at this point we are just repeating information already given. you need to spend more time on your own trying to solve problems.

just a little note there, the binding is actualy processed because if i remove the bind result it unbind my main variables which are linked till the bottom of the script. so participation id doesnt mean anything if i unbind and totaldonated neither, so i think logically the bind is actually binding the result which is what making the value that are added to the database taking the value of the session id as well as the session username. if i remove this nothing works.

Link to comment
Share on other sites

the error is occurring on line 63. based on the last code you posted, the bind_result() nearest that line is the one after the INSERT/REPLACE query, which doesn't have a result set to fetch data from. if you are removing the bind_result() at about line 16 in the last posted code, that one does belong there because it is associated with a SELECT query, which does have a result set.

i seriously recommend that before you waste any more time on this, that you switch to the much simpler PDO extension.

Link to comment
Share on other sites

20 minutes ago, mac_gyver said:

the error is occurring on line 63. based on the last code you posted, the bind_result() nearest that line is the one after the INSERT/REPLACE query, which doesn't have a result set to fetch data from. if you are removing the bind_result() at about line 16 in the last posted code, that one does belong there because it is associated with a SELECT query, which does have a result set.

i seriously recommend that before you waste any more time on this, that you switch to the much simpler PDO extension.

for the bind_result around line 65 , when i remove the bind_result it gives me the error i will post below. just as if all the variables used below wasnt binded anymore so i would like to understand how comes this seems binded if they are not supposed to be. but i also removed the store_result which is not on the code above and the only way everything is staying binded is if i leave the bind_result there.

and i understand about the pdo extension i just really liked the format even if it forces me to write more code, the effect that the words have on my understanding is better like that, but if you think i should definitely learn it for more efficiency i will do so

also i have all the time until my last breath so this isnt much of a problem, i am actually looking at how validating forms data on both server and client side efficiently.  

Warning: Undefined variable $participationid in C:\xampp\htdocs\container\donation-clash\donation-clash.php on line 70

Warning: Undefined variable $participationid in C:\xampp\htdocs\container\donation-clash\donation-clash.php on line 83

Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'usernames, totaldonated FROM donationclashdetails ORDER BY totaldonated DESC' at line 1 in C:\xampp\htdocs\container\donation-clash\donation-clash.php:96 Stack trace: #0 C:\xampp\htdocs\container\donation-clash\donation-clash.php(96): mysqli_query(Object(mysqli), 'SELECT * userna...') #1 {main} thrown in C:\xampp\htdocs\container\donation-clash\donation-clash.php on line 96

Edited by alexandre
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.