Jump to content

moved server getting errors:- Notice: Undefined index


barranco_bob

Recommended Posts

I've moved servers and  thought i'd reconfigured all of the required files but although the site mostly works and defineately links to mysql databse i'm getting :

 

Notice: Undefined index: agent_ref in /home/......./htdocs/property/index.php on line 9  - and similar all over the place.

 

I was getting Undefined Variable messages but got rid of these by opening the file then saving and reloading! Don't know why but it worked!!

 

typical of the problem is below.  Please tell me I am a fool and it'll take 10 seconds to fix!!!

 

 

 

<?php

//////////////////////////////////////////

$page_cat="property";

$page_title="Advanced Property Search";

$msg_var=$_GET["agent_ref"];    // ******** this is line 9 ********

//////////////////////////////////////////

require_once($_SERVER['DOCUMENT_ROOT']."/includes/header.inc.php");

require_once($_SERVER['DOCUMENT_ROOT']."/includes/search_options.inc.php");



//set parametres for rental and for sale searches

if($_GET["type"]=="rental")

{

$query_type=" and rental is not null and commercial is null";

$type_desc="to rent";

}elseif($_GET["type"]=="commercial"){

$query_type=" and commercial is not null";

$type_desc="for commercial purposes";

}else{

$query_type="and rental is null and commercial is null";

$type_desc="for sale";

}

//distinct agents from listing

$q_agent="select distinct l.agent_id as id, count(*) as number, a.name as name

		from listing l, agent a

		where l.agent_id=a.id and l.status='live' $query_type

		group by a.name order by a.name";

$r_agent=mysql_query($q_agent,$conn) or die(mysql_error());



//count rows

$q_count="select count(*) as 'total' from listing 

		where status='live' $query_type group by status";

$r_count=mysql_query($q_count,$conn) or die(mysql_error());

$count_row = mysql_fetch_assoc($r_count);



require_once($_SERVER['DOCUMENT_ROOT']."/includes/html_header.inc.php");

?><body background="../images/jpegs/background_1.jpg">



<table width="100%" cellpadding="0" cellspacing="10" border="0">

<tr>

	<td>

	<!--Search fields -->

	<table width="100%" height="15" cellpadding="0" cellspacing="0" border="0">

		<tr>

			<td background="/images/gifs/content_bg.gif">

				<strong>  Search from<font color="#E67817"> <?=$count_row["total"]?> 

				</font>properties <?=$type_desc?> </strong>

			</td>

		</tr>

	</table>

	<form action="results.php" method="get">

	<?php if($_GET["type"]){echo("<input type=\"hidden\" name=\"type\" value=\"".$_GET["type"]."\">");}?>

 

(edited by kenrbnsn to put in


tags)

Link to comment
Share on other sites

thanks thorpe - isset seems to work - doesn't seem rational to me but hey .. if it works ......

this has thrown up a couple of other problems - surely all these issues must be to do with changing server - is there no way apart from changing every instance of code?

new problem is that code won't parse  e.g.

 

//set agent id search with private sale & remax

if($_GET["agent"])

{

$parse.="agent=".$_GET["agent"]."&";

 

and

 

i'm getting message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition on l.condition=condition.id where l.listing_id='9002' at line 13 e.g.

 

//property details

 

if(is_numeric($_GET["id"]))

{

$property_q="select *

from listing l

left join agent on l.agent_id=agent.id

left join location on l.location=location.id

left join property_type on l.property_type=property_type.id

left join situation on l.situation=situation.id

left join construction_age on l.construction_age=construction_age.id

left join pool on l.pool=pool.id

left join heating on l.heating=heating.id

left join road_access on l.road_access=road_access.id

left join parking on l.parking=parking.id

left join outside on l.outside=outside.id

left join condition on l.condition=condition.id

where l.listing_id='".$_GET["id"];"'";

 

@$property_r=mysql_query($property_q, $conn) or die(mysql_error());

 

if(@mysql_num_rows($property_r)=="0")

{

header("Location:/property/search.php?msg=1"); exit();

}else{

$result=@mysql_fetch_assoc($property_r);

}

 

neither of these is affected by addition of isset

 

any ideas?

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.