Search found 10 matches

by peterachutha
Sat Jun 07, 2014 10:20 am
Forum: PHP coding => General
Topic: no database selected
Replies: 1
Views: 438

Re: no database selected

You dengan kerajaan Malaysia? (Are you with the Malaysian Government?) Sebab you punya code, tengok macham dari Bank negara atau lain pentadbiran. (Because your code looks like form Bank Negara (Central Bank) of similar administration.
by peterachutha
Fri Jun 06, 2014 3:55 pm
Forum: PHP coding => General
Topic: no database selected
Replies: 1
Views: 438

Re: no database selected

My guess is that you may have forgotten to connect to your database. You would probably need to add something like the code below before you create tables. $host = "localhost"; $user = "myusername"; $pass = "mypassword"; $myconn = mysql_connect($host, $user, $pass); if (!$myconn) { echo "Could not c...
by peterachutha
Fri Jun 06, 2014 3:35 pm
Forum: PHP General
Topic: mysql_num_rows error
Replies: 0
Views: 724

Re: mysql_num_rows error

I'm new to mysql but I noticed that if I used $query = "SELECT ip FROM hits_ip WHERE ip = $user_ip;"; the code did not work but if I had used $query = "SELECT ip FROM hits_ip WHERE ip = '$user_ip' ;"; or in some cases $query = "SELECT ip FROM hits_ip WHERE ip = '".$user_ip.'" ;"; the code worked. I ...
by peterachutha
Sun Jun 01, 2014 4:53 am
Forum: PHP General
Topic: A simple "translator"
Replies: 0
Views: 653

Re: A simple "translator"

I went through the code and rearranged to see if it was code related. Then I found out that, it looks like character by character replacement does not work with str_replace(). Probably something to do with a string and an array of characters not treated the same. So I modified your code with char re...
by peterachutha
Sun Jun 01, 2014 12:25 am
Forum: PHP Scripts
Topic: A PHP script that generates another
Replies: 0
Views: 727

Re: A PHP script that generates another

I suspect I may know why it did not appear to work. It is actually working but its not visible as it looks like the browser is chomping everything. Try changing your code so that the browser ignores it as text by placing the output in a textarea:- <html> <bod> <?php if( file_exists("test.txt")){ ech...
by peterachutha
Sat May 31, 2014 11:53 pm
Forum: PHP General
Topic: could not update mysqli
Replies: 2
Views: 636

Re: could not update mysqli

Looks like you have a missing ;

WHERE id='$id'";

I think should be

WHERE id='$id' ; ";

But try this out also as this worked for me but I do not know why.

WHERE id='".$id."' ;";
by peterachutha
Sat May 31, 2014 11:40 pm
Forum: PHP General
Topic: Sending EMAIL
Replies: 1
Views: 702

Re: Sending EMAIL

PHP Mail fuction will only send mail out from your website mail box. If your website is http://www.abc.com then sending from email address testturnover@abc.com will work. If you are try to send from testturnover@xyz.com most if not all hosts will block out going mail whose 'from' email address is no...
by peterachutha
Sat May 31, 2014 11:05 pm
Forum: PHP General
Topic: PHP Code Won't Work :/
Replies: 0
Views: 447

Re: PHP Code Won't Work :/

I am not sure but did you try

$con=mysqli_connect("localhost","my_user","my_password","my_db");

use the term 'localhost' instead of an IP address.
by peterachutha
Sat May 31, 2014 10:58 pm
Forum: PHP General
Topic: Unableto add in PHP
Replies: 2
Views: 595

Re: Unableto add in PHP

May be you miss-interpreted how placeholder works. It does not transfer a value into the field. If you wanted a default value transferred into the fields you could have written it as:- <input type="number" name="1" placeholder="number" value="<?php echo $var1; ?>"/> <input type="number" name="2" pla...
by peterachutha
Sat May 31, 2014 10:45 pm
Forum: PHP General
Topic: Unableto add in PHP
Replies: 2
Views: 595

Re: Unableto add in PHP

The code worked very well on my server. No problems.

Just a suggestion: I would not use '1' and '2' as later on when you code gets more complex you might mis-read it.