php - preg_match name and title with information in database -


I am trying to create a script that will get information about a DJ. What I want to do, the DJ matches the name of the DJ in the table titled If the DJ name is present then I want to select that line and want to use that information.

What do I do for the first time, if I make a list in the DJ array, then I want to match it with the title and if there is a match then I want to get the information.

The script is my now:

  $ ps = $ this-> Db- & gt; Ready ("Choose djname FROM` djcrew`"); $ Ps- & gt; SetFetchMode (PDO :: FETCH_ASSOC); $ Ps- & gt; Executed (); $ Selectit = $ ps- & gt; Fetch (); $ Result01 = preg_match ('/'. $. '/', $ Servertitle, $ matches); $ Ps01 = $ this- & gt; Db- & gt; Prepare ('Select' FROM `djcrew`WERE` DJname` =: DJname '); $ Ps01- & gt; Beyond Parm (': DJname', $ matches [0], PDO :: param_ast); $ Ps01- & gt; SetFetchMode (PDO :: FETCH_ASSOC); $ Ps01- & gt; Executed (); $ Data01 = $ ps01- & gt; Fatch ALL ();  

The problem is that now I am getting error error to string conversion. Selectit's output is:

  Array ([0] = Array ([djname] => test04) [1] => Array ([DJname] => test03) [2] ] = & Gt; Hey ([DJname] => test02) [3] = & gt; Array ([DJname] => Test 01))  

Have tried to talk but I can not do this work

[edit] Add mysql table.

Dump of MSLL table

  If not currently `djcrue` (` id 'int (11) no tap, `djname' varchar (48) no tap default ' 'Vowar' (48) do not tap default '', 'hobbies' varchar (48), default '', 'other' is not text, 'facebook' varchar (48) 'tap' default, 'twitter' varchar (4) No default default '', 'request' varchar (2) tap default '1', 'photo name' varchar (32) tap default '', `active` function (32) tap default '1') engine = InnoDB default charge = utf8 AUTO_INCREMENT = 3; Include in values ​​(1, `id`,` djname`, `name`, 'hobby', 'other', 'facebook', 'twitter', 'request', 'photo', 'active'). 'Test-1', 'Test-DJ', '', '', '', '', '1', 'test01', '0'), (2, 'Test 2', 'Testing - DJ' What I want to achieve is djname = .. name =, '', '', '', '', '1', 'test02', '1'),  

.. picname = $ Arr = $ array = ($ djname '= & gt; $ data01 [' djname '],' name '= & gt; $ data01 [' username '],' picname '= & gt;; Data 01 ['pic name']);

I think I've got the answer to your original question if it still Is the same

  $ ps = $ this- & gt; Db- & gt; Ready ("Select DJname FROM` djcrew`"); $ Ps- & gt; Executed (); $ Selectit = $ ps- & gt; Fetch (PDO :: FETCH_ASSOC); $ Djs = array (); Forex currency ($ selection as $ line) {$ djs [] = $ line ['DJname']; } If (in_array ($ servertitle, $ djs) {$ sql = 'SELECT * fROM djcrew WHERE djname IN' ('.' '$' '$ Db- & gt; Prepare ($ sql); $ stmt -> Execute (); $ result = $ stmt-> Get all ();}  

or if $ servertitle is an array

  if (array_intersect ($ servertitle, $ djs)) {$ sql = 'SELECT * fROM djcrew WHERE DJNN' (". '' Implode ('', '', $ DJs) $ Stmt = $ db- & gt; Ready ($ sql); $ Stmt-> Executed (); $ result = $ stmt-> Fatch ALL ();}  < / Pre> 

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -