The following has been providing a bit of a problem for me over the past few days. I have an initial display page with the HTML form and text fields, however the number of text fields can be controlled by the user. As such they are all placed into an array within the $_POST array, to be retrieved later. I've tried doing this, and this alone works fine. The problem is when I try to loop through them to insert them into the database, for some reason while they will display through echo fine, only the first one will insert into the database, then throw an error. Below is a loose sample of the code.
The text fields in the HTML file are named as follows : $name[]
The code in the PHP file is as follows, excluding anything not necessary for the example :
$conn = db_connect(); // establishes a database connection if (!conn) { echo "database error"; exit; }
if anyone can spot something I'm overlooking please let me know, I'm still at a loss for why it will only insert into the query on the first pass through the loop, however if I'm just echoing the values it will work fine.
Hello, My favorite PHPers! I come to you once again with one of the easiest things I could ever imagine you've been asked, but it just...doesn't...like...me.
And really, I should have figured this out ages ago.
All I need to do is verify whether a checkbox has been checked.
I've googled it, but unfortunately everything that's popped up has been for JavaScript. Which isn't used in this project.
The status of the checkbox (either checked or unchecked) is going into a database (They're boolean fields that just get set to 0 or 1 it looks like) for use in another part of this app that I, hopefully, won't have to write (like that'll happen).
So here's what my conditional statement looks like:
Unfortunately, where it says 'checked', I don't know what is supposed to go there. I've tried many things, like "true", "on", "checked", "1", etc etc etc. But nothing gets updated in the database. So, I come to you, humbled by the simple stuff.
Please be kind.
p.s. The checkbox names (docAction1) will be changed at a later date to better reflect the text that will be associated with the checkbox. Right now they're just labeled as "checkbox 1, 2, 3" etc. So hush you variable-name hounds!
There are 140 lines in stats.txt, fields are terminated by a tab, lines are terminated by a new line. I get 140 new entries, but "id" column (auto_increment) is "0":
I need to find someone who can re-code the signup page to a WordPress site to include the collection of additional data and then insert it into the database. I have installed the two plug-ins that extend the metadata and create new user fields. So it's just a case of re-coding the registration page with new fields and doing the inserts after the account is created. The goal is to have individuals who wish to enter a contest do it by signing up for a wordpress blog - the extra fields will be for the contest, and then they'll be both in the database as well as signed up for blog updates (as part of the contest).
Anyone have the skills? If so, how long do you expect it would take, and what can I bribe you with?
The knock on open source databases has always been that it doesn't scale. With this new offering, users can scale from a few megabytes to multiple terabytes, without changing the underlying database structure.
Say I have an object called ListStudents which queries a database for all known students. My first (procedural) impulse is to loop through the dataset and store each row in pre-formatted html rows. But something tells me there is a better way of handling it with OOP. Can someone help me?
Sooo, I am 98% sure I'm taking on a client where I need to implement a CMS for him to make changes to the site if necessary. When I first wrote the quote a few months ago, I suggested Drupal as the CMS because it was free, looked rather customizable and somewhat easy to use. I have limited experience writing PHP and dealing with MySQL databases but understand the mechanics of it.
This particular client is offering subscriptions to a database of business industry contacts. There will be about 500 contacts on the pay list (including name, office, affiliation, etc) and he will add to the list about every three months or so. What he will change on a regular monthly basis will be the articles he writes. The subscription concept then requires a shopping cart/check out system as well as a password/username management system for each user.
Would Drupal be a good way to go for both my client and for me? Also, I'm switching web hosts and am considering becoming a reseller. Is there a web host that has it installed already? Door Host ( http://www.doorhost.net/ ) used to have it, but I don't think they do anymore. I'm considering going with Total Choice Hosting buying either their basic reseller plan or the regular Deluxe Plan.
Nonetheless, who has used this or other comparable CMSs and which do you prefer and why?
Oh, I just found this Drupal web hosting company called Site Ground that has all of the major CMSs installed already and gives you 24,000 MB of space. Anyone heard of them? I also found these guys: Canaca.com.
I'm developing a database of organisations with all the familiar field names that you would expect e.g., name of organisation, various address fields, office bearer fields etc.
However I also want to have a "Year" field, so I can lookup information about the organisation in 2002, 2003, 2004, 2005 etc as the organisations I'm keeping track of have a high turnover of office bearers and, of course, occassionally address (and a couple have even changed their name).
One method would be have a table for each year for each organisation, but that offends my sense of optimisation and normalisation.
Reuters withdrew all 920 photographs by a freelance Lebanese photographer from its database on Monday after an urgent review of his work showed he had altered two images from the conflict between Israel and the armed group Hizbollah.
Global Picture Editor Tom Szlukovenyi called the measure precautionary but said the fact that two of the images [...]
So I've been relying primarily on PHP's preg_match for 100% of my form validation. Now I'm beginning to suspect it would be much cleaner to have JavaScript handle most of that (check for blank/empty inputs, or reject inappropriate characters/patterns) and simply leave the database checking for PHP (right or wrong login info, etc). Then I can have PHP handle all that stuff with AJAX-stuff, but not let bad input data even get out to the server in the first place. Of course, there's the local overhead a user will have to deal with, and slightly larger JavaScript file to load, but I could probably finagle it so it had all the regex script in a seperate file that it looks at when it needs it.
Sorry to be posting again with nothing to actually contribute, but I'm having a hacker issue with one of my websites. I'm not one to jump on sudden suspicions of hackers, and I don't victimize myself, but this is the second time someone's hacked my site.
After the first time, I was extremely cautious. I uploaded my site to a new server and made sure not to install any interactive PHP scripts. I did, however, continue to code my website in basic PHP, but nothing that required a connection with an SQL database or any sort of log in - just simple PHP pages with dynamic inclusion and switch functions.
[/END SOB STORY]
My friend's webhost (my friend was hosting me at the time) sent this as a response to my e-mail:
"Do NOT put any php pages back up on this site if you wish to host it with us and certainly not any phpbb boards which were most likely used in the attempt to hack our server."
Considering I did not have a phpBB script uploaded, the only alternative is that he hacked my site through my actual php pages (at least according to her webhost).
So my question is this: What are the security risks/vulnerabilities of just normal, non-interactive php pages?
And if anyone can provide any security tips, that would be greatly appreciated!
The good news is, I'm working on a simple gallery script that does not require an SQL connection or anything, so hopefully I'll be able to post that soon! :)
EDIT Here's the code I've been using for the main page/subpages. include("language.php");
When I was working with PHP, My log on script pretty much just queried the database with a SELECT and matched user id and password with what was submitted by the user.
How does this work in asp.net? Is there a better way?
I've got a bit of a problem that I'm not quite understanding.
I'm working in PHP with an Oracle database. I need to have 12 queries in my program because I have 12 drop down menus representing each field in my Oracle table. For some reason, I cannot have more than 5 queries. Anymore than 5 and my drop down menus remain completely blank. I can't find any information about this...I can't even imagine why I can't have my 6th, 7th, etc. number of queries.
ok i've picked a new web host. i googled this but couldn't make it give me an answer. i would like to transfer emails that are stored on my current host's server to the new host and make them viewable thru the new host's webmail. is this kind of thing possible? would it depend on the web host and the email program they use?
also i would like to transfer my message board as well. would it be as simple as downloading the mysql database and uploading it to the new server?
I currently have a VBScript that connects to a database, pulls out some information, does a compairson and then sends an email if conditions are met. It works online but I need to find a way to make this run on a schedule and I think the best way is probably to write it as a Visual Basic exe and set it up on the web server using the Windows scheduler.
It's been about 5 years since I wrote a VB program so I was wondering if anyone out there could help me sort how to go about doing the same thing in VB as I did in VBScript? Or point me towards a tutorial that will let me connect to a database, run a query and send an email.
I need to create a simple database for a client's site where they can login and upload documents that will then be viewed online by their clients. The documents they'll be uploading are just simple excel spreadsheets and word docs.
Is there an easy way I can create a simple database for them to do this, as I have no knowledge of database construction at all.
I am currently trying to switch servers from an atrocious one to dreamhost, which I have heard good things about. I have my account set up and am in the process of moving files. Simple, right?
Well, I am also moving an OScommerce store and a wordpress blog. I've managed to export my databases but that's where I'm stuck. Despite multiple wikis and support pages I just can't do this. I have run into brick wall after brick wall after brick wall, and I think it is just over my head. It is also somewhat of a time sensitive issue, as we run a few sites and a business off our web space and we've already been down/not updating for a week now. Even if i could figure out how to import these (I did manage to export them... I think...) I certainly wouldn't know how to test them to make sure they're working correctly before setting up the new DNSes and going live. Since I will hopefully never have to do this again, I'd like to just find someone to help me out with this and get it over with.
Remember that business I was talking about? We run a comic book publishing company, and for your trouble of moving two databases for me, I will send you a big box of really awesome comics and graphic novels by some of the coolest artists and writers you've (n)ever heard of. You will also receive my ETERNAL GRATITUDE.
Sound like a good deal?
Drop me a line at coreymarie@gmail.com or AIM me at: well read robot
I will relinquish passwords and you will help me and I will be happy and send you comics and the world will be a better place. Ideally I'd like to take care of this tonight or tomorrow.