Fatal error: Uncaught Error: Call to a member function


#63

Do all those variables exist, and have you put the $ sign before all of them? And again, don’t you need to specify the id column as an integer?


#64

specify the id column as an integer
like that

$stmt->bind_param(‘isssssssssss’,

$ i have all sign where needed

var_dump(isset($id,$start_date ,$end_date ,$cars ,$Location_of_renting ,$Location_of_return,$vr_uzi,$vr_vraca,$paid ,$price ,$numberdays ,$Numbers_of_cars));

nothing happened


#65

I’m going to interpret your “nothing happened” as meaning “what I wanted to happen didn’t happen”.

During development it’s important to determine what happened instead. You should take advantage of error messages and logs as much as possible. They are often key in providing information needed to solve a problem. Without them one is left to trial and error which can be extremely frustratingly futile.

I think the earlier suggestion to start with something simpler but similar is a good idea. For example, create a table for testing that has only a very few representative fields and put the code through its paces. After everything is OK with that code then scale up to the more complex table. True, it may seem like a waste of time and effort writing temporary code, but it has the benefit of being a smaller “haystack” when looking for the “needles”.


#66

My problem is i was writing a code in mysql now he is almost dead mysqli and pdo are working.Also this was working before 2 weeks ago and suddenly stopped.This code i can put in algoritam but cant insert in db.Hmmm


#68

Given that the error message specifies localhost3.php, you might consider posting code from it. And then perhaps ask yourself why you are trying to use mysql_ code instead of mysqli_?


#69

I’m curious to know why there’s a need to use p[ersistent]connect() ?


#71

The PHP posted can’t be relevant to the error message - it doesn’t have a require_once() in it as far as I can see, and makes its own connection to the database. Unless it’s included via configc-3.php at the bottom end of the code.


#72

I fixed try avoid ?? in $sql and link change conn


#73

Another problem i have three headers on same page getting an error
Warning : Cannot modify header information - headers already sent by (output started a

$password  = "";
  $email = "";
  
  if (isset($_POST['Submit1'])) {
  	
  	$email = $_POST['email'];
	$password= "";
if(!empty($_POST['password'])) {
	$password = $_POST['password'];


	
  	$password = $_POST['password'];
}
  	$sql_u = "SELECT * FROM customer WHERE password='$password'";
  	$sql_e = "SELECT * FROM customer WHERE email='$email'";
  	$res_u = mysqli_query($db, $sql_u);
  	$res_e = mysqli_query($db, $sql_e);

  	if (mysqli_num_rows($res_u) > 0) {
{
	
	
   header('http://localhost/carbooking3/16%20y/S.php');
    exit;
}	
  	}else if(mysqli_num_rows($res_e) > 0){
  	
	
	
	   header('http://localhost/carbooking3/16%20y/korak3.php');
    exit;	
  	
	
	
	
	
	}else{
   
   
           $query = "INSERT INTO   users ( email, password) 
      	    	  VALUES ( '$email', '".md5($password)."')";
           $results = mysqli_query($db, $query);
           echo 'Saved!';
           exit();
  	}
  }

#74

I am going to echo the suggestions above, if you keep struggling with these basics, start on a smaller, simpler project and make sure you understand what each part of the code does.


#75

You must already have sent something to the browser prior to the header redirects. Even a single space before your opening PHP tag will do it.


#76

If i put on top of the page headers getting blank page already tried that,and many things more wont work…


#77

TomB i have small project for you if you will know answer i will start to learn basic,if not you will start learn basic.Read carefully doctor give to you 3 pills and said every 30 minutes you have to take a pill,how much time will take to drank all pills.


#78

If TomB takes a months supply in one gulp or doesn’t take any for an entire month, that’s his problem. Analogy aside, struggling with basics is your problem.

There’s no shame in reviewing from time to time. Personally, I have been writing code for over two decades and I still check documentation on a nearly daily basis. (eg. I’m never quite sure if it’s needle - haystack, or haystack - needle).

Working with code in smaller sized bites and looking at error messages is a lot easier than trying to trial and error several problems at the same time.

Even if you don’t use more advanced error messaging you should at least be using things like error_reporting and display errors for code errors and echo, print_r and var_dump to help with logic errors.


#79

There are times after reading some of the stuff on this site that I feel the need for a drink.


#80

Part of the issue here is that every time I answer a question, I get a very brief one or two-word comment on the answer, and by the time code is posted, the code is completely different to the code I thought we were trying to fix. It also seems to be extracts of code rather than the complete thing - the code posted that’s throwing “headers already sent” is a good example, where the code posted hasn’t already sent anything out, but something earlier must have done.

Of course, one of the other issues with the code in post #73 for the redirects is that the header() isn’t actually correct - it seems to be missing the "Location: " keyword from the start of each header. So it’s only outputting a URL as a header, not actually sending any idea of what to do with it.


#81

Maybe a BOM in the file. But i would review the other files as this code looks included.


#82
$

count=0;
$sql  = "SELECT COUNT(*) `email` FROM customer WHERE `email`= `email`        ";
$count++;
	if($count == 0){
    $count=0;
    echo "<script language=\"JavaScript\">{ 
location.href=\"https://phpdelusions.net/mysqli/check_value\"; 
self.focus(); 
}</script>";
}
 	
	
	}
else if ($count > 0){
$count=0;
echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>";
}

No errors but does not do nothing ,dont go on another page.


#83

Looking at the code, though, $count will never be equal to zero where you first check it because you increment it just before you check its value.

$count = 0;     // set count to zero
$sql  = "SELECT COUNT(*) `email` FROM customer WHERE `email`= `email`        ";
$count++;       // set count to one
	if($count == 0){

That’s regardless of whether your table will contain any rows where the email is that specific string. Which won’t matter, because you don’t actually execute the query anywhere.

When you say it does nothing, if you right-click and view source on your presumably blank browser screen, does it show anything at all?


#84

$count++;

where i gonna put this.
doesnt matter what is count always led on https://phpdelusions.net/mysqli/check_value