Search found 13 matches

by php9
Fri Feb 22, 2013 3:13 am
Forum: mySQL & php coding
Topic: If Else Statement / PHP Form
Replies: 0
Views: 636

Re: If Else Statement / PHP Form

Well you can check if the user entered some content into a field using:

Code: Select all

if(!empty($_POST['something']))
{
    // user entered some content
}
Using that you can have your script only do the insert when there is some content.
by php9
Fri Feb 22, 2013 3:11 am
Forum: mySQL & php coding
Topic: cannot connect to DB first time
Replies: 2
Views: 899

Re: cannot connect to DB first time

What error are you getting when using the command prompt?
by php9
Fri Feb 22, 2013 3:09 am
Forum: mySQL & php coding
Topic: php search script add pagination
Replies: 0
Views: 644

Re: php search script add pagination

Are you getting any error messages? Check your PHP error log and post back.
by php9
Fri Feb 22, 2013 2:55 am
Forum: mySQL & php coding
Topic: Simple php program adding name, doesn't work
Replies: 1
Views: 1530

Re: Simple php program adding name, doesn't work

You say there's no syntax error in the code, but does mysql_error() show anything at all?
by php9
Fri Feb 22, 2013 2:53 am
Forum: mySQL & php coding
Topic: insert values into database using pdo
Replies: 1
Views: 933

Re: insert values into database using pdo

Post the code in this thread and I'll take a loot. PDO is a great library to use because it supports Prepared Statements (for SQL Injection prevention).
by php9
Fri Feb 22, 2013 2:52 am
Forum: mySQL & php coding
Topic: php string problem
Replies: 0
Views: 659

Re: php string problem

A 404 error means you have the wrong URL for your PHP script. The code itself likely has nothing to do with it. Check the path of your script.
by php9
Fri Feb 22, 2013 2:51 am
Forum: mySQL & php coding
Topic: Problem in Creating and Inserting Values
Replies: 1
Views: 763

Re: Problem in Creating and Inserting Values

Check the return value of mysql_error(), it will tell if the description of the problem (if it's a problem with your query or database connection).
by php9
Fri Feb 22, 2013 2:49 am
Forum: mySQL & php coding
Topic: Updating mySQL field from form post is blank
Replies: 0
Views: 716

Re: Updating mySQL field from form post is blank

The problem is you haven't defined $status anywhere, so it will always be blank.
by php9
Fri Feb 22, 2013 2:41 am
Forum: PHP General
Topic: need help with simple for loop new to PHP and forum
Replies: 0
Views: 761

Re: need help with simple for loop new to PHP and forum

That's pretty easy if you know which function to use. In order to do it in only one loop, you'll need to use the str_repeat() function. Here's the code:

Code: Select all

for($i=1; $i<6; $i++)
{
    echo str_repeat('*', $i) . "<br />";
}
This will show the desired output on a page.
by php9
Fri Feb 22, 2013 2:36 am
Forum: PHP General
Topic: SoapClient Help
Replies: 0
Views: 768

Re: SoapClient Help

For future reference, have a look at the WSDL (Web Service Description Language) file for your web service. It will tell you exactly what structure to send, which you can normally do without SoapVar, jusy by calling the service with params:

Code: Select all

$response = $client->SomeService($params);
by php9
Fri Feb 22, 2013 2:31 am
Forum: PHP General
Topic: Check IP and Echo Different Variable
Replies: 1
Views: 951

Re: Check IP and Echo Different Variable

Something like this would do it

Code: Select all

$link1= 'http://link1';
$link2 = 'http://link2';

$link = $ipAddress == '127.0.0.1' ? $link1 : $link2;

echo '<a href="' . $link . '">My link</a>';
by php9
Fri Feb 22, 2013 2:27 am
Forum: PHP General
Topic: Need Help, phpnoob here
Replies: 1
Views: 762

Re: Need Help, phpnoob here

the most obvious thing that jumps out at me is that you don't have 'home' quoted, so you should probably be getting unknown constant errors. That's true, there would be an unknown warning/notice but this won't produce a fatal error. PHP will fail to find the constant and then assume "home" is a str...
by php9
Fri Feb 22, 2013 2:24 am
Forum: PHP General
Topic: help how to make add form
Replies: 1
Views: 4823

Re: help how to make add form

An option is to keep the user on the same page. So your form is shown by insert.php and it also submits to insert.php. By check if the form is submitted you can do the insert, show a message and let the page show the form as it would do if there was no submission (ie first page view).