Results 1 to 25 of 25
Thread: PHP Help
-
07-16-2009, 05:03 PM #1Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
PHP Help
Hey everyone,
Well I'm having some trouble, I can't seem to get this edit script to work.
I found a great tutorial and changed it around a lot, and I simply can't figure out the first.
The error I am getting: Query failed: Unknown column 'name' in 'where clause'
My goal is to have it load the information that is in the database and then post it so I can edit the information, once I have changed what I wanted, have it re-submit to the database making the changes.
Edit_Record.php
Code:<html> <body> <form name="update_record" action="update.php" method="post"> <table style="margin-bottom: 1px; padding-left:10px;" border="0" cellpadding="0" cellspacing="1" width="75%"> <tbody> <tr> <td align="right" bgcolor="#e9ece9" >Enter Doctor ID to edit: </td> <td bgcolor="#e9ece9" style="padding-left:4px;" > <input name="phone" size="20" maxlength="20" value="<? echo $BNAME; ?>"> </td> </tr> </tbody> </table> <table style="margin-bottom: 1px; padding-left:455px;" border="0" cellpadding="0" cellspacing="1" width="50%"> <tbody> <tr> <td colspan="2" align="right" bgcolor="#dadce1" height="4"> <input name="submit" value="submit" type="submit"> </td> </tr> </tbody> </table> </body> </html>
Code:<?php #Form Variables. $BNAME=''; #Database connection strings. $usr = "#"; $pwd = "#"; $db = "#"; $host = "localhost"; # connect to database $cid = mysql_connect($host,$usr,$pwd); mysql_select_db($db); if (mysql_error()) { print "Database ERROR: " . mysql_error(); } if(isset($_POST['submit'])){ extract($_POST); #A query is written which will extract all information #from basic_info table based on phone number entered. $query = "SELECT * FROM INFORMATION where name='".$BNAME."'"; #Execute query and store result into variable $result. #echo $query; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { $BNAME=$row["name"]; $FAPPOINTMENT=$row["fappoint"]; $SAPPOINTMENT=$row["sappoint"]; $NOMINATION=$row["nomination"]; $NOMINATIONC=$row["nominationc"]; $FINALIST=$row["finalist"]; $FINALISTV=$row["finalistv"]; $NOTESPS=$row["notesps"]; $NOTESND=$row["notesnd"]; $DATE=$row["date"]; } echo "<form method=\"post\">"; echo "<table style=\"margin-bottom: 1px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"60%\">\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\" colspan=\"2\">Business Name:\t $BNAME</td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"hidden\" value='$BNAME' name=\"name\" size=\"50\" ></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">First Appointment: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"text\" value='$FAPPOINTMENT' name=\"fappoint\" size=\"50\" ></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Second Appointment: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"text\" value='$SAPPOINTMENT' name=\"sappoint\" size=\"50\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Nomination Received: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$NOMINATIONC' name=\"nomination\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Nomination Congratulations (Letter/Visit): </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$NOMINATIONC' name=\"nominationc\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Finalist: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$FINALIST' name=\"finalist\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Finalist Congratulations Visit: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$FINALISTV' name=\"finalistv\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Products Sold: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <textarea value='$NOTESPS' name=\"noteps\" rows=4 cols=30></textarea></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">New Dollars: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <textarea value='$NOTESND' name=\"notend\" rows=4 cols=30></textarea></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Date of Last Contact: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$DATE' name=\"date\"></td>"; echo "\t</tr>\n"; echo "</table>\n"; echo "<table style=\"margin-bottom: 1px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"40%\">"; echo "<tr>"; echo "<td colspan=\"2\" align=\"right\" bgcolor=\"#dadce1\" height=\"4\">"; echo "<input name=\"submit02\" value=\"submit\" type=\"submit\">"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; #Free up Memory for $result. mysql_free_result($result); #Close database connection. mysql_close($link); } ?>
$BNAME - varchar(60)
$FAPPOINTMENT - varchar(60)
$SAPPOINTMENT - varchar(60)
$NOMINATION - varchar(60)
$NOMINATIONC - varchar(60)
$FINALIST - varchar(60)
$FINALISTV - varchar(60)
$NOTESPS - text
$NOTESND - text
$DATE - varchar(60)Not sure what to put here :-P
-
07-16-2009, 05:47 PM #2Web Hosting Guru
- Join Date
- Jun 2003
- Location
- Scotland
- Posts
- 299
PHP Code:$query = "SELECT * FROM INFORMATION where name='".$BNAME."'";
Is it not sufficient to have
PHP Code:$query = "SELECT * FROM INFORMATION where name='$BNAME'";
Last edited by liam_tmt7; 07-16-2009 at 05:48 PM. Reason: new suggestion
-
07-16-2009, 05:59 PM #3Web Hosting Master
- Join Date
- Mar 2008
- Posts
- 1,717
Should it not be bname? You're not showing a name column in your schema, yet you're asking for it. You don't need PHP help you need SQL help, I recommend sams' teach yourself SQL in 24 hours.
Also, sanitize that input. What happens if your post variable is "' or 1=1 or '"? Ideally since you seem to be starting from scratch, look into whether or not your language's SQL interface supports prepared statements (sometimes called query binding) and do it that way from the start... things that come from userland ideally shouldn't be anywhere near the query when it's parsed.I used to run the oldest commercial Mumble host.
-
07-16-2009, 07:07 PM #4Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
-
07-16-2009, 07:28 PM #5Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
To reiterate what fwaggle stated:
1. The database structure should be:
name - varchar(60)
fappoint - varchar(60)
etc.
2. Make sure you understand SQL injection and protect your script against it before it goes public.Chris
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
07-16-2009, 07:41 PM #6Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
The script won't need much protection, it's going to be in a password protected members area, so I should be fine there, also thanks foobic, I appreciate the help.
I have changed the name field to BNAME, should that fix my issues?
Code:$query = "SELECT * FROM INFORMATION where name='".$BNAME."'"; #Execute query and store result into variable $result. #echo $query; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { $BNAME=$row["BNAME"]; $FAPPOINTMENT=$row["FAPPOINTMENT"]; $SAPPOINTMENT=$row["SAPPOINTMENT"]; $NOMINATION=$row["NOMINATION"]; $NOMINATIONC=$row["NOMINATIONC"]; $FINALIST=$row["FINALIST"]; $FINALISTV=$row["FINALISTV"]; $NOTESPS=$row["NOTESPS"]; $NOTESND=$row["NOTESND"]; $DATE=$row["DATE"]; }
Last edited by mooseweb; 07-16-2009 at 07:49 PM.
Not sure what to put here :-P
-
07-16-2009, 08:04 PM #7Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
Provided that the field name in your database is in fact "BNAME" and not "$BNAME" as you stated earlier, or "name" as the code suggests. You can verify your table structure with this (in phpMyAdmin, for example):
Code:SHOW CREATE TABLE INFORMATION;
Last edited by foobic; 07-16-2009 at 08:11 PM.
Chris
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
07-16-2009, 09:03 PM #8Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
-
07-16-2009, 09:18 PM #9Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
Variable names in PHP must start with a $ character. There's no such restriction on field names in MySQL - they can contain special characters but it's probably a bad idea to use any. Why don't you run that command in phpMyAdmin and post the result so we can see what you actually have in your database?
Chris
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
-
07-16-2009, 11:13 PM #10New Member
- Join Date
- Jul 2009
- Posts
- 4
Er... what about your form?
<input name="phone" size="20" maxlength="20" value="<? echo $BNAME; ?>">
I'd recommend using one single connecting file, and including it whereever a MySQL query will be performed.
Eg/
con.php
PHP Code:<?php
$host = 'localhost';
$u = '#'; // Your username
$p = '#'; // Your password
$dbn = '#'; // The databases name
$con = mysql_connect($host,$u,$p);
if (!$con)
{ die(mysql_error());
}
else
{ $seldb = mysql_select_db($dnb);
if (!$seldb)
{ die(mysql_error());
}
}
?>
PHP Code:<?php
include('con.php');
?>
Then, you would have...
(Make sure to change "condition" to the conditions you want met, and "table" to the table this information is stored in. Eg/ SELECT * FROM appointments WHERE bname = mooseweb
LIMIT 1 may not be required if bname is unique. You could also add a primary key and look information up with that, instead of the name. LIMIT 1 will just make sure this only happens once.
PHP Code:$sql = mysql_query("SELECT * FROM table WHERE condition LIMIT 1");
while ($row = mysql_fetch_array($sql))
{ echo "<input name='phone' size='20' maxlength='20' value='".$BNAME."'>";
}
As for your error, I get this all the time and it's just a tiny error.
$query = "SELECT * FROM INFORMATION where name='".$BNAME."'";
Is the error, does the column "name" even exist?
If plausible, post a screenshot of your table from phpMyAdmin.
-
07-17-2009, 12:08 PM #11Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
That helps a lot, here is the screenshot.
http://i612.photobucket.com/albums/t...screenshot.jpgNot sure what to put here :-P
-
07-18-2009, 03:44 AM #12Junior Guru Wannabe
- Join Date
- Jun 2009
- Posts
- 35
As the table field has the name 'BNAME' your query should be
$query = "SELECT * FROM INFORMATION where BNAME='".$BNAME."'";
And the code should be like this:
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$BNAME=$row["BNAME"];
$FAPPOINTMENT=$row["FAPPOINTMENT"];
$SAPPOINTMENT=$row["SAPPOINTMENT"];
$NOMINATION=$row["NOMINATION"];
$NOMINATIONC=$row["NOMINATIONC"];
$FINALIST=$row["FINALIST"];
$FINALISTV=$row["FINALISTV"];
$NOTESPS=$row["NOTESPS"];
$NOTESND=$row["NOTESND"];
$DATE=$row["DATE"];
}
-
07-18-2009, 01:04 PM #13Web Hosting Master
- Join Date
- Mar 2008
- Posts
- 1,717
You still want to sanitize that data, don't put it past any of your "members" to accidentally drop a table or something silly (I don't think php's mysql_query will let you ;drop table, but that doesn't mean you shouldn't sanitize the data still). Let's put it this way, unsanitized variables going to MySQL at the very least gives the user the opportunity to completely disregard everything after the WHERE clause, so think about how that will mess with the business logic of your application.
There's two ways to sanitize the data, the first is to make sure everything that lives in a PHP variable that goes through mysql_query() goes through mysql_real_escape_string() first. You want to keep track of this, and ensure that it only goes through it once or you'll end up with ugly backslashes and whatnot in the database - to ensure that they all get done once and don't get done twice I recommend doing it right before the query is sent, so you keep it all together. In fact, I'd personally do it like this:
Code:$BNAME = mysql_real_escape_string($_POST['BNAME']); $result = mysql_query("....'" . $BNAME . "'");
(If you're feeling like this is too much information, stop reading here. The part below probably holds no bearing on your programming because you're learning PHP and it doesn't work in PHP.)
The other way, which is superior in my opinion, is to use query binding. Unfortunately, I don't think PHP's MySQL module supports it, which is stupid IMHO (btw Python, Java, and many other languages all support this method just fine), but basically you'd use place holders in the query (this is pseudo-code, won't work):
$query = mysql_query('SELECT id,data FROM table WHERE id = ?');
$result = mysql_execute($query, array($id));
By the time the data from the user ends up anywhere near the database, the query's already parsed by the server - you could put big chunks of binary in there with all kinds of symbols, none of it escaped and it'll handle it just fine. It effectively eliminates the possibility of screwing up and forgetting to escape something, which is why I like that method more - and I can't fathom why PHP still doesn't support it, particularly when the underlying C API (which PHP is at it's base level just really ugly glue to) supports it just fine, and after all these years no one's bothered to write two or three extra functions to make it work.I used to run the oldest commercial Mumble host.
-
07-18-2009, 01:39 PM #14Junior Guru
- Join Date
- Apr 2007
- Location
- Calgary, Canada
- Posts
- 201
You can always make your own method/functions to do that. It's even easier if you're passing in an array like the example you gave.
PHP Code:function queryf($query, $vars) {
foreach ($vars as $var)
$queryVars[] = mysql_real_escape_string($var)
$newQuery = vsprintf($query, $queryVars);
return mysql_query($newQuery);
}
$result = queryf("SELECT * FROM table WHERE name = '%s' AND userID = %d", array('bob', 12));
-
07-18-2009, 01:54 PM #15Web Hosting Master
- Join Date
- Mar 2008
- Posts
- 1,717
I used to run the oldest commercial Mumble host.
-
07-21-2009, 12:12 PM #16Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
I keep getting an error on update.php line 108, specifically this line:
Code:mysql_free_result($result); #Close database connection. mysql_close($link); } ?>
Not sure what to put here :-P
-
07-21-2009, 12:56 PM #17Junior Guru
- Join Date
- Apr 2007
- Location
- Calgary, Canada
- Posts
- 201
-
07-21-2009, 01:57 PM #18Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
Not sure what to put here :-P
-
07-21-2009, 02:33 PM #19Junior Guru
- Join Date
- Apr 2007
- Location
- Calgary, Canada
- Posts
- 201
-
07-22-2009, 07:36 PM #20New Member
- Join Date
- Jul 2009
- Posts
- 4
I'm sorry, that would be my fault.
The keyboard I was using had an extremely bad response time, and often I'd type a full sentence and it would get button presses confused, resulting in a lot of errors such as mixing up letters, repeating letters more than 3 times, using shift when I didnt put it down and repeating various words twice.
The code I posted was
PHP Code:<?php
$host = 'localhost';
$u = '#'; // Your username
$p = '#'; // Your password
$dbn = '#'; // The databases name
$con = mysql_connect($host,$u,$p);
if (!$con)
{ die(mysql_error());
}
else
{ $seldb = mysql_select_db($dnb);
if (!$seldb)
{ die(mysql_error());
}
}
?>
Please update your con.php code to the following (remembering to edit your variables)
PHP Code:<?php
$host = 'localhost';
$u = '#'; // Your username
$p = '#'; // Your password
$dbn = '#'; // The databases name
$con = mysql_connect($host,$u,$p);
if (!$con)
{ die(mysql_error());
}
else
{ $seldb = mysql_select_db($dbn);
if (!$seldb)
{ die(mysql_error());
}
}
?>
-
07-27-2009, 03:17 PM #21Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
I fixed that, although it still does not work, no clue why either =/
Not sure what to put here :-P
-
07-27-2009, 03:18 PM #22Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
Here are the latest code samples:
Data.php
Code:<?php $host = 'localhost'; $u = 'mooseweb_db2user'; // Your username $p = '3#?Ci~7|'; // Your password $dbn = 'mooseweb_db2'; // The databases name $con = mysql_connect($host,$u,$p); if (!$con) { die(mysql_error()); } else { $seldb = mysql_select_db($dbn); if (!$seldb) { die(mysql_error()); } } ?>
Code:<?php include('data.php'); ?> <html> <body> <form action="update.php" method="post"> <table style="margin-bottom: 1px; padding-left:10px;" border="0" cellpadding="0" cellspacing="1" width="75%"> <tbody> <tr> <td align="right" bgcolor="#e9ece9" >Enter Doctor ID to edit: </td> <td bgcolor="#e9ece9" style="padding-left:4px;" > <input name='phone' size='20' maxlength='20' value='".$BNAME."'> </td> </tr> </tbody> </table> <table style="margin-bottom: 1px; padding-left:455px;" border="0" cellpadding="0" cellspacing="1" width="50%"> <tbody> <tr> <td colspan="2" align="right" bgcolor="#dadce1" height="4"> <input name="submit" value="submit" type="submit"> </td> </tr> </tbody> </table> </body> </html>
Code:<?php #Form Variables. $BNAME=''; #Database connection strings. $usr = "mooseweb_db2user"; $pwd = "3#?Ci~7|"; $db = "mooseweb_db2"; $host = "localhost"; # connect to database $cid = mysql_connect($host,$usr,$pwd); mysql_select_db($db); if (mysql_error()) { print "Database ERROR: " . mysql_error(); } if(isset($_POST['submit'])){ extract($_POST); #A query is written which will extract all information #from basic_info table based on phone number entered. $query = "SELECT * FROM INFORMATION where BNAME='".$BNAME."'"; #Execute query and store result into variable $result. #echo $query; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { $BNAME=$row["BNAME"]; $FAPPOINTMENT=$row["FAPPOINTMENT"]; $SAPPOINTMENT=$row["SAPPOINTMENT"]; $NOMINATION=$row["NOMINATION"]; $NOMINATIONC=$row["NOMINATIONC"]; $FINALIST=$row["FINALIST"]; $FINALISTV=$row["FINALISTV"]; $NOTESPS=$row["NOTESPS"]; $NOTESND=$row["NOTESND"]; $DATE=$row["DATE"]; } echo "<form method=\"post\">"; echo "<table style=\"margin-bottom: 1px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"60%\">\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\" colspan=\"2\">Business Name:\t $BNAME</td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"hidden\" value='$BNAME' name=\"BNAME\" size=\"50\" ></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">First Appointment: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"text\" value='$FAPPOINTMENT' name=\"FAPPOINTMENT\" size=\"50\" ></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Second Appointment: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"text\" value='$SAPPOINTMENT' name=\"SAPPOINTMENT\" size=\"50\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Nomination Received: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$NOMINATION' name=\"NOMINATION\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Nomination Congratulations (Letter/Visit): </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$NOMINATIONC' name=\"NOMINATIONC\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Finalist: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$FINALIST' name=\"FINALIST\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Finalist Congratulations Visit: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$FINALISTV' name=\"FINALISTV\"></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Products Sold: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <textarea value='$NOTESPS' name=\"NOTESPS\" rows=4 cols=30></textarea></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">New Dollars: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <textarea value='$NOTESND' name=\"NOTESND\" rows=4 cols=30></textarea></td>"; echo "\t</tr>\n"; echo "\t<tr>\n"; echo "\t\t<td bgcolor=\"#dadce1\">Date of Last Contact: </td>"; echo "\t\t<td bgcolor=\"#dadce1\"> <input type=\"checkbox\" value='$DATE' name=\"DATE\"></td>"; echo "\t</tr>\n"; echo "</table>\n"; echo "<table style=\"margin-bottom: 1px;\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"40%\">"; echo "<tr>"; echo "<td colspan=\"2\" align=\"right\" bgcolor=\"#dadce1\" height=\"4\">"; echo "<input name=\"submit02\" value=\"submit\" type=\"submit\">"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; #Free up Memory for $result. mysql_free_result($result); #Close database connection. mysql_close($cid); } ?>
Not sure what to put here :-P
-
07-29-2009, 02:15 AM #23Junior Guru Wannabe
- Join Date
- Jun 2009
- Posts
- 35
<td bgcolor="#e9ece9" style="padding-left:4px;" >
<input name='phone' size='20' maxlength='20' value='".$BNAME."'>
</td>
Try by changing the query.
if(isset($_POST['submit'])){
extract($_POST);
#A query is written which will extract all information
#from basic_info table based on phone number entered.
$query = "SELECT * FROM INFORMATION where BNAME='".$phone."'";
-
08-04-2009, 01:17 AM #24Danananana Danananana Batman!
- Join Date
- Dec 2008
- Location
- Florida
- Posts
- 1,052
-
08-04-2009, 01:51 AM #25Junior Guru Wannabe
- Join Date
- Jun 2009
- Posts
- 35