Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 14, 2009, 11:44 AM   #1
balam
macrumors newbie
 
Join Date: Dec 2009
Use of undefined constant foundnum line 54

hi, can someone help me with this error pls. the error is Use of undefined constant in line 54. what is it thats not defined pls


<?php

include ('connect.php');

error_reporting(E_ALL);
ini_set('display_errors', '1');

$submit = $_GET['submit'];
$search = $_GET['search'];
$x=0;
$construct='';
$foundnum="";

if (!'submit')

echo "you didnt submit a keyword.";

else

{

if (strlen($search)<=2)

echo "search term to short.";
else
{
echo " You searched for <b>$search</b><hr size='1'>";

//connect to our database

$search_exploded = explode(" ",$search);


foreach($search_exploded as $search_each)

{

// construct query

$x++;
if ($x==1)
$construct .= " location LIKE '%$search_each%'";
else
$construct .= " OR rent LIKE '%$search_each%'";

}

// echo out construct

$construct = "SELECT * FROM flats WHERE $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);

if (foundnum==0)
echo "No results found.";
else
{
echo "$foundnum result found!<p>";

while ($runrows = mysql_fetch_assoc($run))

{

// get data

$select = $runrows['type'];
$title = $runrows['title'];
$location = $runrows['location'];


echo "

echo $title;
echo <br>;
echo $select;
echo <br>;
echo $rent;
echo <br>;
echo $location";

}


}
}
}


?>
balam is offline   0 Reply With Quote
Old Dec 14, 2009, 12:27 PM   #2
angelwatt
Moderator emeritus
 
angelwatt's Avatar
 
Join Date: Aug 2005
Location: USA
Please use the PHP code block when posting code to improve readability.

The error concerns this line,
PHP Code:
if (foundnum==0
See the problem? Missing $ in front of variable name.
angelwatt is offline   0 Reply With Quote
Old Dec 14, 2009, 12:48 PM   #3
SrWebDeveloper
macrumors 68000
 
SrWebDeveloper's Avatar
 
Join Date: Dec 2007
Location: Alexandria, VA, USA
 
Also...

PHP Code:
if (!'submit'
Should be $submit
__________________
Jim Goldbloom
Sr. Web Developer, owner GoldTechPro, LLC
http://www.GoldTechPro.com
SrWebDeveloper is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
gfortran Undefined symbols for architecture x86_64 Darren.Long Mac Programming 2 Jun 12, 2014 02:10 PM
Carrier: AT&T - Upgraded 1 Line to Put 5s on Other Line Activation Issue segrobja iPhone 20 Sep 25, 2013 10:23 PM
iTunes Problem Help Please!(language undefined s≤Mh) sabrinaluv Mac Applications and Mac App Store 1 Jan 16, 2013 07:31 AM
undefined symbols JNI Xcode 4 Lion thevibesman Mac Programming 1 Sep 23, 2012 03:24 PM
Undefined symbols for architecture x86_64: niharrocks OS X 0 Aug 30, 2012 02:45 AM

Forum Jump

All times are GMT -5. The time now is 07:24 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC