ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
while loop with alternative styles?
ManiacDan replied to son.of.the.morning's topic in PHP Coding Help
$rowNum = 0; while ( $row = fetch() ) { if ( ++$rowNum % 2 == 1 ) { //style = white } else { //style = grey } } -
You're confusing a file's header() (present on all files and not part of the content of the file) with the HTML <head> element (nothing to do with file headers, just some random part of the document).
-
You're saying that this produces two columns that are the same width? <table> <tr> <td>safnwieuncv78923n7p48837oqnv8o3nijenvioulnvruionvoiuawneviuanewviouanweviouanweviouawenviouweavnuiwean</td> <td>abcd</td> </tr> </table>
-
are you viewing it in a browser?
-
Displaying Nested data contained within one Table
ManiacDan replied to adricist's topic in MySQL Help
Missed your reply: SELECT jos_cp_fb_moderation.userid AS userId, child.id AS categoryId, child.name AS categoryName, parent.id AS parentCategoryId, parent.name AS parentCategoryName FROM jos_cp_fb_moderation JOIN jos_cp_fb_categories AS child ON jos_cp_db_moderation.catid = child.id LEFT JOIN jos_cp_fb_categories AS parent ON child.parent = parent.id WHERE jos_cp_fb_moderation.userid = 617 -Dan -
data/language.txt should be a plain text file with one sentence per line.
-
Just re-visited this thread to realize: You need to quote your format string, NOT your column name. Three basic syntax errors.
-
I keep looking for the "agree" button since I've been on devshed for so long. This guy is great though.
-
To just get right to the point, you need to quote your strings. Both of these errors have been basic mysql syntax problems.
-
In general, if you're storing specific variables in an array, name the indexes so you know which is which. If you're storing a bunch of variables that are all the same kind, you don't need to name them.
-
You said nearly 2 months ago that you have code that will pull the data. Run the code. Does it pull the data?
-
You're exactly right about the first part, then you get wrong. When you create the array, you do an isset call and only add to the array when the item is set. Yes, exactly right. Then you attempt to use the fourth element in the array. What happens if that's not set? You get the error. Also note that this code has no way of telling which variable is which in this array. You assume that $array[2] is con_id. What if $dislikes isn't set? Then con_id will be in $array[1] You need to rethink this whole thing and look into naming your array keys, so you have $array['con_id'] instead of $array[2]
-
That too.
-
So at least two of those are unset. See how that works? Your array is randomly one or more of those 4 items, yet your function assumes all 4 will be there.
-
if ((isset($array[0]) || isset($array[1])) && isset($_SESSION['user_id'])) { // check to see if user has already voted on given contribution $query = "SELECT * FROM votes WHERE con_id = '$array[2]' AND user_id = '$array[3]'"; That section checks for array elements zero and one, and then uses array elements two and three. If we had the actual error message, we might be able to tell if that's the problem.
-
You could enable it in the server configuration file, or use curl.
-
The @ before your function call suppresses errors. Never ever turn off errors, especially when you're trying to debug. Remove the @ and you should be able to see what's wrong.
-
How to tell: is the request for HTTP or HTTPS?
ManiacDan replied to jhsachs's topic in PHP Coding Help
Per the manual, if $_SERVER['HTTPS'] is set, the script was accessed through https. -
The coordinates are the two points of opposite corners of the rectangle that defines the clickable area: coords="0,0,82,126" That defines a rectangle starting from 0,0 (the top left corner) and goes to 82,126 (in this image, roughly halfway across the bottom).
-
How do you suggest to improve this coupon site
ManiacDan replied to aditd's topic in Website Critique
That box on the right isn't working for me in chrome. Clicking the arrows produces garbled output, mousing over it only makes it worse. None of the "copy and visit site" links work. Your error handler is still hard-coded to "localhost," unless you happen to have my exact error handler from my payment processing company's development environment on your server. Your hover-menus fade in after nearly a quarter second. Far too long. The "popular stores" box isn't tall enough, the links are cut off There is a large white space below that box. Your "we are social" box takes a while to load, but I imagine it's loaded asynch with JS. -
aditd, welcome to the forums. Please check to see what the date on a thread is before you post, you've revived a thread from nearly 2 years ago.
-
One very simple question about php and decimals
ManiacDan replied to eleos's topic in PHP Coding Help
The getPriceHtml() function needs to be altered, unless it's a magical function that doesn't actually exist. If it's magical, make a new function with a custom name that wraps getPriceHtml() and formats it properly, so you don't have any weird code in your display logic. -
Like Andy pointed out, both break and continue accept numerical arguments for the level of control structures you wish to break out of. -Dan
-
Keep this file OUTSIDE of the webroot, and use a PHP script to check permissions, read the file, and dump it to the user with proper headers.
-
If some behavior leads you to believe there is a specific error condition, check it. Why do I have to say "what are the contents of the session when this happens?" Check that yourself. If something is wrong, dump the relevant variables to the screen or a log file until you figure out what the problem is.