Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-28-2011, 10:27 PM   PM User | #1
boominaudio
New to the CF scene

 
Join Date: Jan 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
boominaudio is an unknown quantity at this point
help with php! and mysql query!

Hello.

I have a PHP script that collects data from the form and inserts the data into a mysql query

the query will execute and display the information

my question is:

I can type the url of my php script and it will execute and display the whole database without having anything inserted into it

in other words when i directly execute my php script which is at

url.com/dir/myscript.php


it will execute the whole database


the sql looks like this when i go to that page without having sent data

SELECT * FROM PLACES WHERE NAME LIKE '%%'

is there a php function that can validate that there is actually data being sent?

please and thank you
boominaudio is offline   Reply With Quote
Old 02-28-2011, 10:41 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
You can verify the page is being reached from your form easily by checking one of your $_POST variables. use isset() to see if the variable is set, and you can also check the value in the variable to make sure it's what you expect it to be.

Don't run your query if the qualifier(s) in your query are blank.
__________________
Fumigator is offline   Reply With Quote
Old 02-28-2011, 10:57 PM   PM User | #3
boominaudio
New to the CF scene

 
Join Date: Jan 2011
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
boominaudio is an unknown quantity at this point
Quote:
Originally Posted by Fumigator View Post
You can verify the page is being reached from your form easily by checking one of your $_POST variables. use isset() to see if the variable is set, and you can also check the value in the variable to make sure it's what you expect it to be.

Don't run your query if the qualifier(s) in your query are blank.
$name = $_POST['name'];

select * from table where name like '%$name%'

where exactly do i put the isset function ?
boominaudio is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:27 AM.


Advertisement
Log in to turn off these ads.