|
<input type="text" name="text2" value="<?
echo $json = getemployee();
$json->var
?>"/>
obj is your Variable name
use print_r(getemployee()) view json Structure;
|
|
|
|
|
Dear All,
I'm a win app programmer but a very fresher in web. Now I have to do with web, so I am studying in web with PHP. I have to figure out the problem that I want to show data from Sql Database on PHP web page via web service by generating JSON file. I don't use the internet. All are in local only. I create web page two text box and one button. I type 01 employee code in textbox1 and click the button to get employee name from sql db. There are function in web services. When the button click, PHP page will send 01 to web service and then the function in web service will get the emp name from sql db and returns json file and finally PHP page will be read json file and show emp name in textbox2. So I can't control one round procedure PHP, Web Service, JSON and Sql db. Please help me. Very thanks everyone. I hope with great wish for that. Please.
Thanks you all
|
|
|
|
|
use function to send response to browser in json format or just echo response array in json
public function send_response($response_data){
//$resonse_date is of array type
echo json_encode($response_data);
}
catch json response in ajax callback for success .
$.ajax({
url: 'php service call' ,
type : 'POST',// type of call GET ,POST
data : JSON.stringify(params),//pramas array
success :function(data) {//call back functin
//reponse data in json format
//put here your logic
},
error : function(data){alert('if any error');}
});
|
|
|
|
|
I m installed sqlserver for my final project... i wanot installed properly.. i uninstalled it.. no i m installng it again but getting the following error when i click on the icon of "SQL Server Management Studio Express".. plz help me.. i would be very thnkful to you.
"The automatically saved settings file ' C:\Users\Bilal\Documents\ SQL Server
Management Studio Expres\Settings\CurrentSettings-2014-06-18.vssettings' cannot be found.You can change this file on the 'Import and Export Settings' Tools Options Page. the IDE will use the most recent settings for this session."
|
|
|
|
|
Hi,
f anyone tried a PHP framework, which you'll recommend please?
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
None!
Frameworks are good, if you get in the area of content management, otherwise they are just a waste of time.
|
|
|
|
|
Hi guys! I need your help !
I'm doing a form in PHP and a want to display in my dropdownlist name column from my DB and save the name_id of that name selected from dropdownlist in DB.
Here is my code
if(isset($_POST["submit"]))
{
$bookshop_id = mysql_real_escape_string($_POST["bookshop_id"]);
$book_id = mysql_real_escape_string($_POST["book_id"]);
$quantity = mysql_real_escape_string($_POST["quantity"]);
mysql_query("INSERT INTO `books_bookshop`(`bookshop_id`,`book_id`,`quantity`)
VALUES ('" . $bookshop_id . "','" . $book_id . "','" . $quantity . "')")
or die ("Book could not be registered.");
}
?>
<form method="post" action="#">
<label for="bookshop_id">Bookshop Name</label>
<select style="width:148px;" id="bookshop_id" name="bookshop_id" value="bookshop_id" >
<?php
$query = mysql_query("SELECT `name`,`bookshop_id` FROM `bookshop`");
while ($row = mysql_fetch_array($query))
{
?>
<option>
<?php echo $row["name"]; ?>
</option>
<?php } ?>
</select>
</td>
</tr>
<tr><td><select name="book" id="book" value="book">
<?php $query = mysql_query("SELECT `name` FROM `books`");
while ($row = mysql_fetch_array($query)){?>
<option><?php echo $row["name"]; ?></option>
<?php } ?>
</select>
<tr>
<td><input type"submit" name="submit" value="Register book"></td>
</tr>
</table>
</form>
|
|
|
|
|
<form method="post" action="#">
<label for="bookshop_id">Bookshop Name</label>
<select style="width:148px;" id="bookshop_id" name="bookshop_id" value="bookshop_id" >
<?php
$query = mysql_query("SELECT `name`,`bookshop_id` FROM `bookshop`");
while ($row = mysql_fetch_array($query))
{
?>
|
|
|
|
|
<option>
<?php echo $row["name"]; ?>
</option>
<?php } ?>
</select>
</td>
</tr>
<tr><td><select name="book" id="book" value="book">
<?php $query = mysql_query("SELECT `name` FROM `books`");
while ($row = mysql_fetch_array($query)){?>
<option><?php echo $row["name"]; ?></option>
<?php } ?>
</select>
<tr>
<td><input type"submit" name="submit" value="Register book"></td>
</tr>
</table>
</form>
|
|
|
|
|
Why have you posted three messages? It looks like you have answered your own question.
Use the Edit link at the bottom of your original, add the extra code and description, and delete the other two messages.
|
|
|
|
|
You know that mysql_ is deprecated for long, right ?
"Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:
mysqli_query()
PDO::query()
"
Source
http://php.net/manual/en/function.mysql-query.php[^]
|
|
|
|
|
have a tree menu(category,subcategory,sub-subcategory...) its all in a single table and uses parentID to determine layout of the menu. would like to now be able to update the menu by adding new menus(not on the server side). have a dropdown list of the menus where you select the parent from existing menus from the table(if you select none,then creates a new category in the table else inserts under matching parent based on parentID).need help parsing the selection from drop down menu to the parentID column in the table. am new at this so hope my question makes sense.
Reggie
|
|
|
|
|
Use PHP and angularjs to generate dynamic menu.
1.php service read your data send response in json format.
2.Angular app init with menu item.
your html code like (menu.html)
<pre>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<style>
*{
margin ;
padding ;
}
body{
font:15px/1.3 'Open Sans', sans-serif;
color: #5e5b64;
text-align:center;
}
a, a:visited {
outline:none;
color:#389dc1;
}
a:hover{
text-decoration:none;
}
section, footer, header, aside, nav{
display: block;
}
/*-------------------------
The menu
--------------------------*/
nav{
display:inline-block;
margin:60px auto 45px;
background-color:#5597b4;
box-shadow 1px 1px #ccc;
border-radius:2px;
}
nav a{
display:inline-block;
padding: 18px 30px;
color:#fff !important;
font-weight:bold;
font-size:16px;
text-decoration:none !important;
line-height:1;
text-transform: uppercase;
background-color:transparent;
-webkit-transition:background-color 0.25s;
-moz-transition:background-color 0.25s;
transition:background-color 0.25s;
}
nav a:first-child{
border-radius:2px 0 0 2px;
}
nav a:last-child{
border-radius 2px 2px 0;
}
nav.home .home,
nav.projects .projects,
nav.services .services,
nav.contact .contact{
background-color:#e35885;
}
p{
font-size:22px;
font-weight:bold;
color:#7d9098;
}
p b{
color:#ffffff;
display:inline-block;
padding:5px 10px;
background-color:#c4d7e0;
border-radius:2px;
text-transform:uppercase;
font-size:18px;
}
</style>
<!-- Adding the ng-app declaration to initialize AngularJS -->
<script type="text/javascript">
var menuApp = angular.module('menuApp', []);
menuApp.controller('menuCtrl', function ($scope,$http) {
$scope.active = 'Blog';
$scope.description = ''
$scope.menuList = [
{
'name': 'Home',
'description': 'Home page.'
},
{
'name': 'Projects',
'description': 'projects page.'
},
{
'name': 'Services',
'description': 'services page.'
},
{
'name':'Contact',
'description':'contact page.'
}
];
$scope.activeMenu = function(menu){
$scope.active = menu.name;
$scope.description = menu.description;
};
$scope.loadMenu = function() {
$http({
method: 'GET',
url: 'menu.php' //url contain your php service which return data in json format
}).success(function(data) {
$scope.menuList = data;
}).error(function() {
});
}
// $scope.loadMenu();
});
</script>
<div id="main" ng-app="menuApp">
<!-- The navigation menu will get the value of the "active" variable as a class.
The $event.preventDefault() stops the page from jumping when a link is clicked. -->
<div ng-controller="menuCtrl">
<nav class="{{active}}" ng-click="$event.preventDefault()" ng-repeat="menu in menuList">
<!-- When a link in the menu is clicked, we set the active variable -->
<a href="#" class="{{menu.name}}" ng-click="activeMenu(menu)">{{menu.name}}</a>
</nav>
<!-- ng-show will show an element if the value in the quotes is truthful,
while ng-hide does the opposite. Because the active variable is not set
initially, this will cause the first paragraph to be visible. -->
<p ng-hide="active">Please click a menu item</p>
<p ng-show="active">You chose <b>{{active}}</b> </p>
<span ng-show="active"> <b>{{description}}</b></span>
</div>
</div>
</pre>
//your ajax call get response from php service while page load and populate your menu as per your choice.
|
|
|
|
|
Hi guys;
I've been trying to come up with a way to build an automated PHP transfer system between 2 servers.
Server A : only ftp access; server B : ftp access and can run php scripts.
I want to copy all file in server A to a folder in server B;
Here is what I am trying to do :
1: function compress_each_ftp_folder_or_file_in_ftp_Backups_folder();
2: function delete each_ftp_folder_in_ftp_Backups_folder_after_successful_zipping();
3: function download_each_archive_in_ftp_Backups_folder();
4: function delete_each_archive_after_successful_download();
I have written some scripts for step 2, 3 and 4 but nothing found on web that help me with step 1;
I found lot of codes to compress folders or files on local server, but I don't found any script that compress a whole folder on a remote ftp server.
I think it was the time to ask for a help. Thanks for helping me.
|
|
|
|
|
Why post it here again! It's not accepted to cross-post, specially when you already got some answers in Q&A!!!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Hi
I didn't get any answers since. I thought I had posted it in the wrong session; This is why I reposted it here. Sorry;
Any idea to my problem;
|
|
|
|
|
You got some! answer. If this isn't good enough than comment there!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
The Joomla docs are very basic, so I'm asking for directions to other resources on what is involved and what I must do to create a Joomla module. The module must manage merchants and vouchers, two custom content types I presume, and members, built in I presume. I need to create/manage these, and create capture and maintenance screens for vouchers and merchants. What are the high level tasks required to do this? The coding and creation of the basic module package I can manage, but how does it all fit together etc? I'm .NET, and have only done WordPress plugins on the LAMP side.
|
|
|
|
|
Hi... I am using input box to user enter date which is the my db table. When user input date and click submit button it shows report,up to this works fine. From here I want to show 10 items per page with previous next button. How do I do?
|
|
|
|
|
Report? using which tool? Always include those details in your question.
Basically you could achieve that using options like formula. Do Google search using "Your reporting tool + paging", you'll get tons of results.
Or if you're using any direct output by HTML, use filter(s). Check these articles(not related to php)
Efficient paging using SQL script[^]
Paging GridView with ROW_NUMBER()[^]
|
|
|
|
|
Hi,
I would like to ask if anyone tried upload a photo using PHP and HTML.
I don't want to use Browse and Upload buttons. I just want the user to click on Upload which will browse then upload immediately to a dynamic folder.
are there any good free plugins available? or your recommend to code it?
Thanks,
Technology News @ www.JassimRahma.com
|
|
|
|
|
use ftp right?write(program) a can upload's website,right?use the html 5 and javascript code,right?,im a beginner and im a chinese.i have alway practise my english
|
|
|
|
|
Here is a link that may lead you to an answer you seek.
https://code.google.com/p/html5uploader/[^]
This should allow users of your site to drag and drop a file from their OS to be uploaded to your site in their browser. This will create a button to 'browse' but then they should not have to click an upload button and therefore you should not have to display an upload button.
You can have it save to a 'dynamic' directory/folder by manipulating the save directory in the PHP page that is shown on that site's page. Let's assume that that want files save into a directory named after the user but all user's folders are inside a directory called user_uploads. You will have to set it to an "id" that, obviously, would be unique to each user of your site. If users have a unique username then it could be $username or if they have a unique ID number associated with their account then it could be $user_id .
First change the name of the upload folder to what you want...as described above I am going with user_uploads:
$upload_folder = 'user_uploads';
Then you would have to do an additional change to the lines shown below to add it to the dynamic folder with the user's unique ID.
if(file_put_contents($upload_folder/$username.'/'.$headers['UP-FILENAME'], $content)) {
echo 'done';
}
For safety's sake I would either create a new directory named with a registering members unique ID upon creation of a new account or at least right before the second code shown to make sure that they actually have an existing directory to download into. Although it might be better to go with the second option here as you may have a lot of members who do not want to upload anything and therefore you could end up with a whole lot of empty directories sitting in that parent directory. Creating the directory (with appropriate permissions to store and show images) right before the upload process could ensure that only those users/members that actually want to upload something will have a folder.
You can download the 3 files plus the .js file from that link above. However, the link to demo this in action appears to be broken. But it's pretty simple and straightforward so it shouldn't take too much work to change a couple variables, upload to your server and test it yourself.
If you have a problem with this then just try searching the web for PHP HTML5 uploading for other possible options.
Many people are working with HTML5, PHP and JQuery to create such things. Just be aware that such things can be dependent upon a user having particular version numbers of particular browsers and you should make note of it accordingly on your site.
|
|
|
|
|
Hi,
I have a two mirror sites,
http:
I am trying to use the SOAP V2 in both the sites. Its working fine in ‘http:
But in ‘http:
When I open the SOAP URL ‘http:
Not able to get what the exact error is. Pls help if possible.
|
|
|
|