Hi,
I am echoing 3 columns skill1, skill2 and skill3.
I am trying to echo them into a query skills.php?skill1=(echoskill1 or skill2 or skill3) but I need it to be skills.php?skill=(echoskill1 or skill2 or skill3)
So instead of this…
skills.php?skill1=(echoskill1 or skill2 or skill3)
skills.php?skill2=(echoskill1 or skill2 or skill3)
skills.php?skill3=(echoskill1 or skill2 or skill3)
I have this…
skills.php?skill=(echoskill1 or skill2 or skill3)
send it as an array.
$skills = array('skill1' => 'skill value 1', 'skill2' => 'skill value 2', 'skill3' => 'skill value 3');
echo "skills.php?skill=" . base64_encode($skills);
Many thanks, that looks ideal.
How do I fit the query code together with this code?
I have tried this…
<?php
if (isset($_GET['skills']))
$skills = array('skill1' => 'skill value 1', 'skill2' => 'skill value 2', 'skill3' => 'skill value 3');
echo "skills.php?skill=" . base64_encode($skills);
$sql = "SELECT * FROM users WHERE skills = '$skill1'";
$res = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($res);
$num_rows = mysql_num_rows($res);
?>
$skills = array('skill1' => 'skill value 1', 'skill2' => 'skill value 2', 'skill3' => 'skill value 3');
echo "skills.php?skill=" . base64_encode($skills);
I gave you the code to build the link to the page that shows the skills. To read the skills from the link you will need to reverse it.
$skillsEncoded = $_GET['skill'];
$skills = base64_decode($skillsEncoded);
// now you have a multi-dimensional array again stored in $skills
Thanks,
When I try to apply it echoes “skills.php?skill=” which is the same as when I remove that peice of code.
<?php
if (isset($_GET['skills']))
$skills = array('skill1' => 'skill value 1', 'skill2' => 'skill value 2', 'skill3' => 'skill value 3');
echo "skills.php?skill=" . base64_encode($skills);
$skillsEncoded = $_GET['skill'];
$skills = base64_decode($skillsEncoded);
$sql = "SELECT * FROM users WHERE skill1 = '$skills'";
$res = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($res);
$num_rows = mysql_num_rows($res);
?>
<div class="whyevspacerheader">
Search Event Skills
</div>
<?php echo ($row['skill1']); ?>
</div>
My point was, replace your current links:
skills.php?skill=(echoskill1 or skill2 or skill3)
So they are generated using
$skills = array('skill1' => 'skill value 1', 'skill2' => 'skill value 2', 'skill3' => 'skill value 3');
echo "skills.php?skill=" . base64_encode($skills);
Then on skills.php, read the skill variable that is passed using
$skillsEncoded = $_GET['skill'];
$skills = base64_decode($skillsEncoded);
// now you have a multi-dimensional array again stored in $skills