guif Posted August 12, 2008 Share Posted August 12, 2008 hi! I have problems to give the value of a text. I have in a PHP this: <?php $searchq = strip_tags($_GET['q']); $getRecord_sql = 'select pkey from jiraissue where project = 10040 and pkey like "%'.$searchq.'%"'; $getRecord = mysql_query($getRecord_sql); if(strlen($searchq)>0){ echo '<ul>'; while ($row = mysql_fetch_array($getRecord)) { ?> <li><a href="lib/consultas.php?accion=E" onclick="load('lib/consultas.php?accion=E','consulta');return false;"> and in my file consultas.php, the case E: case 'E': $queEmp = "select pkey, created, UPDATED, reporter, assignee, summary, description from `jiraissue` where project = 10040 and pkey like ".$search-q2." "; $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error()); $totEmp = mysql_num_rows($resEmp); if ($totEmp> 0) { while ($rowEmp = mysql_fetch_assoc($resEmp)) { echo "<strong>Incidencia:</strong> <u>".$rowEmp['pkey']."</u><br>"; echo "<strong>Data:</strong> ".$rowEmp['created']." / ".$rowEmp['UPDATED']."<br>"; echo "<strong>Tecnic Obre:</strong> ".$rowEmp['reporter']."<br>"; echo "<strong>Tecnic Actual:</strong> ".$rowEmp['assignee']."<br>"; echo "<strong>Descripcio incidencia:</strong> ".$rowEmp['summary']."<br>"; echo "<strong>Intervencions:</strong> ".$rowEmp['description']."<br><br>"; } } break; mysql_close($conexion); Why the result of my query is: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/119282-make-a-query-with-the-value-of-text/ Share on other sites More sharing options...
guif Posted August 13, 2008 Author Share Posted August 13, 2008 If I put echo $search-q2; the result is 0. And, If I put echo $queEmp; i see a white page without results. With PHP is possible to give a variable of another PHP file? Quote Link to comment https://forums.phpfreaks.com/topic/119282-make-a-query-with-the-value-of-text/#findComment-615364 Share on other sites More sharing options...
adam84 Posted August 13, 2008 Share Posted August 13, 2008 Try this: $getRecord_sql = "select pkey from jiraissue where project = '10040' and pkey like '%".$searchq."%'"; Quote Link to comment https://forums.phpfreaks.com/topic/119282-make-a-query-with-the-value-of-text/#findComment-615683 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.