I seem to always use these lines when i am doing a select in PHP
 $product_query = "Select ProductID from productinfo where PartName = '".mysql_real_escape_string($data[0])."'";
 $product_result = mysql_query($product_query) ;
 $product = mysql_fetch_assoc($product_result) ;
 $my_product_id = $product['ProductID开发者_StackOverflow社区'];
This works but it clutters the page so i was wondering if there an way to do this in a more concise manner
You can make your own class which just returns the data after you give it the query.
$db = new Db;
$data = $db->query('blah');
print_r($data);
You can also use PDO, which has a similar, cleaner and safer API:
http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论