ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
This forum runs PHP/MySQL.
-
No you haven't, there's no $this in that code snippet. The error you're getting is related to you not having the proper callback format as the first argument to call_user_func. That being said...what's with the variable variables? Why are you doing it like this? It's confusing and sloppy and will make maintaining this code hell. -Dan
-
That's because that line is a syntax error. You can't return an echo. Just return the variable. -Dan
-
Having a brain block - adding numbers from database
ManiacDan replied to herghost's topic in PHP Coding Help
First of all, you're not writing a query in PHP, you're writing it in SQL. New programmers don't usually understand that they're using up to 5 languages at once. PHP, SQL, JavaScript, HTML, and Regular Expressions are all stand-alone languages. Secondly, bah, pikachu beat me. -Dan -
This sentence is invalid. You can either DROP a table, or DELETE everything from the table. You cannot "drop" data, only tables. What query did you run? What button did you push? If you're saying you deleted the table "users' under the database "mysql," then you've deleted your own accounts. You cannot log in without a user table. -Dan
-
When you say "the table," what do you mean? The whole database? One table? All tables? Some tables?
-
"can't connect hostname.domain.com" isn't a standard error, you should echo the real error. Your password isn't necessarily correct. Why do you believe this host (or your local machine) have MySQL installed and running? -Dan
-
Pikachu, this is the second zip file posted in the last 5 hours. PM me if you'd like me to open them in a VM and see if they're malicious or identical. -Dan
-
Back to the basic debugging steps I gave you before. use echo and print_r to examine what you believe to be in the $_POST array. -Dan
-
Not really closed, either. You have an array. The array is $series_description[0] (and then, for some reason, $d). USE THAT ARRAY. Read the PHP manual on arrays. Arrays are lists of data. They are designed specifically for what you're asking to do. We're not being mean by pointing out their existence. -Dan
-
if (move_uploaded_file ($_FILES[0]['tmp_name'], $uploadFile)) { mysql_query("insert into filenames (filename) values ('{$uploadFile}')"); Just like I said earlier, you're using move_uploaded_file, which accepts the new filename. Insert that filename into the DB. -Dan
-
Note that your original post proved why your example is NOT a perfect world. You typed 3 variable names, and managed to spell one of them wrong. If you used a loop and an array, the risk of you misspelling the variable name is greatly reduced. If you are writing scripts with variable names that are all the same except for the number at the end, you're doing it wrong. Arrays are the most powerful feature of PHP, use them. -Dan
-
No, it expects the directory to already be there. Make it, and this script should start working. Also, the move_uploaded_file function should be throwing errors, you probably have error-reporting turned off. -Dan
-
Basic control structures: IF statements require parens: if ( $something == $somethingElse ) { //behavior if true } else { //behavior if false } Also, you should be using the isset() function to check to see of offsets are set. And the split() function is deprecated and should not be used. You want explode() for this. -Dan
-
I'm sure MySQL told you what the error was. That generally helps. -Dan
-
You get absolutely no output from the PHP script? Do you have error_reporting turned all the way up? You're making the call from ajax, are you viewing the raw response directly? Are you echoing the critical PHP variables to see if they're correct? Are you echoing the SQL query to see if it's malformed? Are you trying to SQL query in a real SQL browser to see if it's returning the right data? Basic debugging will help you faster than any of us can. -Dan
-
How can it be one way in the table, and another way in your example, if your example code doesn't reformat the date? Alter your table so that it uses the MySQL DATETIME format for a single column (for the date and time) then you can just use the BETWEEN operator to do your filter. -Dan
-
You don't join the two tables. -Dan
-
The curly brackets are only necessary inside double-quoted strings where you're using PHP variables. $1 and $2 are technically not PHP variables, and they're inside single quotes anyway, so you don't need them. Did you get it working? -Dan
-
Parse XML Directly to page vs. Into an Array
ManiacDan replied to denoteone's topic in PHP Coding Help
An XML document with an XSLT style sheet will be formatted into an HTML document automatically without you using a programming language at all. -
Data protection for children - UK law question
ManiacDan replied to richrock's topic in Miscellaneous
tibberous is lucky he's not in the UK, they don't take jokes very well over there. -
This kind of quote makes my head hurt. You ARE doing it automatically: you're telling a computer how to do the work for you. Write this program once, and it will execute 100,000,000 times without you having to do anything. That being said, at some point in your script you have the filename of the image in a string (since you have to call move_uploaded_file on it). Store that filename in the database. -Dan
-
Never include files inside of a class declaration. You only need to include utt.php once, outside this function. -Dan
-
"Bang" like "that is an unbelievably massive security hole and cannot ever, EVER be possible"? The only thing you can do is set an iframe's location to "C:\Documents and Settings\My Documents", which may (depending on the OS, browser, and file setup) open a file explorer window inside an internet explorer window and show those documents. Maybe. Still though, the server can never see files on the user's machine. -Dan
-
keep getting error when UPDATE mysql statement plz help.
ManiacDan replied to loshyt's topic in PHP Coding Help
I simply quoted everything, where Pikachu guessed. Quoting numbers is technically wrong, but it won't hurt. Do it properly though.