I want to query a database (search) and pass the desired columns from the search results to another page like so:[php]<?php
//address error handling
ini_set (‘display_errors’, 1);
error_reporting (E_ALL & ~E_NOTICE);
//authenticate user
require(‘auth.php’);
if (isset($_POST[‘submit’])) {
// Connect to the database.
require_once ('config.php');
//Query the database.
$sql = "SELECT* FROM members INNER JOIN images ON members.member_id = images_member_id WHERE members.ethnicity = '{$_POST['ethnicity']}'";
$query = mysql_query($sql);
if(mysql_num_rows($query) > 0){ while(($row = mysql_fetch_assoc($query)) !== false)
{
//Redirect to search results page.
header("Location: search_results.php?friend='.$row['member_id'].'&me='.$_SESSION['id'].' &pic='.$row['image'].'&name='.$row['username'].'");
}
} else { //If no results found.
echo 'No results match this search query.' ;
}
}
?>
[/php]
I get the following error when i try to run the page (by submitting a form from another page which executes this page):
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a4993450/public_html/profile_search.php on line 31
The culprit line is this one:
header(“Location: search_results.php?friend=’.$row[‘member_id’].’&me=’.$_SESSION[‘id’].’ &pic=’.$row[‘image’].’&name=’.$row[‘username’].’”);
As you can see, I eliminated all white space between the variables and concatenations, thinking that that was the problem but I keep getting the error message. I’m at a loss about what to do next. Any help?