Search found 26 matches

by daveismyname
Thu May 16, 2013 3:35 am
Forum: mySQL & php coding
Topic: SQL ERROR
Replies: 0
Views: 892

Re: SQL ERROR

sigridann wrote: $sql = mysql_query("select * from employee where fname like '%$term%'");
$result=mysql_query($sql);
your using mysql_query then again in the next line try this instead.

Code: Select all

$result = mysql_query("select * from employee where fname like '%$term%'");
by daveismyname
Wed May 15, 2013 11:08 pm
Forum: PHP coding => Mail
Topic: PHP Mailer Not Reaching Everyone
Replies: 0
Views: 1169

Re: PHP Mailer Not Reaching Everyone

Hi All, New to this forum, I'm also quite new to PHP. I have a script using the php mailer that sends an email blast to some of our customers, for the most part it works quite well and is received by most. But the odd customer says that they do not receive it, it is not in their junk box, and their...
by daveismyname
Wed May 15, 2013 11:06 pm
Forum: PHP coding => Mail
Topic: Sending email template by php
Replies: 1
Views: 1622

Re: Sending email template by php

How can I send a email template by php by mail() ? for example, I have a email template on this link - http://mixfocuz.com/home-consulting/home-consulting.html how can I send this news letter ? Is there any better option of sending news letter beside mail() ??? yes use an email library like swiftma...
by daveismyname
Wed May 15, 2013 10:56 pm
Forum: PHP coding => General
Topic: Help For This Script
Replies: 1
Views: 847

Re: Help For This Script

yes check their API https://developer.flightstats.com/api-d ... ections/v1 as swarups mentioned.
by daveismyname
Wed May 15, 2013 10:52 pm
Forum: PHP coding => General
Topic: Problems with redirecting code
Replies: 1
Views: 738

Re: Problems with redirecting code

try it like this: <?php $salesrep = $_POST['salesrep']; if ($salesrep == 'Dan') { //redirect header('Location: http://www.reps_url.com'); exit; } elseif ($salesrep == 'Sally') { //redirect header('Location: http://www.reps_url.com'); exit; } else ($salesrep != '') { $name = "<h1>Code not on file</h1...
by daveismyname
Wed May 15, 2013 10:47 pm
Forum: PHP coding => General
Topic: Php/mysql register form with paypal.
Replies: 1
Views: 1019

Re: Php/mysql register form with paypal.

OK that's the problem the form is submitted directly to paypal so you don't have the opportunity to save anything to a database first what you want to to is submit the form to a php page save the data then post to paypal change the form action to a new php file here's a sample one to collect data, p...
by daveismyname
Wed May 15, 2013 10:39 pm
Forum: PHP coding => General
Topic: Parameter Passing
Replies: 1
Views: 558

Re: Parameter Passing

in your forms are you passing the pid in as a hidden field? might be helpful if you most your forms and the code on the edit page.
by daveismyname
Wed May 15, 2013 10:33 pm
Forum: PHP coding => General
Topic: PHP To create ICS file
Replies: 1
Views: 739

Re: PHP To create ICS file

Hi I haven't tried setting the start time over different time zones had a look around maybe this solution on http://stackoverflow.com/questions/3569 ... y-timezone will be what you need.
by daveismyname
Thu Mar 22, 2012 11:59 pm
Forum: PHP General
Topic: Login Help
Replies: 11
Views: 1020

Re: Login Help

OK what I normally do is wrap the login code inside a function then you can call that function and check the user if there's an errors loop through the array of errors and show the errors like this: <?php session_start(); include"database.php"; //log user in -----------------------------------------...
by daveismyname
Thu Mar 22, 2012 3:49 pm
Forum: PHP General
Topic: Login Help
Replies: 11
Views: 1020

Re: Login Help

to make the username and password safe for the database:

Code: Select all

$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
I do like how Freshmeet has it more efficient.
by daveismyname
Thu Mar 22, 2012 2:42 pm
Forum: PHP General
Topic: Login Help
Replies: 11
Views: 1020

Re: Login Help

I'd move the session_start to the top of the file like this: <?php session_start(); include"database.php"; ?> I've change empty to isset in the following statement if (!isset($errors)) { echo "You have logged in!"; } also you need to secure the username and password before passing them to the databa...
by daveismyname
Thu Mar 22, 2012 12:57 pm
Forum: mySQL & php coding
Topic: code not working properly
Replies: 1
Views: 566

Re: code not working properly

try warpping the if/else in braces: if ($course=='ENGL 1301'){ echo $course; } elseif ($course=='ABC 33') { echo $course; } elseif ($course=="VVV 34"){ echo $course; } elseif ($course=="CCC 95"){ echo $course; } elseif ($course=="MMM 12"){ echo $course; } elseif ($course=="OOO 89"){ echo $course; } ...
by daveismyname
Thu Mar 22, 2012 12:52 pm
Forum: mySQL & php coding
Topic: Delete IP After Set Time
Replies: 0
Views: 421

Re: Delete IP After Set Time

the only way I can think of off the top of my head is to create a cron job to call a page at regular times then check the time and delete the IP if necessary
by daveismyname
Thu Mar 22, 2012 12:46 pm
Forum: mySQL & php coding
Topic: query problem
Replies: 0
Views: 501

Re: query problem

it looks like you haven't enabled session on that page so the session data won't be available.
by daveismyname
Thu Mar 22, 2012 12:41 pm
Forum: mySQL & php coding
Topic: Display data from table and select one field
Replies: 0
Views: 582

Re: Display data from table and select one field

if the table has an id column then use the id to pass to the next page, from the id the database will pull the relevant row.
by daveismyname
Thu Mar 22, 2012 12:38 pm
Forum: mySQL & php coding
Topic: a form output adding to its own html string?
Replies: 2
Views: 574

Re: a form output adding to its own html string?

change the method type to get then the data in the form will be added to the url.
by daveismyname
Thu Mar 22, 2012 12:27 pm
Forum: PHP General
Topic: how to display texts from mysql randomly in a text field
Replies: 13
Views: 1004

Re: how to display texts from mysql randomly in a text field

give this a try: <?php mysql_connect("localhost", "user", "pass") or die("Connection Failed"); mysql_select_db("database")or die("Connection Failed"); $query = (mysql_query("SELECT name FROM advertising ORDER BY RAND()")or die(mysql_error()); $row = mysql_fetch_object($query); ?> <textarea name="nam...
by daveismyname
Thu Mar 22, 2012 12:14 pm
Forum: PHP coding => General
Topic: Deleting user nesting issue.
Replies: 1
Views: 376

Re: Deleting user nesting issue.

I think I see your problem

Code: Select all

$query = ("DELETE FROM users WHERE firstname'$username'");
your missing an = like firstname='$username'
by daveismyname
Thu Mar 22, 2012 12:10 pm
Forum: PHP coding => General
Topic: Best editor for PHP
Replies: 210
Views: 177880

Re: Best editor for PHP

I really like Sublime editor http://www.sublimetext.com/ it's a very clean editor and fast it can be extended with plugins too.
by daveismyname
Thu Mar 22, 2012 11:57 am
Forum: PHP General
Topic: Register Problem. Help
Replies: 6
Views: 656

Re: Register Problem. Help

don't use javacript for validation it can easily to turned off. Use php for that.

Here's how I validated email address:

Code: Select all

$email = $_POST['email'];
$pattern = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
if (!preg_match($pattern, trim($email))) {
	$error[] = 'Please enter a valid email address';
}
by daveismyname
Thu Mar 22, 2012 11:53 am
Forum: PHP General
Topic: how to display texts from mysql randomly in a text field
Replies: 13
Views: 1004

Re: how to display texts from mysql randomly in a text field

<?php mysql_connect("localhost", "myusername", "mypass") or die("Connection Failed"); mysql_select_db("mydatabase")or die("Connection Failed"); $query1 = ("SELECT name FROM advertising"); $result1 = @mysql_query ($query1) or die (mysql_error()); $data = mysql_fetch_assoc($result1); while($row = mys...
by daveismyname
Thu Mar 22, 2012 11:48 am
Forum: PHP General
Topic: Hoping Someone Could Show me How to Record a Current URL
Replies: 3
Views: 588

Re: Hoping Someone Could Show me How to Record a Current URL

you could log the url into a session then call the address stored in the session when you need it. To use session you need to make sure there enabled by using <?php session_start(); ?> at the top of the page before anything else. Also the same code needs to be on every page where you would use the s...
by daveismyname
Thu Mar 22, 2012 11:41 am
Forum: PHP General
Topic: Upload excel file into database
Replies: 4
Views: 725

Re: Upload excel file into database

why not just use csv then upload? there's no reason to want to use xls as far as I'm aware, the data will be imported into a database anyway I wrote a tutorial that explains how to import a csv file into a mysql database http://www.daveismyname.com/tutorials/php/importing-csv-spreadsheet-data-into-a...
by daveismyname
Thu Mar 22, 2012 11:33 am
Forum: PHP General
Topic: Can you have 2 Actions in 1 form
Replies: 0
Views: 393

Re: Can you have 2 Actions in 1 form

the captcha is not an action as such more of an input so you can process the form when its submitted and then check the captcha while processing the form

the captcha will be plaid out similar to this:

Code: Select all

<input type="text" name="captcha" size="3" maxlength="3">
by daveismyname
Sat Oct 15, 2011 3:30 am
Forum: PHP coding => General
Topic: A mySQL database utility. Simple help needed.
Replies: 3
Views: 659

Re: A mySQL database utility. Simple help needed.

in your inputs they have no value associated with them.