Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
[SOLVED] To $array['this'] or not to $array[this], that is the question!
Maq replied to cs.punk's topic in PHP Coding Help
Go to the manual - Type Array - and go to: Also, if you turn error_reporting on, you will notice it throws this: -
What's your question?
-
That should have no effect one what you're trying to accomplish. The style you see there is just an object oriented approach. Most 3rd party applications have their own classes and methods to handle modifications and SQL to reduce the risk of you screwing something up. What and where is "this"? I don't see any code, how are we supposed to help you?
-
I want to check if a variable equals many things...
Maq replied to chantown's topic in PHP Coding Help
You could whitelist the values, and check $action with with in_array. $action = 3; $valid = array(1,2,3,4,5,6,7); if(in_array($action, $valid)) { echo "true"; } -
You can use mysql_num_rows to check how many rows have been returned. If 0, then display a certain message, if not, then proceed with rest of code. mysql_select_db($database_maxdbconn, $maxdbconn); $query_rstassign = "SELECT ID FROM users WHERE usergroup = 'adjuster' AND username = '" . $_SESSION['MM_Username'] . "'"; $rstassign = mysql_query($query_rstassign, $maxdbconn) or die(mysql_error()); if(mysql_num_rows($tstassign) == 0) { echo "Sorry, ID not found"; // Maybe assign a default ID } else { // Proceed with rest of code $row_rstassign = mysql_fetch_assoc($rstassign); $activeADJ = $row_rstassign['ID']; }
-
Sure, we'd love to know the answer.
-
Or just change the owner with chown.
-
Try: http://127.0.0.1/helloworld.php
-
PHP is included in the XAMPP install. What exactly what the error?
-
You can use sessions to ensure they are only counted once. Not sure about the bots issue. For crawlers, which I'm not even sure if they would be counted, you would have to conditionally detect them. Try Google, something like: Detect Crawlers.
-
That's what this clause is supposed to filter out: WHERE expiry >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK) Try to echo it out and see what's actually being passed to mysql_query. $sql = "SELECT * FROM programme WHERE expiry >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK) ORDER BY expiry DESC"; echo "Query => " . $sql; $query = ($sql) or die(mysql_error()); if(empty($query)){
-
I agree. Yes I know. Not sure why I did that. Yeah, I forgot to add it back in. Thanks for the info.
-
You're already echoing out that entire table, you don't need to echo again. Try: MPG: " . getMpg($row['vin']) . "
-
Can you please CnP the hard coded path to "menu.php" and "index.php".
-
Try: $s = "Limp Bizkit - Boiler"; $pattern = '~^(.*)$~i'; preg_match_all($pattern, $s, $matches); print_r($matches); ?> - You were pretty close (not that mine's perfect) but I made some changes. - If 'id' is always going to be an integer you should use ([0-9]*). - You should use \s for whitespaces. In the $matches array you have to go through and figure out what each key goes to each match. The array dump would look like this: Array ( [0] => Array ( [0] => Limp Bizkit - Boiler ) [1] => Array ( [0] => 5352 ) [2] => Array ( [0] => Limp Bizkit - Boiler ) [3] => Array ( [0] => hot.gif ) ) Hope this helps, good luck.
-
Adding 1 is not reliable because a deleted record could cause inaccuracy. Instead you could do something like: $query = mysql_query("SHOW TABLE STATUS LIKE 'table'"); $result = mysql_fetch_object($query); echo $result->Auto_increment;
-
Most sites have that, or do what I suggested before, which is give them options to choose from so you have entire control. That would belong in the Freelance section.
-
As opposed to what? A living stuffed animal? Good point, we should test it out and see if we can keep the animal alive while stuffing it. Heeeere, puggy puggy puggy...
-
Don't let them edit it. That could pose a huge security issue. People could easily inject code. Instead you should let them choose from different options for style so you have control over sanitizing the inputs.
-
Where to start... - When you click on a profile from the pictures at the top, none of the images load and everything is all over the screen. - Do you have a testing login? - The header is OK, but what's with the sketch of the dead stuffed animal? There's really not much else to critique. Without a testing login we have no features to test and nothing else to do. It looks like an unfinished site.
-
...How will displaying a CSS file enable a user to edit their profile?
-
What development applications supports php?
Maq replied to dejesus_j's topic in Editor Help (PhpStorm, VS Code, etc)
Are you asking for a good IDE (editor)? If so, is there a reason you posted in the 'Regex Help' section? Here is a list: http://www.phpfreaks.com/forums/index.php/topic,119433.0.html (moving to Editor Help) -
[SOLVED] Vexing T_Variable is driving me nutz - help!
Maq replied to Chezshire's topic in PHP Coding Help
Yes, either of those should be fine. But you changed your code from using single quotes to double now... Do you still get errors? If no, what does $msg look like when you echo it out? -
Around these parts where i live hash is another word for a certain type of drug stash.... Some ones got some explainng to do Well how else are we supposed to pay for our bandwidth Yeah, the pr0n industry is really hurting right now, especially in the midget department.