Search found 167 matches

by AdoptiveSolution
Mon Oct 24, 2016 2:38 am
Forum: PHP coding => General
Topic: PHP oop email activation
Replies: 0
Views: 817

Re: PHP oop email activation

Do you understand the function of the Code button above the textfield?
by AdoptiveSolution
Sun Oct 23, 2016 7:13 am
Forum: PHP coding => General
Topic: How do I read and write to file?
Replies: 3
Views: 1094

Re: How do I read and write to file?

Add a \n to each line you write. $fp = fopen( dirname(__FILE__).'/dbinfo.txt', 'w' ) or die("Couldn't open file:- "); fwrite($fp, $hostname . "\n"); fwrite($fp, $database . "\n"); fwrite($fp, $username . "\n"); fwrite($fp, $password . "\n"); fclose( $fp ); Then read them back in the same order they ...
by AdoptiveSolution
Sun Oct 23, 2016 2:17 am
Forum: PHP coding => General
Topic: Pull this data out of database as an array
Replies: 9
Views: 1859

Re: Pull this data out of database as an array

You're looping thru the $names array while it's creating the $person array.

So you're echo'ing an incomplete $person.

Loop thru the $person array when it is complete.
by AdoptiveSolution
Fri Oct 21, 2016 7:33 am
Forum: PHP coding => General
Topic: Pull this data out of database as an array
Replies: 9
Views: 1859

Re: Pull this data out of database as an array

Like this :

Code: Select all

for ($i = 0; $i < count($person); $i++) {
	echo $person[$i]['Salutation'] . ' ' . $person[$i]['Firstname'] . ' ' . $person[$i]['Surname'] . '<br />';
	echo 'Date of birth : ' . $person[$i]['DOB'] . ' - Age : ' . $person[$i]['Age'] . '<br /><br />';
}
by AdoptiveSolution
Thu Oct 20, 2016 5:47 am
Forum: PHP coding => General
Topic: Pull this data out of database as an array
Replies: 9
Views: 1859

Re: Pull this data out of database as an array

Replace this part : for ($y = 0; $y < count($temp0); $y++) { $temp1 = split(":", $temp0[$y]); echo '<pre>'; print_r($temp1); echo '</pre>' . PHP_EOL; if ( $y == 0 ) { $temp3 = split(' ', trim($temp1[1])); echo '<pre>'; print_r($temp3); echo '</pre>' . PHP_EOL; $person[$i]['Salutation'] = trim($temp3...
by AdoptiveSolution
Wed Oct 19, 2016 1:27 pm
Forum: CSS
Topic: Appreciate hep....text color should change with every refresh
Replies: 1
Views: 2493

Re: Appreciate hep....text color should change with every refresh

See my answer in your other post in the JavaScript forum.
by AdoptiveSolution
Wed Oct 19, 2016 1:26 pm
Forum: JavaScript
Topic: Need help....Changing text color in every refresh
Replies: 2
Views: 4154

Re: Need help....Changing text color in every refresh

Try this : <html> <head> <script> function getRandomColor() { var letters = '0123456789ABCDEF'; var color = '#'; for (i = 0; i < 6; i++ ) { color += letters[Math.floor(Math.random() * 16)]; } return color; } </script> <style> #marquee { font-size: 20pt; font-weight: bold; } </style> </head> <body> <...
by AdoptiveSolution
Wed Oct 19, 2016 9:31 am
Forum: PHP coding => General
Topic: Pull this data out of database as an array
Replies: 9
Views: 1859

Re: Pull this data out of database as an array

Here's a better one. It contains a lot of echos so you can see what's happening. <?php $string = "Name: Mrs Daniel Lott. DOB: 12/12/1973. Age: 42 ; Name: Mr John Simpson. DOB: 11/11/1954. Age: 61 ;"; $string = str_replace('; ', ';', $string); $names = split(';', $string ); echo '<pre>'; print_r($nam...
by AdoptiveSolution
Wed Oct 19, 2016 8:15 am
Forum: PHP coding => General
Topic: Pull this data out of database as an array
Replies: 9
Views: 1859

Re: Pull this data out of database as an array

Not perfect, but it's a start : <?php $string = "Name: Mrs Daniel Lott. DOB: 12/12/1973. Age: 42 ; Name: Mr John Simpson. DOB: 11/11/1954. Age: 61 ;"; $string = str_replace('; ', ';', $string); $names = split(';', $string ); echo '<pre>'; print_r($names); echo '</pre>'; $name = array(); for ($i = 0;...
by AdoptiveSolution
Tue Oct 18, 2016 8:41 am
Forum: mySQL & php coding
Topic: Select on database
Replies: 8
Views: 4004

Re: Select on database

Try this :

Code: Select all

select * from tablename where (car_id1 + car_id2 + car_id3 + car_id4 + car_id5 + car_id6 + car_id7 + car_id8 + car_id9 + car_id10 + car_id11) > 0 ;
Note that all colums (*) are shown, whether or not they have a value.
by AdoptiveSolution
Fri Oct 14, 2016 11:18 pm
Forum: mySQL & php coding
Topic: Sorting Tags Alphabetically
Replies: 1
Views: 1612

Re: Sorting Tags Alphabetically

Sort $tags first.

http://www.w3schools.com/php/php_arrays_sort.asp

Or if you get the tags from a database, use :

Code: Select all

SELECT tags FROM table ORDER BY tags ASC
by AdoptiveSolution
Wed Oct 12, 2016 1:37 pm
Forum: mySQL & php coding
Topic: Help with MYSQL, JSON, and PHP
Replies: 1
Views: 1153

Re: Help with MYSQL, JSON, and PHP

Why not count the rows in the returned result :

http://stackoverflow.com/questions/1960 ... json-array
by AdoptiveSolution
Wed Oct 12, 2016 6:18 am
Forum: PHP General
Topic: Problem Turning php/mysql into CSV for SAVE in DIRECTORY
Replies: 2
Views: 1326

Re: Problem Turning php/mysql into CSV for SAVE in DIRECTORY

Here a simple script that writes data from mysql to a csv file and read it again : <h3>Write to csv</h3> <?php $db = new mysqli('localhost', 'username', 'password', 'database'); $result = $db->query("SELECT FirstName, LastName, Job, Hometown FROM members"); if ( $result ) { $fp = fopen('members.csv'...
by AdoptiveSolution
Sun Oct 09, 2016 9:16 am
Forum: PHP coding => Mail
Topic: Slight Problem with emailing a contact form
Replies: 0
Views: 1143

Re: Slight Problem with emailing a contact form

You have a dot (.) instead of an ";" at the end of the line :

Code: Select all

"Here is the message:\n $message". <------ should be ;
    
$to = "admin@tecomputers.co.uk";
by AdoptiveSolution
Tue Oct 04, 2016 9:44 am
Forum: mySQL & php coding
Topic: error in viewing php from the browser
Replies: 0
Views: 873

Re: error in viewing php from the browser

It should be this :

Code: Select all

while($row =$stmt->fetch()){
by AdoptiveSolution
Sun Oct 02, 2016 4:09 am
Forum: PHP General
Topic: Please help with my downtime project
Replies: 0
Views: 908

Re: Please help with my downtime project

Save $var1.

Or check if $var1 has a value, and if so, do not update it.
by AdoptiveSolution
Thu Sep 29, 2016 10:43 pm
Forum: PHP coding => General
Topic: Table not being created on webpage
Replies: 7
Views: 1766

Re: Table not being created on webpage

Don't use the <?php ... ?> tags inside the while loop. Change this line : echo "<td>" . '<a href="updatestudent.php?edit=<?php echo $row["student_id"]; ?>" class="editlink">Edit</a>' ."</td>"; to this : echo "<td><a href='updatestudent.php?edit=" . $row["student_id"] . "' class='editlink'>Edit</a></...
by AdoptiveSolution
Sat Sep 24, 2016 12:18 am
Forum: PHP coding => General
Topic: PHP Localhost question
Replies: 1
Views: 472

Re: PHP Localhost question

It looks like siss should be ssis.
by AdoptiveSolution
Fri Sep 23, 2016 12:50 pm
Forum: PHP General
Topic: Get next from array every six months
Replies: 0
Views: 982

Re: Get next from array every six months

Based on this topic : http://stackoverflow.com/questions/4233605/elegant-way-to-get-the-count-of-months-between-two-dates Determine the number of months from a startdate until now : <?php // Set dates $dateIni = '2016-01-01'; $dateFin = date('Y-m-d', time()); // Get year and month of initial date (F...
by AdoptiveSolution
Thu Sep 22, 2016 6:03 am
Forum: PHP General
Topic: Return to page position.
Replies: 0
Views: 828

Re: Return to page position.

A new window as in target="_blank"?

If so, just close the window.

If not, give each icon on the icons page a name or id.

Then when you close the new window, use iconswindow.html#icon_id to scroll to that icon position on the page.