Search found 167 matches

by AdoptiveSolution
Tue Jun 05, 2018 11:40 pm
Forum: PHP coding => General
Topic: Get last word with preg_match
Replies: 2
Views: 522

Re: Get last word with preg_match

This gives the result you want if (preg_match('/(.*)-(.*)-(.*)-(.*)/', $str, $match) == 1) { $part1 = $match[1]; $part2 = $match[2]; $part3 = $match[3]; $part4 = $match[4]; } echo '<pre>'; print_r($match); echo '</pre>'; ?> Unless there's a reason to use preg_match, why not use explode()? <?php $mat...
by AdoptiveSolution
Tue May 29, 2018 10:42 am
Forum: PHP General
Topic: Need help with multiple selection
Replies: 1
Views: 514

Re: Need help with multiple selection

Give the checkboxes in the form a name : <input type="checkbox" name="services[IT Design]" value="IT Design">IT Design <input type="checkbox" name="services[App Design]" value="App Design">App Design <input type="checkbox" name="services[Graphic Design]" value="Graphic Design">Graphic Design <input ...
by AdoptiveSolution
Mon May 07, 2018 7:08 am
Forum: PHP coding => General
Topic: Last 4 characters of a filename
Replies: 4
Views: 604

Re: Last 4 characters of a filename

Code: Select all

$year = substr($imagename, -4);
It's in the manual, example #1

http://php.net/manual/en/function.substr.php
by AdoptiveSolution
Mon May 07, 2018 4:04 am
Forum: PHP coding => General
Topic: SimpleXML asXML Not Working As Expected
Replies: 1
Views: 744

Re: SimpleXML asXML Not Working As Expected

To see what's returned, use this : <?php echo '<pre>'; print_r( $xml ); echo '</pre>'; ?> Then, after studying the code, use this sample code to display the content : <?php $url = "https://gunretort.xyz/api.php?action=query&list=search&srsearch=NewTag&srwhat=text&srnamespace=0|3000&format=xml"; $xml...
by AdoptiveSolution
Mon Jun 26, 2017 12:01 am
Forum: PHP General
Topic: issue with remarks request method
Replies: 2
Views: 1790

Re: issue with remarks request method

I don't think this is correct as a value :

5\r\n
by AdoptiveSolution
Thu Jun 22, 2017 10:06 am
Forum: PHP coding => Images
Topic: Redimensionner une image
Replies: 2
Views: 1610

Re: Redimensionner une image

Here's how you determine the width and height of an image : foreach( $tab_image as $image ) { // http://php.net/manual/en/function.getimagesize.php $size = getimagesize($repertoire . '/' . $image); $width = $size[0]; $height = $size[1]; echo '<pre>'; print_r($size); echo '</pre>'; ?> <li> <img src="...
by AdoptiveSolution
Sun Jun 04, 2017 8:28 am
Forum: PHP coding => Images
Topic: PHP Troubleshooting Audio & Image will not load on new page
Replies: 3
Views: 1894

Re: PHP Troubleshooting Audio & Image will not load on new page

Here's the code for the play.php file <html> <body> <?php $image = $_GET[image]; $song = $_GET[link]; ?> <img src="pictures/<?php echo $image; ?>" height="475" width="777"><br> <audio controls autoplay> <source src="dashboard/files/wmb/<?php echo $song; ?>" type="audio/mpeg"> Your browser does not s...
by AdoptiveSolution
Thu May 18, 2017 3:02 am
Forum: PHP coding => General
Topic: SELECT Query with $_Sessions
Replies: 2
Views: 1030

Re: SELECT Query with $_Sessions

Try this :

Code: Select all

$sql = "SELECT * FROM members WHERE username = '" . $_SESSION[username] . "' AND memberID = '" . $_SESSION[memberID] . "'";
by AdoptiveSolution
Thu May 04, 2017 12:29 pm
Forum: PHP Scripts
Topic: Naming an option
Replies: 2
Views: 1719

Re: Naming an option

Try this :

Code: Select all

<select name='SelStore'>
Info :

https://www.w3schools.com/tags/att_select_name.asp
by AdoptiveSolution
Wed Apr 05, 2017 7:42 am
Forum: mySQL & php coding
Topic: Man input to mysql works but not variable.
Replies: 2
Views: 1196

Re: Man input to mysql works but not variable.

Look carefully and notice that the bad test has the date/time without quotes.

Try this :

Code: Select all

$sql = "UPDATE $mydb SET $myfield = '" . $dte . "'";
or

Code: Select all

$sql = "UPDATE $mydb SET $myfield = '$dte'";
Then echo the line to see it.
by AdoptiveSolution
Mon Mar 27, 2017 12:26 pm
Forum: PHP coding => General
Topic: Assistance with opening a URL in a new window.
Replies: 5
Views: 1284

Re: Assistance with opening a URL in a new window.

Your problem was creating the SELECT dropdown list in a FORM.

You now have the solution to open a new browser window when you press SUBMIT.

Use a domainname URL instead of localhost.
by AdoptiveSolution
Mon Mar 27, 2017 9:47 am
Forum: PHP coding => General
Topic: Does Anyone Know why PHP is Throwing This Error?
Replies: 1
Views: 713

Re: Does Anyone Know why PHP is Throwing This Error?

You didn't make a connection to the database :

http://php.net/manual/en/mysqli.real-escape-string.php
I'm new to mysqli
That's why they invented manuals.
by AdoptiveSolution
Sun Mar 26, 2017 11:13 pm
Forum: PHP coding => General
Topic: Assistance with opening a URL in a new window.
Replies: 5
Views: 1284

Re: Assistance with opening a URL in a new window.

Curl and JSON has nothing to do with your problem. What you need is a FORM with a SELECT menu and a GET method. Standard HTML which you can find in the manual. <?php $output_json = '[ { "name": "App1", "description": "", "id": 10 }, { "name": "App2", "description": "", "id": 20 }, { "name": "App3", ...
by AdoptiveSolution
Sat Mar 25, 2017 7:32 am
Forum: PHP coding => General
Topic: Sorting an array
Replies: 2
Views: 956

Re: Sorting an array

Try this : <?php $json = '{ "england":{ "goals":"2", "games":"3", "wins":"2", "loss":"1" }, "wales":{ "goals":"2", "games":"3", "wins":"2", "loss":"1" }, "scotland":{ "goals":"2", "games":"3", "wins":"2", "loss":"1" } }'; $array = json_decode($json, true); echo '<pre>'; var_dump($array); echo '</pre...
by AdoptiveSolution
Mon Mar 20, 2017 2:09 pm
Forum: PHP General
Topic: Forms data empty
Replies: 1
Views: 1012

Re: Forms data empty

Check the {}

The nesting is wrong.

With or without data, a connection is made with the database and a record is added.

If no connection is made, de INSERT statement will still be executed, with an error as a result.

So again, check the nesting of the code.
by AdoptiveSolution
Tue Mar 14, 2017 8:45 am
Forum: mySQL & php coding
Topic: get data from different tables
Replies: 11
Views: 2240

Re: get data from different tables

First, don't change the names of tables and vars during the conversation. Second, entertainment is with an n in the middle. Try this : SELECT users.id, users.firstname, users.lastname, review.id, review.itemid, review.rnumber, review.review, review.viewed, entertaiment.id, entertaiment.title FROM re...
by AdoptiveSolution
Mon Mar 13, 2017 10:11 am
Forum: PHP coding => General
Topic: I need help with an encoded link.
Replies: 3
Views: 865

Re: I need help with an encoded link.

Based on the code, I pieced together his :

http://www.protradersclub.com/member/aj ... eports.m4v

A login page is displayed, so something is valid.
by AdoptiveSolution
Mon Mar 13, 2017 5:00 am
Forum: PHP coding => General
Topic: extract image file name from large string
Replies: 7
Views: 1728

Re: extract image file name from large string

It's a JSON string. Save this string in a file as image.json [{"name":"mainimage\/fxdfsmall_gn44od0r.jpg","usrName":"fxdfsmall.jpg","size":219937,"type":"image\/jpeg","searchStr":"fxdfsmall.jpg,!:sStrEnd"}] Then use this with PHP to see how it looks : <?php $string = file_get_contents("image.json");...
by AdoptiveSolution
Fri Mar 10, 2017 2:55 pm
Forum: PHP coding => General
Topic: includes in sub directories of password protected directories
Replies: 7
Views: 1938

Re: includes in sub directories of password protected directories

Do not use http urls to include files, use filepaths :

Code: Select all

<?php
include "123/xyz/header.php";
?>
Or

Code: Select all

<?php
include "../123/xyz/header.php";
?>
Directory passwords only work when you display webpages with a browser.
by AdoptiveSolution
Tue Mar 07, 2017 1:05 pm
Forum: PHP Scripts
Topic: Don't put your fingers where they don't belong.....
Replies: 2
Views: 1449

Re: Don't put your fingers where they don't belong.....

Shouldn't it be :

Code: Select all

$updateresult = mysqli_query($conn, $updateQuery);
to update the database and to avoid a conflict with the $result of the SELECT query?
by AdoptiveSolution
Tue Mar 07, 2017 11:53 am
Forum: PHP coding => General
Topic: Help with array with no sessions
Replies: 4
Views: 1252

Re: Help with array with no sessions

Arrays start numbering at 0 (zero). If you open the page for the first time there is no Session and $_SESSION['ad_id'] will be unknown. You then increase the number of $_SESSION['ad_id'] which will be 1. So the second item in the array will show. If you do not know the value of a var, echo them befo...
by AdoptiveSolution
Tue Mar 07, 2017 2:58 am
Forum: PHP coding => General
Topic: Need help about passing value to next page and use that value as a variable for MySQL query
Replies: 6
Views: 1451

Re: Im new to php, having this small problem, wish someone could help me.

Remove this line :

Code: Select all

$php = mysql_escape_string($php);
And when you paste code, use the code button </>

And change the title of this topic. "I'm new to php" does NOT describe the problem.