The project url is at https://hub.jazz.net/project/andrewhujazz/PHPMySQLProject/overview.You can apply a jazzhub account to fork his application to deploy on the BlueMix,or use git clone command to clone the project on your local side.The git url is https://hub.jazz.net/git/andrewhujazz/PHPMySQLProject.
The detail function you can see below screenshot,it provide create table,insert table,drop table,
When you write code you need to notice ,when you open the mysql connection,you also need to provide port,since the port might be not default port..I list some code for your reference.
<div id="content2">
<h2>MySQL Service</h2><hr>
<b>MySQL Information</b>
<hr>
<?php
$services = getenv("VCAP_SERVICES");
$services_json = json_decode($services,true);
$mysql_config = $services_json["mysql-5.5"][0]["credentials"];
$db = $mysql_config["name"];
$host = $mysql_config["host"];
$port = $mysql_config["port"];
$username = $mysql_config["user"];
$password = $mysql_config["password"];
if ($host=="") {
echo "<b> There is no mysql service.</b><br>";
} else {
?>
MySQL DB Name : <?php echo $db ?> <br>
MySQL Host : <?php echo $host ?> <br>
MySQL Port : <?php echo $port ?> <br>
MySQL username : <?php echo $username ?> <br>
MySQL password : <?php echo "********" ?><br>
<hr>
<b> Create Table</b><br>
<?php
$conn = mysql_connect($host . ':' . $port, $username, $password);
if(! $conn ) {
echo('Could not connect: ' . mysql_error());
}
mysql_select_db($db);
if ($cmd=="create") {
$sql_create = 'CREATE TABLE SAMPLE (name CHAR(30), comment CHAR(255), time DATETIME)';
$retval = mysql_query($sql_create, $conn );
if(! $retval ) {
echo('Could not create database table: ' . mysql_error() . '<br/>');
} else {
echo "<script>alert('Created database table successfully')</script><script>window.location='mysql.php'</script>";
}
} ?>
<a href="mysql.php?cmd=create">[Create] </a>
<hr>
<b> Insert Data</b><br>
<?php
$sql_read = 'SELECT * FROM SAMPLE ';
$retval = mysql_query($sql_read, $conn );
if(! $retval )
{
echo('Could not read SAMPLE table: ' . mysql_error());
}
echo "<table><tr><td>name</td><td>comment</td><td>Date</td>";
while ($dbfield = mysql_fetch_assoc($retval)) {
echo "<tr><td>".$dbfield['name'] . '</td>';
echo "<td>".$dbfield['comment'] . '</td/>';
echo "<td>".$dbfield['time'] . '</td></tr>';
}
echo "</table>";
?>
<?php
if ($cmd=="insert") {
$sql_insert = 'INSERT INTO SAMPLE (name, comment, time) VALUES ( "name", "comment", NOW() )';
$retval = mysql_query($sql_insert, $conn );
if(! $retval ) {
echo('Could not enter data: ' . mysql_error() . '<br/>');
} else {
echo "Entered data successfully<br/><script>window.location='mysql.php'</script>";
}
} ?>
<a href="mysql.php?cmd=insert">[Insert] </a>
<hr>
<b> Drop Table</b><br>
<?php
if ($cmd=="drop") {
$sql_drop = 'DROP TABLE SAMPLE';
$retval = mysql_query($sql_drop, $conn );
if(! $retval ) {
echo('Could not drop database table: ' . mysql_error() . '<br/>');
} else {
echo "<script>alert('Dropped database table successfully')</script><script>window.location='mysql.php'</script>";
}
} ?>
<a href="mysql.php?cmd=drop">[Drop] </a>
<?php }?>
</div>
Also when you deploy your php application,you had better provide a manifest.yml,it describe the deployment info on the BlueMix.See below sample manifest.yml
---
applications:
- name: myphpsample
memory: 128M
instances: 1
host: myphpsample
domain: ng.mybluemix.net
buildpack: https://github.com/dmikusa-pivotal/cf-php-build-pack.git
path: .
After deployment,you need to bind your php application on existing my sql service.
Great Post, Actually PHP is a beautiful source for developing a database driven web application, I love this post, thanks for spending your time for discussing about this topic.
ReplyDeleteRegards,
PHP Training in Chennai|PHP Course in Chennai
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeletePHP Training in chennai | PHP Training Course
PHP Training in chennai | Online PHP Course
This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me
ReplyDeletebest rpa training in chennai
rpa training in chennai |
rpa online training
rpa course in bangalore
rpa training in pune
rpa training in marathahalli
rpa training in btm
This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me
ReplyDeletebest rpa training in chennai
rpa training in chennai |
rpa online training
rpa course in bangalore
rpa training in pune
rpa training in marathahalli
rpa training in btm
A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.
ReplyDeletepython course in pune | python course in chennai | python course in Bangalore
Very good brief and this post helped me alot. Say thank you I searching for your facts. Thanks for sharing with us!
ReplyDeleteData Science training in Chennai | Data Science Training Institute in Chennai
Data science training in Bangalore | Data Science Training institute in Bangalore
Data science training in pune | Data Science training institute in Pune
Data science online training | online Data Science certification Training-Gangboard
Data Science Interview questions and answers
Awesome blog with lots of information. It is really helpful for all.
ReplyDeleteDevOps Training in Chennai
DevOps Certification in Chennai
AWS Training in Chennai
Data Science Course in Chennai
ccna course in Chennai
R Programming Training in Chennai
Angularjs Training in Chennai
RPA Training in Chennai
Blue Prism Training in Chennai
Thanks you for sharing this unique useful information content with us...
ReplyDeleteInformatica Bangalore
I wanted to leave a little comment to support you and wish you a good continuation. Wishing you the best of luck for all your blogging efforts.
ReplyDeletedata analytics courses
data science interview questions
business analytics courses
data science course in mumbai
Thanks for sharing such knowledgeable information on AWS. Looking forward to see more of such informative posts.
ReplyDeleteAWS Training In Hyderabad
The Content is very useful for the Beginners.
ReplyDeleteData Science Training Course In Chennai | Data Science Training Course In Anna Nagar | Data Science Training Course In OMR | Data Science Training Course In Porur | Data Science Training Course In Tambaram | Data Science Training Course In Velachery
I like viewing websites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!
ReplyDeleteCorrelation vs Covariance
I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful.
ReplyDeleteartificial intelligence course
I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.
ReplyDeleteI read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community. data science courses
ReplyDeleteGlad to chat your blog,I seem to be forward to more reliable articles and i think we all wish to thank so many good articles,blog to share with us.data scientist courses
ReplyDeleteYou can take pride in the way you write such brilliant articles. It is reflected in the pattern of writing when a writer does the required homework to write quality material. Thank you so much for sharing this magnificent content.
ReplyDeleteSAP training in Mumbai
SAP course in Mumbai
I have truthfully never come across such overwhelmingly good piece of content. I agree with your valid points and your ideas. This piece of information is really great.
ReplyDeleteThank you so much.
SAP training in Kolkata
SAP course in kolkata
Thanks for sharing information to our knowledge, it helps me plenty keep sharing…
ReplyDeleteData Science Training In Bangalore
Best Data Science Training Institute in Bangalore
Your site is genuinely cool and this is an unprecedented moving article and If it's not all that much difficulty share more that way. Much thanks to you…
ReplyDeleteAI Training in Hyderabad
Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best.
ReplyDeletedata analytics course in hyderabad
This post is incredibly helpful for those looking to perform CRUD operations with PHP on BlueMix. The detailed code examples, explanations, and provided links make it a valuable resource for developers. Thank you for sharing this insightful guide!
ReplyDeleteData Analytics Courses in Nashik
Hello Blogger,
ReplyDeleteThis article provides a clear and detailed guide on using PHP for CRUD operations on BlueMix, making it easier for developers to work with MySQL databases in the cloud. Good job.
Data Analytics Courses In Dubai
Hey! Very interesting blog, and post is a valuable addition to the resources available for developers looking to leverage BlueMix for their projects! Thank you!
ReplyDeleteData Analytics Courses In Chennai
The use of PHP for CRUD operations on BlueMix is explained in precise detail in this article, making it simpler for developers to interact with MySQL databases in the cloud. Well done.
ReplyDeleteData Analytics Courses in Agra
This blog could be a game-changer for those looking to master the basics of Create, Read, Update, and Delete operations in PHP on the BlueMix platform.
ReplyDeleteDigital marketing courses in illinois
Thanks for sharing valuable and insightful blog on PHP CRUD operation on BlueMix.
ReplyDeleteDigital Marketing Courses in Italy
I found the blog post on PHP CRUD operation on BlueMix very interesting and informative.
ReplyDeletedata analyst courses in limerick
This was some good code. Thanks for sharing.
ReplyDeleteInvestment banking analyst jobs
Thank you for sharing knowledgeable post on PHP CRUD operation on BlueMix.
ReplyDeleteInvestment banking training Programs
The content of your blog is precise and straightforward, which makes it easy to understand.
ReplyDeleteData analytics framework