jairathnem
-
Posts
93 -
Joined
-
Last visited
Posts posted by jairathnem
-
-
issue is with the insert command.
try something like:
INSERT INTO kommentar (tittel, navn, tekst, tidsstempel, innleggid) VALUES (GetSQLValueString($_POST['tittel']"text"),GetSQLValueString($_POST['navn'], "text"),GetSQLValueString($_POST['tekst'], "text"),NOW(),getSQLValueString($_GET['innleggid'], "int"))
-
I am completely new to SOAP calls in php. But I did give it a try based on help from google.
<?php $client = new SoapClient("http://www.webservicex.net/globalweather.asmx?WSDL",array('proxy_host' => "myproxy", 'proxy_port' => 8080)); $params = array("CountryName" => "united states"); $response = $client->__soapCall("GetCitiesByCountry",array($params)); var_dump($response); ?>
and it did generate the needed output.
although when I changed
$response = $client->__soapCall("GetCitiesByCountry",array($params));
to
$response = $client->GetCitiesByCountry(array($params));
It didnt work, and threw and error.This might help.
(proxy setting not necessary).
-
there is your problem. $imgs isn't holding any data.
check how it is generated.
-
how is value stored to $imgs?
do a var_dump($imgs) before the foreach loop and check if it holds any data.
-
Look at the example carefully.
You missed:
1. Colon at end of if statement and at end of elseif statement.
2. You missed the endif; statement at the last.
-
Look at the sample below taken from PHP manual page:
<?php /* Incorrect Method: */ if($a > $b): echo $a." is greater than ".$b; else if($a == $b): // Will not compile. echo "The above line causes a parse error."; endif; /* Correct Method: */ if($a > $b): echo $a." is greater than ".$b; elseif($a == $b): // Note the combination of the words. echo $a." equals ".$b; else: echo $a." is neither greater than or equal to ".$b; endif; ?>
-
use GET or POST request to transfer the selected field over to other page.
-
oops. you are right. thanks for correcting.
-
mysql_fetch_row fetches a single row.
use mysql_fetch_assoc instead of that.
Even better suggestion - move to PDO instead of mysql.
-
you are seperating it based on ',' and storing it in $array, but for sort you are giving the string again. Hence the error.
you should call sort($array) and not sort($numberstring)
also you do not need to assign it to a variable,it sorts and stores it in the array given.
sample below.
<?php $num = "1,4,2,5,2,8"; $array = explode(',',$num); sort($array); var_dump($array); ?>
-
Hey. The reason why it is blank because the form is submitting to itself.
wow. I didn't know that would work!
thanks!
-
echo $response and see if it is holding value.
$response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); echo $response; $data = json_decode($response,true); echo $data['Content'];
if it is printing, next check $data else issue with the api.
$response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); $data = json_decode($response,true); var_dump($data); echo $data['Content'];
if it did check the structure of the printed array.
these are basic triage methods.
-
you gotta learn the basics first.
just typing $data['content'] won't show anything.
$response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); $data = json_decode($response,true); echo $data['Content'];
-
you missed the important line - $data = json_decode($response,true);
check my previous post!
-
$response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); $data = json_decode($response,true);
JSON is added to the data as an array.
if you want to access the 'Content' field, use $data['Content']
-
<form action="#" method="POST">
action is blank here.
-
for force download you should set Content-Type: application/octet-stream
looks like you change it if its txt, hence it is displaying and not downloading.
-
From the example output you posted it looks like the json isnt well formed.
The output should be something similar to the below:
[{"Content":"The Cardinals have offered free agent ILB Karlos Dansby a two-year deal worth $10 million to $12 million.","NewsID":9701,"PlayerID":11658,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\""}]
missing a couple of characters at the end.
echo $response and post it here.
if it was correctly formed, when you var_dump $data it should output
array (size=1) 0 => object(stdClass)[1] public 'Content' => string 'The Cardinals have offered free agent ILB Karlos Dansby a two-year deal worth $10 million to $12 million.' (length=105) public 'NewsID' => int 9701 public 'PlayerID' => int 11658 public 'Source' => string 'NBCSports.com' (length=13) public 'Team' => string 'ARI' (length=3) public 'TermsOfUse' => string 'NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: "NBCSports.com"' (length=280)
-
is your URL something like this - about.php?page=somevalue ?
if not, it should be like that cause you are accessing the page value in your page.
read up on GET and POST requests.
-
-
static variable.
doesn't make sense, does it?
-
That is JSON output.
use json_decode to get the data into an array.
sample:
$data = json_decode($response);
$data is an array containing values of $response.
-
-
Since the API returns XML shouldnt it be something like this
json_decode(json_encode((array)simplexml_load_string($xml)),1);
I need some more help
in PHP Coding Help
Posted
not sure what you are trying to do here.