dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: SQL query to search database and output in table format

  1. #1
    Join Date
    Feb 2008
    Posts
    20

    SQL query to search database and output in table format

    I have a table setup on phpmyadmin as below

    | id | img | prt_no | descrp | price | str_lnk | spec_lnk | man_lnk |
    | 1 | URL link | XX-123-23 | blah..blah..blha | 234 | URL link | URL link | URL
    link|
    | 2 | URL link | XX-356-34 | blah..blah..blha | 567 | URL link | URL link | URL link|
    | 3 | URL link | XX-895-23 | blah..blah..blha | 789 | URL link | URL link | URL link|

    need a SQL query and output in the below format...request anybody to help me with the script......this is urgent!!

    ------------------------------------------------------------------------
    | shows img | part no. XX-123-23 | Price | spec_link | man_link |
    | |descrp: blah...blah..blah | | | |
    | |store: URL link | | | |
    ------------------------------------------------------------------------
    | shows img | part no. XX-123-23 | Price | spec_link | man_link |
    | |descrp: blah...blah..blah | | | |
    | |store: URL link | | | |
    ------------------------------------------------------------------------

  2. #2
    Join Date
    Oct 2009
    Posts
    9

    Talking Re: SQL query to search database and output in table format Reply to Thread

    Hi...





    read search category....Store in a variable
    my sql connect
    mysql select db
    then set query.....(for searching)
    Execute using mysql_query
    $res=mysql_fetch_array($result_execution)
    if($res)//i.e there is atleast one row matching the search query !!
    {
    echo "<table border=1 align ="center" >
    echo "<tr><th>Col__Name</th></tr>"// Do this for all columns
    for($i=0;$i=num of max_columns $i++)
    {
    echo "<tr><td>".$res[i]."</td></tr>";
    echo "</br>"
    }
    echo "</table>";
    }//if
    //thats it

    //c u back with smile buddy

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles