Jump to content

salimalisalim

New Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About salimalisalim

  • Rank
    Newbie
  1. salimalisalim

    How to show the suggestion text according to prefix

    Thank you very much, It works...
  2. salimalisalim

    How to show the suggestion text according to prefix

    I updated like below with the length of $q, but still, I am getting all the words containing the letter if (strncasecmp ($y->item(0)->childNodes->item(0)->nodeValue,$q,strlen($q)))
  3. salimalisalim

    How to show the suggestion text according to prefix

    Thank you so much for the great descriptions, I modified my code as below, but still, it's giving me the previous result. if (strncasecmp ($y->item(0)->childNodes->item(0)->nodeValue,$q, 10)) {
  4. salimalisalim

    How to show the suggestion text according to prefix

    Thanks for the reply, So how will be my modified code ? I am new to programming so, I don't have that much idea.
  5. Hi, I have the below code to show the suggestion text, now it’s showing all the words which contain the letter when I first type in the text field. For example, If I typed the letter “a”, it should show only the words which start with the letter “a”, now it’s showing all the words which contain the letter “a” in the suggestion. Below is my code. Thanks in advance. <?php $xmlDoc=new DOMDocument(); $xmlDoc->load("links.xml"); $x=$xmlDoc->getElementsByTagName('link'); //get the q parameter from URL $q=$_GET["q"]; //lookup all links from the xml file if length of q>0 if (strlen($q)>0) { $hint=""; for($i=0; $i<($x->length); $i++) { $y=$x->item($i)->getElementsByTagName('title'); $z=$x->item($i)->getElementsByTagName('url'); if ($y->item(0)->nodeType==1) { //find a link matching the search text if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q)) { if ($hint=="") { $hint="<a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } else { $hint=$hint . "<br /><a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } } } } } // Set output to "no suggestion" if no hint was found // or to the correct values if ($hint=="") { $response="no suggestion"; } else { $response=$hint; } //output the response echo $response; ?>
  6. salimalisalim

    Inserting into two tables at same time

    Hi, I have a form, while submitting this i need to store the values into two different tables in a database,Some values will store in a table and others will store in a another table. How can i write it's query ? For Example, $sql="INSERT INTO table1 (field1, field2, field3,field4) VALUES ('$_POST[column1]','$_POST[column2]','$_POST[column3]','$_POST[column4]')"; $sql2="INSERT INTO table2 (field5, field6, field7,field8) VALUES ('$_POST[column5]','$_POST[column6]','$_POST[column7]','$_POST[column8]')"; For me like this, Only one $sql values are only inserting, $sql2 values are not inserting. Thanks in Advance
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.