Jump to content

plz fix the error


lipun4u

Recommended Posts

What is the error in the below code ???

<?php
		if(array_key_exists_r('email|password', $_POST)) {
			include_once('database.php');
			$sql = "SELECT user_id FROM login WHERE user_name = '" . trim($_POST['email']) . 
				"' AND password='" . trim($_POST['password']) . "')";
		 	$result = mysql_query($sql);  
			print_r($result);
		 	if (mysql_num_rows($result)>0){  
		 		$row = mysql_fetch_row($result);  
				session_start();    
				$_SESSION['user_id']=$row[0];  
				$_SESSION['user_name']=trim($_POST['email']);
			}
		}
?>

Link to comment
Share on other sites

the required function is defined...

 

<?php
function array_key_exists_r($keys, $search_r) {
    $keys_r = split('\|',$keys);
    foreach($keys_r as $key)
    if(!array_key_exists($key,$search_r))
    return false;
    return true;
}
?>

Link to comment
Share on other sites

A parse error often referrs to a previous line to the one indicated in the php warning (simply because it doesn't *know* there is an error until it gets to that line)

 

I can't see a "<" in the code that you posted so it is probably happening somewhere else on the page or even in database.php

 

Chris

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.