php - issue with searching for string inside the array -
i hour trying understand doing wrong here. no output.
the connection ok, array full of data
<?php header('content-type: text/html; charset=utf-8'); // here's argument client. $domain = $_get['string']; $quest=$_get['quest']; $event=$_get['event']; $con = mysql_connect('localhost', '******', '********'); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("vocabulary", $con); $sql="select * `0` event_name = '".$event."' , quest_id = '".$quest."'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $key = array_search($domain, $row); echo $key; mysql_close($con); ?>
any ideas?? thanks
a few things.
- you selecting table named
0
. don't think should doing that. - since doubt table
0
exists, guess have error @mysql_fecth_array
. try puttingerror_reporting(e_all);
@ start of script. array_search
returnsfalse
if doesn't find anything. tryvar_dump($key);
instead.- your code has serious security problem. suggest move on pdo or mysqli.
Comments
Post a Comment