Search found 167 matches

by AdoptiveSolution
Tue Feb 28, 2017 8:36 am
Forum: PHP coding => General
Topic: Web page content appears to shift right upon refresh
Replies: 3
Views: 918

Re: Web page content appears to shift right upon refresh

Since it happens in the browser, check the source and the css (styles ).
by AdoptiveSolution
Sun Feb 26, 2017 10:37 am
Forum: PHP coding => General
Topic: insert array into db
Replies: 8
Views: 1364

Re: insert array into db

Here's the $client array : $client = array( "0" => array("name" => "Peter Maxx", "ip" => "193.169.5.16"), "1" => array("name" => "Ravi Shankar", "ip" => "193.169.5.17") ); Then you create the $DataArr array : $DataArr = array(); Then you use the $client array to fill the $DataArr array : foreach($cl...
by AdoptiveSolution
Sat Feb 25, 2017 11:35 pm
Forum: PHP coding => General
Topic: insert array into db
Replies: 8
Views: 1364

Re: insert array into db

Why are you surprised that you get duplicate entries?

It's visible in the last 4 lines of your code.
by AdoptiveSolution
Thu Feb 23, 2017 2:37 am
Forum: PHP & MySQL Security
Topic: PHP Password Login
Replies: 4
Views: 2766

Re: PHP Password Login

This looks cleaner : <?php include('settings.php'); $login = NULL; if ( isset( $_POST['letmein'] ) ) { if( $_POST['letmein'] == $securityWord ) { $login = TRUE; } else { $login = FALSE; } } ?> <!DOCTYPE html> <html> <head> <title><?php echo ( $login === TRUE ? 'Admin' : 'Login' ); ?></title> </head>...
by AdoptiveSolution
Mon Feb 20, 2017 2:40 pm
Forum: PHP General
Topic: PDO Prepared Param - Different Results
Replies: 5
Views: 1648

Re: PDO Prepared Param - Different Results

If you use a string, ASCII 3 is larger than ASCII 2

Or '3' is larger than '234567799'

You're comparing a string (text), not numbers.

http://www.asciitable.com/
by AdoptiveSolution
Mon Feb 13, 2017 9:34 am
Forum: PHP coding => General
Topic: Getting object data
Replies: 2
Views: 926

Re: Getting object data

Based on the output of the array, I made this (including an extra item for the monthly billing of June) : <?php $ref = array(); $ref[0] = array('reference'=>"Monthly Billing for June",'payment'=>'125.90'); $ref[1] = array('reference'=>'Monthly Billing for July'); $ref[2] = array('reference'=>'Annual...
by AdoptiveSolution
Sun Feb 12, 2017 5:28 am
Forum: mySQL & php coding
Topic: Session after Logging in doesn't work
Replies: 5
Views: 1536

Re: Session after Logging in doesn't work

You posted 3 pieces of code.

The first and third piece have a session_start().

The second piece hasn't.

I mentioned the admin login page. It should be the admin_login_process page.
by AdoptiveSolution
Sat Feb 11, 2017 4:16 pm
Forum: mySQL & php coding
Topic: Session after Logging in doesn't work
Replies: 5
Views: 1536

Re: Session after Logging in doesn't work

You should also start a session on the login page.
by AdoptiveSolution
Wed Feb 08, 2017 4:33 pm
Forum: PHP coding => General
Topic: Add a percentage of the time
Replies: 1
Views: 519

Re: Add a percentage of the time

To get you started : http://stackoverflow.com/questions/4605117/how-to-convert-a-hhmmss-string-to-seconds-with-php <?php echo '<h4>Time string to seconds</h4>'; $time = '00:00:09'; echo '<p>Time string : ' . $time . '</p>'; $seconds = strtotime("1970-01-01 $time UTC"); echo '<p>Seconds : ' . $second...
by AdoptiveSolution
Sun Feb 05, 2017 1:13 pm
Forum: PHP Scripts
Topic: Get data from API url XML php
Replies: 1
Views: 1515

Re: Get data from API url XML php

The service is currently not available :

http://www.omdbapi.com/?s=bullitt

http://www.omdbapi.com/
by AdoptiveSolution
Fri Feb 03, 2017 10:59 pm
Forum: mySQL & php coding
Topic: cannot send data to database
Replies: 2
Views: 1172

Re: cannot send data to database

It looks there's a comma missing after now()

Code: Select all

, '{$post_author}', now() '{$post_image}
by AdoptiveSolution
Fri Feb 03, 2017 1:54 am
Forum: PHP General
Topic: how to detect mobile browser?
Replies: 1
Views: 1125

Re: how to detect mobile browser?

Why not search for it first : https://www.google.com/search?q=detect+mobile+device+with+php Here are two examples how to do it with PHP : 1. http://mobiledetect.net/ 2. https://detectmobilebrowsers.mobi/ And here's how you find JavaScript solutions : https://www.google.com/search?q=detect+mobile+bro...
by AdoptiveSolution
Mon Jan 30, 2017 6:23 am
Forum: PHP General
Topic: displaying items in array taken from csv
Replies: 2
Views: 989

Re: displaying items in array taken from csv

Code: Select all

<?php

$csv = array_map('str_getcsv', file('foods.txt'));

echo '<pre>';
print_r( $csv );
echo '</pre>';

for ( $i = 0 ; $i < count( $csv ) ; $i++ ) {
	
	echo '<p>' .     $csv[$i][0] . '<br />';
	echo             $csv[$i][1] . ' calories<br />';
	echo 'Note : ' . $csv[$i][2] . '</p>';
	
}

?>
by AdoptiveSolution
Wed Jan 25, 2017 2:40 pm
Forum: PHP coding => General
Topic: ranges integer
Replies: 1
Views: 670

Re: ranges integer

Here's my solution : <?php if ( isset($_POST['Submit']) && isset($_POST['int']) && is_numeric( $_POST['int'] ) ) { $int = $_POST['int']; $check_range = array( 1 => array(0,30), 2 => array(31,60), 3 => array(61,90), 4 => array(91,119), 5 => array(120,149), 6 => array(150,172), 7 => array(173,189), 8 ...
by AdoptiveSolution
Mon Jan 23, 2017 6:06 am
Forum: PHP coding => General
Topic: Form doesn't function
Replies: 5
Views: 1250

Re: Form doesn't function

$headers should be a string, not an array(). Simply follow the example : http://www.w3schools.com/php/func_mail_mail.asp This code will send the message : $headers = ''; $headers .= "MIME-Version: 1.0" . '\r\n'; $headers .= "Content-type: text/plain; charset=iso-8859-1" . '\r\n'; $headers .= "From: ...
by AdoptiveSolution
Sun Jan 22, 2017 6:48 am
Forum: PHP coding => General
Topic: force pdf download after form submit
Replies: 7
Views: 1365

Re: force pdf download after form submit

I used the last code I posted. Works fine with me : http://adoptive.esy.es/download_pdf_file/Try.php I disabled the mail() part, because I don't want to get inundated with mail. Here's another version : http://adoptive.esy.es/download_pdf_file/ I moved the thank you part and the download header to a...
by AdoptiveSolution
Fri Jan 20, 2017 2:59 am
Forum: PHP coding => General
Topic: force pdf download after form submit
Replies: 7
Views: 1365

Re: force pdf download after form submit

Here's a sample page that sends an email after submit and downloads the file. It uses the part after the email is sent succesfully. <?php // http://www.w3schools.com/php/func_mail_mail.asp $message = "" ; if ( $_REQUEST["submit"] ) { $to = "yourname@domain.com"; $subject = "My subject"; $txt = "Hell...
by AdoptiveSolution
Fri Jan 20, 2017 1:23 am
Forum: PHP coding => General
Topic: force pdf download after form submit
Replies: 7
Views: 1365

Re: force pdf download after form submit

Does the pdf file download when you open the download.php page in the browser?
by AdoptiveSolution
Thu Jan 19, 2017 6:20 am
Forum: PHP coding => General
Topic: force pdf download after form submit
Replies: 7
Views: 1365

Re: force pdf download after form submit

Create a separate file to download the pdf file. Name it download.php and add this code : <?php header("Content-type:application/pdf"); // Use the name of the pdf file that is saved as… Can be different from the file on the server header("Content-Disposition:attachment;filename=BESTBUILD-Wall-Putty-...
by AdoptiveSolution
Wed Jan 18, 2017 1:22 pm
Forum: PHP coding => General
Topic: how to output information from string ...
Replies: 1
Views: 848

Re: how to output information from string ...

Here's a way to do it. You may have to optimize the code : <?php $consonants = 'bcdfghjklmnpqrstvwxyz'; $vowels = 'aeiou'; $consonants_array = array(); $vowel_array = array(); $string = 'hello - world !'; echo '<h3>' . $string . '</h3>'; for ($i = 0; $i < strlen($string); $i++) { $thechar = strtolow...
by AdoptiveSolution
Sun Jan 15, 2017 6:34 am
Forum: PHP coding => General
Topic: SQL to Array
Replies: 5
Views: 1579

Re: SQL to Array

I think you should use SUM() instead of COUNT()

Code: Select all

SELECT player_stats.player_name, SUM(player_death.player), SUM(player_kill.killer)
SUM adds the numbers of death and kills in each record.
COUNT returns the number of records.
by AdoptiveSolution
Fri Jan 13, 2017 11:27 pm
Forum: mySQL & php coding
Topic: My Problem with dropdownlist in mysql,php
Replies: 11
Views: 4666

Re: My Problem with dropdownlist in mysql,php

I see two <select>.

One before the php code :

Code: Select all

<select name='RoleName'> 
and one before the while loop :

Code: Select all

echo "<select name='RoleName'>"; // list box select command
by AdoptiveSolution
Thu Jan 12, 2017 9:36 am
Forum: mySQL & php coding
Topic: Login to a mysql db
Replies: 2
Views: 1165

Re: Login to a mysql db

First, use the code button when you paste code. It's easier to read. Like this : <?php function qdbconn() { $dbName = "projeto"; $dbUser = "root"; $dbPass = ""; $dbHost = "localhost"; if (!($link=mysql_connect($dbHost, $dbUser, $dbPass))) { error_log(mysql_error(), 3, "/tmp/phplog.err"); } if (!mysq...
by AdoptiveSolution
Thu Jan 12, 2017 9:17 am
Forum: PHP coding => General
Topic: test connectivity to mysql issue
Replies: 2
Views: 683

Re: test connectivity to mysql issue

First, use the code button to display code. It's easier to read : <?php $db_host="localhost"; $db_username = "xxxx_zzzz"; $db_pass="Qwerty"; $db_name="xxxx_zzzz"; mysql_connect("$db_host",$db_username",$db_pass") or die(mysql_error()); mysql_select_db("$db_name") or die("no database that name"); ?> ...