Search found 167 matches

by AdoptiveSolution
Sun Aug 14, 2016 10:42 am
Forum: PHP coding => General
Topic: PHP File Upload Issue
Replies: 15
Views: 4211

Re: PHP File Upload Issue

Your PHP code only checks if it's an image.

You need the rest of the code on this page to save the file on the server :

http://www.w3schools.com/php/php_file_upload.asp
by AdoptiveSolution
Thu Aug 11, 2016 9:13 pm
Forum: PHP coding => General
Topic: expects parameter 1 to be mysqli_result
Replies: 0
Views: 795

Re: expects parameter 1 to be mysqli_result

When you're new, read the manual :

http://php.net/manual/en/mysqli-result.fetch-array.php (Example #2 Procedural style)
by AdoptiveSolution
Sun Aug 07, 2016 5:54 am
Forum: PHP coding => General
Topic: print out de data from a xml that's on a static ip-adress
Replies: 0
Views: 732

Re: print out de data from a xml that's on a static ip-adress

After loading $xml, you have to loop thru the array to print the keys and values : <?php $xml=simplexml_load_file("http://216.160.239.63:9011/stateFull.xml") or die("Error: Cannot create object"); echo "<pre>"; print_r($xml); echo "</pre>"; foreach($xml as $key => $value) { print "$key => $value" . ...
by AdoptiveSolution
Fri Aug 05, 2016 12:36 pm
Forum: PHP coding => General
Topic: Need to use php foreach to create XML elements and attributes using info from a php
Replies: 1
Views: 627

Re: Need to use php foreach to create XML elements and attributes using info from a php

And here's a small script to read the xml file you just saved : <?php $doc = new DOMDocument(); $doc->load( 'carousel_Traffic.xml' ); $elements = $doc->getElementsByTagName( "element" ); foreach( $elements as $element ) { $names = $element->getElementsByTagName( "field" ); $name = $names->item(0)->n...
by AdoptiveSolution
Fri Aug 05, 2016 12:30 pm
Forum: PHP coding => General
Topic: Need to use php foreach to create XML elements and attributes using info from a php
Replies: 1
Views: 627

Re: Need to use php foreach to create XML elements and attributes using info from a php

Move the foreach {} to where you write to the file. Here's the complete code. <?php $xml1 = new SimpleXMLElement(file_get_contents('https://wsidata.weather.com/201303/en-us/55828880/traffic.xml')); $xml_txt = '<?xml version="1.0" encoding="UTF-8"?>'."\r\n".'<tickerfeed version="2.4">'."\r\n". '<play...
by AdoptiveSolution
Sun Jul 31, 2016 5:45 am
Forum: PHP coding => General
Topic: Filter data on respective category
Replies: 3
Views: 1401

Re: Filter data on respective category

You have to filter the country before displaying the catagories. Here's the PHP part. I also made the search case-insensitive. <?php $filter = mb_strtolower($_GET["origin"]); $cat = ""; for ( $i = 0; $i < count($article); $i++ ) { $tempCountry = mb_strtolower($article[$i]['Country']); if ( $filter =...
by AdoptiveSolution
Sat Jul 30, 2016 8:26 am
Forum: PHP coding => General
Topic: Mysqli multiple query won't work
Replies: 2
Views: 549

Re: Mysqli multiple query won't work

Don't close the connection after the first and second query.

Code: Select all

$conn->close();
by AdoptiveSolution
Thu Jul 28, 2016 9:07 pm
Forum: PHP coding => General
Topic: PHP codding
Replies: 4
Views: 1200

Re: PHP codding

There's nothing wrong with the code. Here's what I made of it : <?php include 'mydata.php'; $cat = ""; for ( $i = 0; $i < count($menu); $i++ ) { $tempCat = $menu[$i]['Category']; if ( $cat <> $tempCat ) { $cat = $tempCat; echo $cat . "<br />"; } echo $menu[$i]['Name'].", ". $menu[$i]['Description']....
by AdoptiveSolution
Thu Jul 21, 2016 8:23 am
Forum: PHP coding => General
Topic: How to get the root directory
Replies: 3
Views: 680

Re: How to get the root directory

In PHP : $_SERVER["DOCUMENT_ROOT"] DOCUMENT_ROOT=/var/www/example $_SERVER["HTTP_HOST"] HTTP_HOST=www.example.com http://php.net/manual/en/reserved.variables.server.php In HTML : To make a path of an image of link relative to root, use "/image/image.jpg" To make a path of an image of link relative t...
by AdoptiveSolution
Thu Jul 21, 2016 2:00 am
Forum: JavaScript
Topic: Add and remove <li> with jquery
Replies: 1
Views: 5894

Re: Add and remove <li> with jquery

You're still there? I think the remove() funtion is reserved. So I used a different name and made some changes : <ul id="list"> <li>List 1</li> <li>List 2</li> <li>List 3</li> <li>List 4</li> <li>List 5</li> </ul> <button onclick="add()">Add</button> <button onclick="remoove()">Remove</button> <scri...
by AdoptiveSolution
Tue Jul 19, 2016 7:30 am
Forum: PHP coding => General
Topic: [solved] Combining php statements
Replies: 1
Views: 533

Re: Combining php statements

It's good practice to declare vars.

Then you know that they are empty when you start using them.
by AdoptiveSolution
Tue Jul 19, 2016 6:56 am
Forum: PHP coding => General
Topic: [solved] Combining php statements
Replies: 1
Views: 533

Re: Combining php statements

I used this as an example : http://www.w3schools.com/php/php_mysql_select.asp And added some vars for clarity. Also used mysqli . <?php $listBasic = ''; $listHouse = ''; $listEntertainment = ''; $features_f_basic = "Basic Features"; $features_f_house = "House Features"; $features_f_entertainment = "...
by AdoptiveSolution
Tue Jul 12, 2016 10:14 am
Forum: mySQL & php coding
Topic: Form not submitting if text field is too long/large (PHP & MYSQL)
Replies: 2
Views: 1294

Re: Form not submitting if text field is too long/large (PHP & MYSQL)

First, mysql-escape-string is depricated : http://php.net/manual/en/function.mysql-escape-string.php I use the sanatize code to import text with non-latin characters. Then this code to make it readable again : html_entity_decode($textfromdatabase); I think stripslashes($xxx) does the opposite of san...
by AdoptiveSolution
Wed Jun 15, 2016 8:38 am
Forum: PHP coding => Images
Topic: help: create image from form
Replies: 0
Views: 1705

Re: help: create image from form

Instead of : $filename = $_POST['nome']; $filename = $_POST['grado']; $filename = $_POST['officiante']; $filename = $_POST['arcibat']; $filename = $_POST['diobat']; $filename = $_POST['databat']; Try this : $nome = $_POST['nome']; $grado = $_POST['grado']; $officiante = $_POST['officiante']; $arciba...