Hi i have some data which coming out from database in form of table like this, first i match some data with searching and then display it on page now  i need to download it as csv file format please help me check my code and i'm new in php. please check image too for the reference and please please help me  //import.php // echo "&lt;pre&gt;"; //print_r($_POST);die(); $keyword = $_POST['keyword']; $csvname = $_POST['csv_file'];  ?&gt;  &lt;table border ="1"&gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th&gt;id&lt;/th&gt;             &lt;th&gt;title&lt;/th&gt;             &lt;th&gt;count&lt;/th&gt;         &lt;/tr&gt;     &lt;/thead&gt;  &lt;?php  $row = 0; if (($handle = fopen("idata.csv", "r",)) !== FALSE) {     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {            $num = count($data);         // echo "&lt;p&gt; $num fields in line $row: &lt;br /&gt;&lt;/p&gt;\n";         $row++;         for ($c=0; $c &lt; $num; $c++) {             // echo $data[$c] . "&lt;br /&gt;\n";             $query = "SELECT * FROM wm_article WHERE id = '".$data[$c]."'";             $exec = mysqli_query($conn, $query);             $details = mysqli_fetch_array($exec);             $description = $details['title'] ." ".$details['description'];              //echo $description ;              //  $regex = "/royal/";              //  if (preg_match_all($regex, $description, $match))             //  {              //      print_r ($matches[0]);             //  }               if(preg_match_all("/\b".$keyword."\b/i", $description, $match,PREG_OFFSET_CAPTURE, 3)){                 // echo count(explode('royal', $description));                 // echo "&lt;pre&gt;";print_r($match);     ?&gt;  &lt;tr&gt;  &lt;td&gt;&lt;?php echo $details['id'];?&gt;&lt;/td&gt;  &lt;td&gt;&lt;a href ="&lt;?php echo $details['url'];?&gt;" target ="_blank"&gt;&lt;?php echo $details['title'];?&gt;&lt;/a&gt;&lt;/td&gt;  &lt;td&gt;&lt;?php echo count($match[0]); ?&gt;&lt;/td&gt; &lt;/tr&gt;    &lt;?php                 }         }     }  } ?&gt; &lt;?php    ?&gt; &lt;/table&gt;
What is the most efficient way to convert a MySQL query to CSV in PHP please?  It would be best to avoid temp files as this reduces portability (dir paths and setting file-system permissions required).  The CSV should also include one top line of field names.
how to sort file by DD-MM-YYYY dates in a file containing :  ... 18-11-2018:othercharacters 10-11-2018:othercharacters 03-10-2018:othercharacters 30-10-2018:othercharacters 27-09-2018:othercharacters 03-12-2018:othercharacters ...   the command :  sort -t- -k2 -k1    does not sort by date, what am I missing ? How best to determine if an argument is not sent to the JavaScript function If the dot product between two vectors is $0$, are the two linearly independent? If we have vectors $V$ and $W$ in $\mathbb{R^n}$ and their dot product is $0$, are the two vectors linearly independent?  I can expand $V_1 \cdot V_2 = 0 \Rightarrow v_1w_1+...+v_nw_n = 0$, but I don't understand how this relates to linear independence. The following question was asked on a high school test, where the students were given a few minutes per question, at most:     Given that,   $$P(x)=x^{104}+x^{93}+x^{82}+x^{71}+1$$   and,   $$Q(x)=x^4+x^3+x^2+x+1$$   what is the remainder of $P(x)$ divided by $Q(x)$?     The given answer was:     Let $Q(x)=0$. Multiplying both sides by $x-1$:   $$(x-1)(x^4+x^3+x^2+x+1)=0 \implies x^5 - 1=0 \implies x^5 = 1$$   Substituting $x^5=1$ in $P(x)$ gives $x^4+x^3+x^2+x+1$. Thus,   $$P(x)\equiv\mathbf0\pmod{Q(x)}$$     Obviously, a student is required to come up with a “trick” rather than doing brute force polynomial division. How is the student supposed to think of the suggested method? Is it obvious? How else could one approach the problem? Word for romantic partner you are living with but not married to 50 hertz sine wave in oscilloscope when I touch it I bought a new PicoScope USB oscilloscope and noticed that when I touch the tip of the probe with my hand I see a 50&nbsp;Hz signal of 2 volts on the screen. What is causing this? (Or rather, how is the mains 50 Hz sine wave getting through me to the scope?) CaseComment and CaseHistory relatedlist in visualforce page I want to add CaseComment and CaseHistory related list to my visualforce page.   &lt;apex:relatedList list=" " /&gt;  What should be the value for List attribute in the code defined above. When I added   &lt;apex:relatedList list="CaseHistory" /&gt; 'Histories' is also not working   &lt;apex:relatedList list="CaseComment" /&gt; 'CaseComments' is also not working  I get errors saying they are not valid child relationship name for entity Case.  Please help me out on this issue. Error when creating data with special characters and numbers My code will not project and store the feature layer in the scratch.gdb. "ERROR 999999 ... The table name is invalid. The table was not found. [17_5330_51961Lake]"  The interpreter doesn't like "-" characters or beginning or ending in a number. Does anyone know of a work around?  import arcpy import os  mxd = arcpy.mapping.MapDocument("Current") mxdpath = mxd.filePath (filepath, filename) = os.path.split(mxdpath) MCP_Path = str(filepath)  srl = os.path.join(MCP_Path, r"CoordinateSystems\NAD 1983 UTM Zone 17N.prj")  WBYLID = "17-5330-51961"  WBYLIDlabel = WBYLID.replace("-","_")  LakeOut = os.path.join(MCP_Path + "\OutputData\Scratch.gdb", WBYLIDlabel + "Lake") arcpy.Project_management(fl, LakeOut, srl) Convert .bbl file to .bib file How can I convert a .bbl file to a .bib file. I  lost my .bib file but I still have my .bbl file. Now , I need to add more references to my .bbl file according to a specific format which I need to produce using Bibtex, so how can I convert my .bbl file to a .bib file so I can add the new references according to the format.  Thanks for any insight. Writing a git post-receive hook to deal with a specific branch I'm an Indian student currently in Singapore as a Research Associate with a TEP valid for five months and have just been selected for an internship in Switzerland this summer.  Is it possible for me to obtain a Schengen visa from the Swiss Embassy in Singapore? Separate Biblatex bibliographies with newest entry and highest reference number at the top I would like to have a similar biblatex behaviour as described , i.e. separate bibliographies for different publication types, each bibliography should 1) be prefixed with a corresponding label (C for conference publications, J for journals etc), 2) sorted so that the newest entry is at the top (defined by the publication year) and 3) with reference numbers sorted in descending order per bibliography, i.e. the newest entry should have the highest number.  Journal articles ---------------- [J3]    reference from 2017 [J2]    reference from 2016 [J1]    reference from 2015  Conference publications ----------------------- [C4]    reference from 2017 [C3]    reference from 2017 [C2]    reference from 2016 [C1]    reference from 2015   I currently have the following:  \usepackage[backend=biber,         isbn=true,         giveninits=true,         style=numeric,         maxnames=99,         sorting=ydnt,         defernumbers=true,         autocite=superscript]{biblatex}  \subsection*{Journal articles} \begin{refcontext}[labelprefix=J] \printbibliography[type=article] \end{refcontext}  \subsection*{Conference publications} \begin{refcontext}[labelprefix=C] \printbibliography[type=inproceedings]   Separate bibliographies works fine, labelprefix also works as desired, sorting by year in descending order as well. However, if I try the solution mentioned in the above question I get very high reference numbers (in the 500s).  Is the above behaviour possible at all and, if yes, what is the most elegant solution using current biblatex etc.?  Thanks a lot in advance! The ring $ℤ/nℤ$ is a field if and only if $n$ is prime Let $n \in ℕ$. Show that the ring $ℤ/nℤ$ is a field if and only if $n$   is prime.   Let $n$ prime. I need to show that if $\bar{a} \neq 0$ then $∃\bar b: \bar{a} \cdot \bar{b} = \bar{1}$. Any hints for this ?  Suppose $ℤ/nℤ$ is a field. Therefore: for every $\bar{a} \neq 0$ $∃\bar b: \bar{a}\cdot \bar{b}=1$. How can I show that $n$ must be prime ? How does the radius of a pipe affect the rate of flow of fluid? Poiseuille's law states that the rate of flow of water is proportionate to $r^4$ where $r$ is the radius of the pipe. I don't see why.  Intuitively I would expect rate of flow of fluid to vary with $r^2$ as the volume of a cylinder varies with $r^2$ for a constant length. The volume that flows past a point is equal to rate of flow fluid, and thus it should vary with $r^2$.  I cannot understand the mathematical proof completely. Is there an intuitive explanation for this? How do I uninstall the command line tools for Xcode? We have a bunch of Mac at work that no longer require Xcode or command line tools so we'd like to remove them so the compilers aren't hanging around and we don't have to keep updating them when updates arrive. , but now that Xcode is an app store app you are left with the tools if you ever install them. Can we clean this other than wiping the OS for macs running 10.10 and newer? Why do my LED lights stay on, even when the switch is off? Determinant of a special $n\times n$ matrix $\operatorname{tr}(A)=\operatorname{tr}(A^{2})= \ldots = \operatorname{tr}(A^{n})=0$ implies $A$ is nilpotent Is Using Digital Signatures to prove identity a zero knowledge proof? Suppose Alice publishes a book with a public key in it, and later wants to prove that she wrote the book. She could sign challenge messages with her private key, and others could verify those signed messages. Alice is proving she knows a private key without revealing anything about it.  Is this an example of an interactive zero knowledge proof?   Or does this example somehow not apply to zero knowledge proofs? Assumptions of linear regression