twizler
Members-
Posts
11 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
twizler's Achievements
Newbie (1/5)
0
Reputation
-
Finally fixed my own issue. I was missing header("Content-type: text/xml"); in my xml document so javascript didnt know what it was looking at.
-
I have been trying to get this code running. Here is my code as it stands. The error I am getting is xmldoc has no properties.... My code: var XMLHttpRequestObject = false; if(window.XMLHttpRequest){ XMLHttpRequestObject = new XMLHttpRequest(); } else if(window.ActiveXObject){ XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } function showData(xmldoc){ var docElement, usernameNode, usernameidNode, displayText; docElement = xmldoc.documentElement; usernameNode = docElement.firstChild; usernameidNode = usernameNode.nextSibling; displayText = usernameNode.firstChild.nodeValue + ' ' + usernameidNode.firstChild.nodeValue; var target = document.getElementById('usernameoutput'); target.innerHTML = displayText; } function getUsernames(){ var searchvalue = document.getElementById("uname").value; var datasource = "search_profiles_now.php?searchvalue=" + searchvalue; if(XMLHttpRequestObject){ document.getElementById('loadimage').style.display = "inline"; XMLHttpRequestObject.open("GET", datasource, true); XMLHttpRequestObject.onreadystatechange = function() { if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200){ var xmldocument = XMLHttpRequestObject.responseXML; showData(xmldocument); document.getElementById('loadimage').style.display = "none"; } } XMLHttpRequestObject.send(null); } } I am running firefox and have fire bug. My javascript is getting my xml data back to the browser but im still getting xmldoc has no properties. Any ideas?!
-
Instead of: mysql_fetch_array($result,MYSQL_NUM); Try: mysql_fetch_num($result);
-
$query variable is your sql statement. $result = mysql_query($query); $arrayname = mysql_fetch_assoc($result) To pull from an array do: $arrayname['rowtitle']; There are three different types to "fetch" from your query. Assoc: Returns an associative array Num: Return enumerated array Both: Return Both
-
User a variable in your sql statement: $sql = "SELECT ".$choice." FROM Member WHERE username = '$_SESSION[username]'"; make $choice = the users choice.
-
This code: [code]<html> <head> <title>Search Results!</title> <?php require_once('system_errors.php'); require_once('dbconnect.php'); ?> </head> <body> <h1>Search Results</h1> <?php $search_term = $_POST['search_term']; $lowend_price = $_POST['lowend_price']; $highend_price = $_POST['highend_price']; $city = $_POST['city']; $state = $_POST['state']; $look_in = $_POST['look_in']; $query = "select * from ".$look_in.""; if ($look_in == "General_Needs") { $look_again = "General"; } else if ($look_in == "Cars_Needs") { $look_again = "Cars"; } else if ($look_in == "Housing_Needs") { $look_again = "Home"; } if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && $lowend_price && $city && $state) { $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && !$lowend_price && !$highend_price && !$city && !$state) { $query .= " where ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && !$highend_price && !$city && !$state) { $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price = '".$lowend_price."'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && !$city && !$state) { $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && $city && !$state) { $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && !$highend_price && !$city && !$state) { $query .= "where ".$look_again."_Price = '".$lowend_price."'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && $highend_price && !$city && !$state) { $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && $highend_price && $city && !$state) { $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_City like '%".$city."%'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && $lowend_price && $highend_price && $city && $state) { $query .= " where ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && !$lowend_price && $highend_price && !$city && !$state) { $query .= " where ".$look_again."_Price = '".$highend_price."'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && !$lowend_price && $highend_price && !$city && !$state) { $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price = '".$highend_price."'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && !$city && !$state) { $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Price >= '".$lowend_price."'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && $highend_price && $city && !$state) { $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_City like '%".$city."%'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && !$lowend_price && !$highend_price && $city && !$state) { $query .= " where ".$look_again."_City like '%".$city."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && !$lowend_price && !$highend_price && $city && !$state) { $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_City like '%".$city."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $lowend_price && !$highend_price && $city && !$state) { $query .= " where ".$look_again."_Title like '%".$search_term."%' and ".$look_again."_Price = '".$lowend_price."' and ".$look_again."_City like '%".$city."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && $lowend_price && $city && !$state) { $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && !$lowend_price && !$city && $state) { $query .= " where ".$look_again."_State = '".$state."'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && !$highend_price && !$lowend_price && !$city && $state) { $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && !$lowend_price && !$city && $state) { $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price = '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && $lowend_price && !$city && $state) { $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && !$lowend_price && $city && $state) { $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && $highend_price && $lowend_price && !$city && $state) { $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Price <= '".$highend_price."'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && !$lowend_price && !$city && !$state) { $query = "Select * from ".$look_in.""; } else if ($look_in == "".$look_again."_Needs" && !$search_term && $highend_price && !$lowend_price && !$city && $state) { $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price <= '".$highend_price."'"; } else if ($look_in == "".$look_again."_Needs" && !$search_term && !$highend_price && $lowend_price && !$city && $state) { $query .= " where ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && $highend_price && !$lowend_price && $city && $state) { $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Price <= '".$highend_price."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && !$highend_price && $lowend_price && $city && $state) { $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Price >= '".$lowend_price."' and ".$look_again."_Title like '%".$search_term."%'"; } else if ($look_in == "".$look_again."_Needs" && $search_term && !$highend_price && !$lowend_price && $city && $state) { $query .= " where ".$look_again."_City like '%".$city."%' and ".$look_again."_State = '".$state."' and ".$look_again."_Title like '%".$search_term."%'"; } $result = mysql_query($query) or die(); while ($row = mysql_fetch_assoc($result)) { if ($look_in == "General_Needs") { echo $row['General_Title']; echo $row['General_City']; echo $row['General_State']; echo $row['General_Price']; echo $row['General_Desc']; } else if ($look_in == "Cars_Needs") { echo $row['Cars_Title']; echo $row['Cars_Make']; echo $row['Cars_Year']; echo $row['Cars_Color']; echo $row['Cars_Price']; echo $row['Cars_City']; echo $row['Cars_State']; echo $row['Cars_Desc']; } else if ($look_in == "Housing_Needs") ( echo $row['Home_Title']; echo $row['Home_Beds']; echo $row['Home_Pets']; echo $row['Home_Own_Rent']; echo $row['Home_Price']; echo $row['Home_City']; echo $row['Home_State']; echo $row['Home_Desc']; } } ?> </body> </html>[/code] is giving me this error: Parse error: syntax error, unexpected T_ECHO in /home/u2/kabbash615/html/ineedblank/Search_Results.php on line 219 Why? I have done some research on the error and everyone says its a missing ; or a tag I opened and didnt end but I cannot find it... Please help!