0

i have an array names skills in which there are various skills

now i wanna create aquery like

select * from tablename where skills regexp ""skill1" and skills regexp "skills2" and skills regexp "skills3";

how could i do this..

upon defining a string for concatenation php shows error....`$s=select * from $table[0] where skills regexp;

help!`

2
Contributors
5
Replies
22
Views
3 Years
Discussion Span
Last Post by broj1
0

It would help if you could be more specific. Show some code so we can see things like the array structure and values, the table structure, the complete error message etc.

0
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <form name="f1" action="wel.php" method="post">
            <textarea name="table" placeholder="table"></textarea>
            <textarea name="skills" placeholder="skill or item or spec"></textarea>
            <textarea name="city" placeholder="city"></textarea>
            <textarea name="region" placeholder="region"></textarea>
            <textarea name="country" placeholder="country"></textarea>
        <input type="submit">
        </form>
        </body>
</html>
0
<?php
$count = 0;
    foreach($_POST as $item)
    {
    $count += (is_array($item)) ? count($item) : 1;
    }
   // echo "Items = $count";


$skills = explode(" ", $_POST["skills"]);
$table = explode(" ", $_POST["table"]);
$city = explode(" ", $_POST["city"]);
$region = explode(" ", $_POST["region"]);
$country = explode(" ", $_POST["country"]);
print_r($country);

/* @var $table type */
$s=select * from $table[0] where skills regexp;

if(!empty($skills[0])){
for ($i=0;$i<count($skills);$i++)
{

}
}
?>

Edited by ankit1122

0

Post the table structure and complete error message (see my post above).

reply

Please be patient if people don't have time to reply immediately :-)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.