mysql - How to mysql_query from same table with different where clause in same php file -


i have table containing 4 articles id 1,2,3 , 4 ordering value 1,2,3,4. have separate columns title, image etc. need them distinctly clause. did: article 1:

//topstory1 $sql_topstory1 ="select * topstory story_active='1' && story_order='1'"; $result_topstory1  = mysql_query($sql_topstory1); $row_topstory1     = mysql_fetch_array($result_topstory1);           $story1_title      = $row_topstory1['story_title']; $story1_abstract   = $row_topstory1['story_text']; 

and article 2

//topstory2 $sql_topstory2 ="select * topstory story_active='1' && story_order='2'"; $result_topstory2  = mysql_query($sql_topstory2); $row_topstory2     = mysql_fetch_array($result_topstory2);           $story2_title      = $row_topstory2['story_title']; $story2_abstract   = $row_topstory2['story_text']; 

as have reuse them in page.

problem is, first query works second 1 doesn't. seems mysql cannot execute 2 consecutive queries on same table in single php file. think there simple solution this...

please me :( love guys :)

there several possible reasons second query fail, fact it's second query in file not cause fail.

i expect article 2 not have active flag set 1, causing empty result set.

another option may have closed mysql connection after first query, can't execute query. (general rule: don't close database connections. php takes care of that.)


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -