AhmadYousef Posted November 16, 2014 Share Posted November 16, 2014 Hi guys .. please help me .. I don't know how to do this and I tried but there were no satisfied results.. I want to retrieve a Title (ing_title) from a database called k_db2 , in a table called content_langs depending on its ID , which called ing_contID example: if ing_contID=1 , then show the ing_title with this id ing_contID the above code should be in a php file .. then I want to include this php file inside the header of my website.. by importing the ing_contID from the database and depending on it the title should be shown.. I really tried but I couldn't find any solution .. if you could help me in the first part of this problem I'll be glad .. Link to comment https://forums.phpfreaks.com/topic/292496-retrieving-specific-data-from-mysql-using-php/ Share on other sites More sharing options...
Barand Posted November 16, 2014 Share Posted November 16, 2014 First thing to do is connect to your database server and set the default database http://php.net/manual/en/mysqli.construct.php Then you you need to query your database table and get the result set http://php.net/manual/en/mysqli.query.php The query you need will be "SELECT ing_title FROM content_langs WHERE ing_contID = 1" Next, get the record from the result set http://php.net/manual/en/mysqli-result.fetch-assoc.php Examples on the above page links should help you Link to comment https://forums.phpfreaks.com/topic/292496-retrieving-specific-data-from-mysql-using-php/#findComment-1496720 Share on other sites More sharing options...
AhmadYousef Posted November 18, 2014 Author Share Posted November 18, 2014 wow !! thank you so so so so much for this .. this really helped me ... :D thank you again .... I really appreciate it .. Link to comment https://forums.phpfreaks.com/topic/292496-retrieving-specific-data-from-mysql-using-php/#findComment-1496858 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.