Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Getting Form Info Into A Mysql Select Statement


I'd like to get user input from an html form into a mysql select
statement. Here's where I'm stumped:

$result = mysql_query("SELECT * FROM dept WHERE notes LIKE
'%search-string%'",$db);

I need to get the user's input into the '%search-string%' section, but I
do not understand how to do this. I can hard-code a specific search
string and it will work, but I want the users to be able to dynamically
define the search-string. So, I created a basic html form and used the
post method to grab their input, but now I can't insert that input into
the mysql select statement. Any ideas? I think it should be easy, I just
don't know how to do it. I've tried this:

$result = mysql_query("SELECT * FROM dept WHERE notes LIKE
'%$_POST["search"]%'",$db);

But it doesn't work. Below is the form in html and the php file:

<html>
<title>Search Test</title>
<head>
</head>
<body>
<form action="search-db.php" method="POST">
<p>Enter Your Search: <input type=text name=search></p>
<input type="submit">
</form>
</body>
</html>
-----------------------------------------------------------
<html>
<body>
<?php
$db = mysql_connect("localhost", "Anonymous");
mysql_select_db("computers",$db);
$result = mysql_query("SELECT * FROM dept WHERE notes LIKE
'%surplus%'",$db);
echo "<table border=1>
";
while ($myrow = mysql_fetch_array($result)) {
printf("<tr><td><b>%s</b></td></tr>
", $myrow[notes]);
}
echo "</table>
";
?>
</body>
</html>




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Question Regarding A MySQL SELECT Statement
I tried hunting for a MySQL specific NG and didn't find one but I did
see that MySQL questions get asked here. If this isn't appropriate and
you know of an appropriate NG then that would be great.

In one table I have inventory...
table name is "inventory"
columns are..
-----------------------------
item_number item_name
-----------------------------
1 radishes
2 carrots
3 potatoes
4 oranges
etc..etc

Table two is "sold"
------------------------------
date item_number
13Mar 1
14Mar 4
15Mar 2
16Mar 1


What I am querying is the table "sold" for the Unique items (1,4,2)
and then retrieving their names from table 1.

My query below isn't working..
SELECT item_name FROM inventory WHERE inventory.item_number =
sold.item_number;

I am just now starting to get into complicated MySQL queries and
actually the more I learn about it the more I love it.

MySQL UNION: Only The First Select Statement Returns A Result.
I am attempting to join multiple select statements into a single query.
However, I am not able to extract the result of any of the UNIONED selects.











$query1 = mysql_query ("
(
SELECT SUM(deposits) AS total_deposits
FROM table1
)

UNION ALL
(
SELECT SUM(withdrawals) AS total_withdrawals
        FROM table1
)
")
or die (mysql_error());

$result1 = mysql_fetch_array($query1);
extract($result1);




When I echo the results of the second select statement I get nothing.


echo  $total_withdrawals;

Multiple Select From Listbox And Execute A Sql Query Select Statement
Supposing i have a html form with 2 listbox and i name it status and resolution.

So it goes <select name='status[]'>... <select name='resolution[]'>

Then i have a another php page.
$status = $_POST['status'];
$resolution = $_POST['resolution'];

Now my question is, how do i do the sql query statement?

mysql_query("SELECT * from bugs where status=$status and resolution=$resolution");

The problem is, i select 3 options form the status listbox eg. new, closed, duplicate. And from the resolution, i chose fixed, invalid.

Select Statement - Select Random ID #
I have made up a page that pull info on 13 branches of stores onto one main page. It's basically there to display all the branches on one page... then you click on the one you're interested in and then you go to a more detailed page.

Back to the main page. On the top, there's kind of a featured branch that has a bigger picture and bigger title but it's still getting pul pulled from the same table etc etc etc.

In order for me to avoid favortism to one branch (and for other branches to start complaining) I want to ramdomized the order every time someone came to page but I have no idea how.

right now I have a super simple select statement.

Variable In Select Statement
Hi,

I want to do the following:

Select ID
From tablename
where name='$name'

How do I do this in PHP?

Select Statement Problem
I am having a problem with simple select statement When I run this statement in my PHP program.. no result..

$sql= "select * from zipcodes where zip between $pluszip and $minuszip";

But when I run the below statement I get the results..

$sql= "select * from zipcodes where zip between 12345 and 12456";

I tried this one also, but no result

$sql= "select * from zipcodes where zip between '$pluszip' and '$minuszip'";

I tried echoing pluszip and minuszip and i am getting the values printed. I am having trouble with passing it on to the select statement.

Versatile SELECT Statement
My SELECT statement below works if I have made an actual selection for the area_ID, but when I generate the page initialy no selection has been made yet which results in zero hits for the current version_ID. Do I need to make an additional SELECT statement and remove PHP Code:

Error In Select Statement
I have the following SELECT statement which aims to select data from the database for a month ago today however im getting an error message as shown below. SELECT STATEMENT

$dbQuery="SELECT * FROM data WHERE ReportedDate BETWEEN date("Y-m-d", strtotime("-12months")) AND date("Y-m-d", strtotime("-11 months"))";

ERROR MESSAGE: Parse error: parse error, unexpected T_STRING

Password() And Select Statement
problem in retrieving a row form a table that I created in
mysql db.
I insert these values in the table
'Bell',password(ì«').
But the problem is in my php application I cant retrieve this row
because the password that I pass dosn't match the password value in the
table.
this is the code that I wrote in my php application

$user = $_POST[username];
$pass = $_POST[password];
$q = mysql_query("SELECT * FROM admin WHERE username = '$user' and
password =PASSWORD('$pass')");

if(mysql_num_rows($q)==0){
echo "Acces denied. User not allowed to connect.";
mysql_close();
}
else
{
echo
"<script>window.location.replace('administrator2.php')</script>";
}

Select Distinct Statement
I have a question about the following PHP script - I got it off a web
site tutorial on how to count users logged into your site - my
question is the $PHP_SELF variable - it writes the name of the web
page to the 'file' field in the table - I don't understand why it is
doing that - I mean, isn't the SELECT DISTINCT statement only pulling
those records from that one web page? I guess I just don't follow what
it is doing with that SELECT DISTINCT statement?

$timeoutseconds = 300;
$timestamp = time();
$timeout = $timestamp-$timeoutseconds;

$php_SQL = "INSERT INTO online SET timestamp='$timestamp',
ip='$REMOTE_ADDR', file='$PHP_SELF'";
$php_resultID = mysql_query($php_SQL, $php_linkID);

$php_SQL = "DELETE FROM online WHERE timestamp < $timeout";
$php_resultID = mysql_query($php_SQL, $php_linkID);

$php_SQL = "SELECT DISTINCT ip FROM online WHERE file = '$PHP_SELF'";
$php_resultID = mysql_query($php_SQL, $php_linkID);
$php_users_online = mysql_num_rows($php_resultID);

if ($php_users_online == 1)
{
print "<BR>$php_users_online user is currently online";
}
else
{
print "<BR>$php_users_online users are currently online";
}

Select Statement Not Valid?
I'm doing a search via the passing of values throught the url. I'm having a problem with the select statement. If i enter the values and the match (side1='$valueSide1' AND side2='$valueSide2') portion of the statement the correct values are returned.

But if I reverse the values and the do match (side1='$valueSide2' AND side2='valueSide1') then no match is returned. I've verified through command line that the statement works.
Does it look like my statement if formatted correctly? Code:

Variable Select Statement
I would like to have a form that gives the user choices for selection
parameters for email, printing etc.

A real simple example:

Give me all ______ who ______ when _______ where _______

I can figure this out if all of the selections are filled, but NOT if
they just decide to use only one of the selection choices.

I'm sure this is idiotic, but I'm really new to php and my ideas are
writing checks my programming skills can't cash.

Simple SELECT Statement
I have a dbase with some gigs that has a date field. The SELECT statement currently says...

QuoteSELECT * FROM `Gigs` ORDER BY `Eventdate` ASC LIMIT 3

which works fine but I also want the statement to only show gigs that havent happened yet or that are > than today's day. I tried WHERE Evevntdate > CURRENT_DATE or something along those lines but so far havent got it to work.

Strpos In A Select Statement
I am trying to query a Access database using the following code but I get an SQL error Syntax error (missing operator) in query expression. Is it possible to use strpos in a SQL statement?

pro_id is a field in the database whose value is 489

$valves = 489;

$SQLQuery = "SELECT * FROM Products WHERE strpos(".$valves.",pro_id,1) !== 0";

Maximum Lenght Of Select Statement
Can anyone tell me what the maximium length of a SELECT statement can be. I am coming from Foxpro where 8100 char was the limit. Part of my program is a query builder and I need to build a query from a series of drop down lists users select values from.

PHP, ODBC, SQL Server Select Statement
I am having a problem getting results back from a SELECT statement
using the script below. The field names contain decimals and I am not
sure wether or not this is causing the problem or not?? I am
connecting to a SQL server db using ODBC, first time connecting to SQL
server but have been using ODBC to connect to Access db's for years. I
have entered the field names just as they are in the table and I have
tried replacing the spaces and decimals with underscores but still
recieve the same error. Anyway, my simple script and the error that I
am recieveing is below. Any help would be greatly appreciated..

$connect = odbc_connect('cabngsql', '', '');
if (!$connect)
{
echo "couldn't connect";
exit;
}
$query1 = "SELECT fol no FROM Protocol.folder";
$result1 = odbc_exec($connect, $query1);
while (odbc_fetch_row($result1)){
$folder = odbc_result($result1, 1);
echo "$folder";
}
?>

ERROR: SQL error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid object name 'Protocol.folder'., SQL state S0002 in
SQLExecDirect

SELECT Statement Syntax For Variables
the statement below isn't returning the expected results. I've echoed it at runtime and the variables are missing. I presume it's just the syntax?

$query = "SELECT field FROM database.table WHERE email='$e' AND password='$p'";

How Do I Return 10 Results Per Page Using SELECT Statement?
I'm wasn't sure whether to post this under the PHP or under the MySQL section of the forums. Since most people (I'm assuming) who write PHP script, also use MySQL, I thought I'd stick with PHP. I'm rather new to both PHP and MySQL and I'd be very grateful to anyone who can help me solve a problem I'm having at the moment. First, I'll give you an introduction to my little project...

I'm developing a database in MySQL that is used to store the song titles of all the MP3s I have on my PC. I've written a basic search feature that works well. The user has 2 options: Either he can type a special "!ALL" "parameter", that I made up, to return all the songs in the database or the user may enter a few characters in the textbox and select "song title" or "artist" etc. from a dropdown to search for a specific song title or artist etc.. Hope you are following so far? Say for example the user presses submit after typing "!ALL" to return all the song titles - there could be hundreds of results. What I want to do now is display 10 results on a page, then on the next page another 10, etc. (like a real search engine!). I've tried doing it with the LIMIT statement, but like I said I'm new to this and discovered that that is not the right way of going about it. My question is this: how would I go about returning 10 matches per page? Do I use hidden form fields? What would the SELECT statement look like? What would the PHP scripting look like to setup the "back" and "forward" navigation between the result for the search?

Mix Two Tables In A Single SELECT Statement - Not A Join
I have an Intranet with the organisation I work with. In this
organisation there are two departments - community department and press
office. Both the community department and press office have thier own
news system where they can add news in their own admin section that
will appear on their homepages. Both admin section have their own DB
table thus two seperate tables.

I would like to select all the rows from both tables in a single SELECT
statement so when I output them they will be integrated. This is not
the same as a table join as their are no keys and I want the rows from
both to remain seperate. Can this be done? Could someone please post an
example SQL statement demonstrating this if so?

Run A Select Statement Based On Array Values?
I have an array that has x number of values. I want to run a sql statement x number of times using the next array value each time. Basically I have a query that displays results based on a search. The result of the search is a list of names, the trouble is for reasons beyond my control the names are in a single db field as "FirstLast".

I want to take this value and match it up to another table that has the first and last names in separate fields. So far I have extracted the results from the first query using a while loop, the resulting array is called $name_search: Code:

SELECT Statement Results Into Text File
I am trying to create a text file based off the results of a query statement from a database. See code below:

$itemq = "SELECT sdlitm, sddsc1, sduorg, sdlnid, sduncs FROM F4211 WHERE sddoco = $ordernum AND sddcto LIKE '$ordertype' ORDER BY sdlnid";
$result3 = odbc_exec($connect, $itemq);
    while (odbc_fetch_row($result3)){
    $partnum = odbc_result($result3, 1);
    $desc1 = odbc_result($result3, 2);
    $qty = odbc_result($result3, 3)/100;
    $position = odbc_result($result3, 4);
    $uncs = odbc_result($result3, 5);
    $extcost = $uncs*$qty;
    $total = ($total + ($uncs * $qty));
    $filename = "$reportnumber.txt";
    $fp = fopen($filename, "w");
    fwrite($fp, "Activity Number: $reportnumber
");
    fwrite($fp, "Warranty Type: $reason
");
    fwrite($fp, "Customer Name: $custname
");
    fwrite($fp, "$qty $partnum $desc1
");
    fclose($fp);

Everything works fine until I get to the line:

fwrite($fp, "$qty $partnum $desc1
");

This line should actually print multiple lines into the text file as these are the line items from an order. There could be anywhere from 1 to 20 lines written to the text file. As it stands, the only line items written to the text file are those of the last line found on the order. The entrie script dealing with the text file are still within the confines of the while statement curly braces. How do I write these lines out in the text file??

Select Statement With Changing Tables Base On User Selection
I am trying to make a select statement that would allow me to change the table, base on the user selection from a drop down menu list. I don't know if its possible or my syntax is wrong PHP:

sql = SELECT * FROM "'.$_POST[Tableselection].'" WHERE  "'.$_POST[userid].'" ='1';

Php Form Info...
have a form, with a text input "fieldname".
method POST

$var = $_POST["fieldname"]

$var is then used to search in mysql

select * from table where jobtype like '$var%'
OR jobtype like '%$var%'
OR jobtype like '%$var'
OR jobtype like '$var' order by date asc;

basically i'm doing a search for any string that matches the searched
input, being at the beginning, middle or end of the jobtype column.

query works great, except when the string contains the 4-letter word
'info' such as information or informative
then the mysql query breaks down and give the usual:

Error performing query: You have an error in your SQL syntax. Check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'ORDER BY date ASC' at line 1

Now after much debugging, i found out that the php _POST variable
treats anything with info as a numner of 0 value.
inf is treated as text, nformation is treated as text, but anything
with info gets a 0 value.

Searched php.net and couldn't find anything related to this feature,
looked under security to see if it was related to that, but nothing.

Php Form Info...
have a form, with a text input "fieldname".
method POST

$var = $_POST["fieldname"]

$var is then used to search in mysql

select * from table where jobtype like '$var%'
OR jobtype like '%$var%'
OR jobtype like '%$var'
OR jobtype like '$var' order by date asc;

basically i'm doing a search for any string that matches the searched
input, being at the beginning, middle or end of the jobtype column.

query works great, except when the string contains the 4-letter word
'info' such as information or informative
then the mysql query breaks down and give the usual:

Error performing query: You have an error in your SQL syntax. Check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'ORDER BY date ASC' at line 1

Now after much debugging, i found out that the php _POST variable
treats anything with info as a numner of 0 value.
inf is treated as text, nformation is treated as text, but anything
with info gets a 0 value.

Searched php.net and couldn't find anything related to this feature,
looked under security to see if it was related to that, but nothing.

Can anyone look into it and elaborate?
create a form, then echo the value of the $_POST variable
and try words that contain info in them.

Getting Info Out Of Dynamic Form
I am using the following code to produce a dynamic form.

$result = mysql_query("SELECT id,weight,date FROM weekly_data WHERE
weight IS NULL AND subscr_id = '$toss' AND date <= now()");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
print"<table width=ï`%' id='catchup' border=&#390;' cellspacing=&#390;'
cellpadding=&#390;'>";
print "<form name='form1' id='form1' method='post'
action='catchupprocess.php'>";
print"<tr>";
print"<td></td>";
print"<td>Weight</td>";
print"<td>Date</td>";
print"<td>Waist</td>";
print"<td>Measure</td>";
print"<td></td>";
print"</tr>";
while ($row = mysql_fetch_array ($result)){
//echo $result;
print"<tr>";
print"<td>";
print"<input name='".$row['id']."' size=&#394;' type='text'
value='".$row['id']."'/>";
print"</td><td>";
print"<input type='text' size=&#396;' name='weight".$row['id']."'
value=''/>";
print"</td><td>";
print"<input type='text' size=&#3910;' value='".$row['date']."'/>";
print"</td><td>";
print"<input type='text' size=&#393;' name='waist".$row['id']."'
value=''/>";
print"</td><td>";
print"<input type='text' size=&#396;' value='$measure'/>";
print"</td><td>";
print"<input type='hidden' size=&#3910;' value=''/>";
print"</td>";
print"</tr>";
}
print"<tr>";
print"<td>&nbsp;</td>";
print"<td><input name='Reset' type='reset' value='Reset'></td>";
print"<td>&nbsp;</td>";
print"<td><input name='submitcatchup' type='submit'
value='Submit'></td>";
print"<td>&nbsp;</td>";
print"</tr>";
print"</form>";
print"</table>";
?>

Persistent Form Info
I have some forms that have different parts, and it decides which parts to display through the url ie form.php?showpart=1, showpart=2, etc. If I want to show another part and change the url all the form info goes away.  I'm a self taught PHP guy, I'm decent but not amazing.  My current solution is to use AJAX to write/modify a cookie everytime the user writes something and bring that in when they change the page. Is there an easier way?

Printing Out Info From A Form
I have this php function that reads a text file for input to create a form. I am trying to get the form to print out the data on a separate page, but all I get is a blank page. Am I calling the page correctly, or is this even possible to do? Code:

Referer And Keyword Info Sent Via Form?
I've learned that HTTP_REFERRER, at least in my tests, returns the page visted on the current domain before the form page, not the domain visited before the current domain, so that hasn't been useful. I don't know how I would get keywords in this case. I've searched around for scripts or tutorials and have been surprised to find nothing helpful

The site in question has a separate stats package, but it doesn't track converting keywords and that's really what I'm after. There isn't high volume traffic, so getting them individually via a form (rather than input into a database) isn't a problem.

My question is really whether what I'm trying to do is possible with a few lines of code, or have I underestimated the complexity of the task?

Populating A Form Wth Database Info
I've coded a piece of code which populates a form with data read from the database:

$connection=mysql_connec ("localhost", "f2821842", "f2821842");
$result=mysql_select_db("QUERIES");
$query=mysql_query("Select * from Emp_Details where emp_num = '$employnum'");
while($row=mysql_fetch_array($query))
{$empname=$row['emp_name'];}

<form name="webregform" action="webadmin2.php" method="post">
<input name="requiredname" type="text" size="30" value="<?php echo "$empname"; ?>">
</form>

When I echo the $requiredname, I get spaces and no data, and I know that $empname is not a space-it does read a value in a database. 1. How can I get $requiredname to print a value?

Insert Form Info Into Database
i am trying to enter info from a form into a mysql database. when i submit the form, a new row is created, but the information isn't contained in it? any thoughts? PHP Code:

Filling Form With Database Info
I have a table with 5 fields for a tour business activity list
: (1) id -table key (2) name (3)description (4)picture -text link not
binary(5) country. I would like to create a form that takes all the
activitys an puts it neatly down on site in checkboxes so user can
select activtys.this will be linked to form mail.i would like the
activitys to be seperated by the country they r in?

Some Users Can't Enter Info Through My Form To My DB
I set up a comment page on my site and most users can enter comments.  the page refreshes and shows the comments below.  however, some users can't enter comments.  what should I be looking for to resolve this?

If Statement And Form
I have created the below form and it all works fine except for the last if statement. What I want it to do is if all fields/variables have a value then to process the form. On testing it creates no parse errors so I'm not sure what's going wrong. For testing purposes I have got it to print a basic test message of successful!. PHP Code:

Validating Form Info Before Inserting It Into Database
I have been trying to create a PHP application where you can add customer contacts to a MySQL database.

Now, my problem began when I created a form where the user can add in a customer's name and info to the database. In an effort to alert the user that they may be adding a customer that is already setup in the database, knowing that some of the customers may have the same names, e.g. there is more than one Bobby Ray Brown, I decided to add a script that queries the "customers" table in the database and searches for all results that match the input from the user. Code:

PHP Displaying Info Input On HTML Form
I'm in an exercise where I've created an order form in HTML. The form displays properly and allows me to input certain test order info just fine. The relevant lines in the HTML form are: Code:

Upload And Email Form Info At The Same Time
I need to upload something and also have an email sent at the same time after filling out a form. So they will fill out a form, decide what they want to upload and then hit the submit button and it will upload the file to my directory, where I can get to it, and then it will also email me the information I had them fill out in the form at the same time. Is that possible? What code would I use?

Taking Info From A Form, Saving It In A DB And Writing It To A .css
What I need to do is take "site info" from a form, save it to a database table called siteinfo, and then write style information based on the variables. Code:

File Form - Keep Local Path Info On Reload
Is there a way to retain the local path info for a file form when the page reloads?

Using Form To Post Info And Pic's (Warning: Unable To Fork)
I have created an admin form which allows the admin to update info and pic's to his site but I am having trouble with the update_pic script. When I pass along the form to the php script it gives me the following error message:

"Warning: Unable to fork [C:WINDOWSTEMPphp30.tmp /full/path/to/joesauto/images/anime_dvd_icongif.gif] in c:inetpubwwwrootadd_data.php on line 39"

This is line 39: exec("cp $picture /full/path/to/joesauto/images/$picture_name");
This is the form I used which was taken from this site. Code:

How Do I Put SELECT Statement Into "for" Array?
Does anyone know how I can put the SELECT statement below into a for array?

Info From MySql DB
Problem : I have a table in mysql with titles as such :

ShipIDNameMcostCcostBuildETA(there are more)

I run the query :

for($i=1;$i<=9;$i++){
$query = "select Name, Mcost, Ccost, BuildETA from ships where ShipID=$i";
$result = mysql_query($query)
or die("Query failed");

I want to refer to "Name", "Mcost", "Ccost" and "BuildETA" so i can use them to build a table. So i need to assign them to variables in an array so i can loop to make a table with as many rows as there are "ShipID"'s. The thing is that all the ways i have tried of refering to individual column names have failed.

Syntax Issue With Form And Conditional Statement
Is it possible for a <form ... action="program.php"> to contain a conditional statement for the action? For example, I want to call one PHP program if variable $a="screen" and another program if variable $a="download". I have been struggling with this for some time and cannot seem to get it to work.

Enter Info Into Mysql
I am relatively new to PHP and MySQL and I am testing a simple form that is not working:

Getting Mysql Table Info?
Suppose I have a table with name 'tablename' in my database.

If I have no idea what are the contents of this table, is it still possible to retrieve the structural info in this table, like the field names and sizes?

(Adding/getting Info From MySQL Db)
I need to be able to login to add names and coordinates (X and Y) into a MySQL database from a webpage and from another page, allow people to type in a name to seach for their coordinates. the coordinates can be -/+ (negative or possitive).

I'm just not sure of how to do it, I'm not that far in the learning process yet. Any help would be greatly appreciated. I have created the database (no rows or anything). I also have phpMyAdmin installed.connection string: PHP Code:

PHP, MySQL And Snippets Of Info ...
I'm looking at storing snippets of details in MySQL about what credit cards
a business excepts. Rather than have a whole column for Visa, another for
Amex etc ... I am looking at having a column called payment types and
inserting multiple codes ... e.g. ViAmBcCa

Is this a good way of doing things? To me it'd be a lot cleaner and limit
amount of Db work to be done. Is this a sensible way in your opinion? What's
the best way of getting the info back out via PHP? Put in a delimiter e.g.
Vi-Am-Bc-Ca- or keep codes to two digits and split by that length?

MySQL Does Not Show On Php Info
I installed Apache, php5 and MySQL 5. The usual <?php phpinfo(); ?gives
the php info, but there is no sign of MySQL, so something is wrong.
I installed the latest connectors. Can someone help me getting php and
MySQL interconnect?

Format MySQL Info?
Is there a way to make the contents of my MySQL table the same as the way it went in?

For example, if I insert:
1
2
3
4
5
6
into my MySQL table, it comes back out as: 1 2 3 4 5 6

Is there a way to fix that? My field type is TEXT, if that matters.

Sending Info To MySQL Db
How is it safe to send info to MySQL database? Should I encrypt/encode the data before sending it? for example:

<?php
...
//connection is established
...
$insert = "INSERT INTO table_name VALUES('$var1', '$var2')";
mysql_query($insert);
?>

Is it possible to use get access to my database, i.e to DROP TABLE/DATABASE or smth. Have heard of MySQL injection.


Copyright © 2005-08 www.BigResource.com, All rights reserved