2e73
| |||||||||||
| |||||||||||
|
write to db Posted by bschultz (bschultz), 24 June 2003 Is it possible to have a write to db script that has a variable in it for the db name?Here's what I'm using: Code:
It says there's an error on line one...which confuses my little brain. Line 1 is the <?php... ![]() Brian Posted by admin (Graham Ellis), 24 June 2003 Firstly, nothing to stop you using a variable name to select your database.Now - the code error. I suspect that you might have some control character(s) in your file. This sometimes happens when files are transferred in ASCII when they should be transferred in binary (or vice versa), and on certain editiors to can mis-key and insert control codes in your source. Solution ... call up the file in an editor that will display control codes and fix any problems revealed OR delete and retype the offending line. Posted by bschultz (bschultz), 24 June 2003 this file is a local file...it's never been ftp'ed. I use a program called phpcoder to code php, and it shows variables in red...the variable for the table name is still showing up in green (regular text). I can't find any way to display control codes...can you suggest an editor that does?Brian Posted by John_Moylan (jfp), 24 June 2003 I can't really speak on the topic of a dedicated php editor. (I use emacs, which does me fine)But this will help: http://www.php-editors.com/search.php Select your platform & licence type, I suspect you'll want freeware and browse the varients.Cheers jfp Posted by admin (Graham Ellis), 24 June 2003 Personally, I use vi with ":set list" to display control codes in files, and there is a PC version available even though this is very much a Linux and Unix editor. I'm also used to notepad putting up "blotches" where there are certain control codes ....If using these editors doesn't help / they're not available, can I suggest you start a new PHP file with just the <?php and ?> in it, and cut and paste in sections of the code to narrow down the failure a bit. By the way - I cut and pasted your code from the forum and ran it through PHP at the command line. Did exactly what I expected - no MySQL server on the test machine, so it compiled and blew at the connection: Code:
I conclude that either it's something to do with the PHP version, or something that's in your file but not in your post (e.g. special characters!) [Hey, jfp ... didn't mean to "overpost" you ... I think you and I were coming up with ideas at the same time!] Posted by waygood (waygood), 1 July 2003 This may help you as it simplifies executing a query a little bit.Code:
$sql="SELECT * FROM users"; $result=doQuery($sql); $password=mysql_result($result,0,"password"); ALSO $submit=="click" ---- You should be using $_POST['submit']=="click" This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||