ManiacDan
Staff Alumni-
Posts
2,604 -
Joined
-
Last visited
-
Days Won
10
Everything posted by ManiacDan
-
Disabling Php Input Without Disabling Html
ManiacDan replied to deathadder559's topic in PHP Coding Help
That's wrong and stupid though. -
Include Keywods Description And Title For Each Page Differently
ManiacDan replied to slayboy's topic in PHP Coding Help
My code uses 'title' and 'description', since you told me those were the variable names. Your actual variables are 'title' and 'meta_description'. Change the one, and it should work. If not, there isn't much we can do for you. You need to start debugging this yourself. Echo the query. Is it right? -
Include Keywods Description And Title For Each Page Differently
ManiacDan replied to slayboy's topic in PHP Coding Help
no because I don't have access to your database the code I provided was easy to understand since it matches your code nearly line for line it included two variables which should match your database columns which you previously said existed if they don't match what you said figure out what the real column names are and replace them that's all we can tell you with the small amount on information you have given us if you keep doing nothing but pasting your code over and over we can't help you if there's something else you can tell us then tell us (capitalization and punctuation removed to match OP's style) -
I'm assuming, of course, that you've checked the database and there aren't just 20 duplicate rows in there.
-
PHP does not execute javascript. If it did, we would call javascript PHP. You'll have to figure out another way to take content from another site and pretend like it's your own.
-
Why are you selecting rows from a table, then selecting more rows from the same table with similar criteria? Why not just ORDER the first select by AGENCY? That will solve your problems.
-
Include Keywods Description And Title For Each Page Differently
ManiacDan replied to slayboy's topic in PHP Coding Help
<head> <title>help</title> <meta name="description" content="." /> <meta name="keywords" content=" " /> </head> Take that, and make it: <?php $q="SELECT * FROM pages WHERE name='$pg'"; $r=mysqli_query($dbc,$q); $page= mysqli_fetch_assoc($r); echo '<div class="content_body">'.$page['body'].'</div>'; ?> <head> <title><?php echo $page['title']; ?></title> <meta name="description" content="<?php echo $page['description']; ?>" /> <meta name="keywords" content=" " /> </head> Assuming of course that your column names are "title" and "description." You said they existed but nor what they are. -
Ok I'm done with you, I asked way too many times for the value of $cid and you just can't figure out how to answer me. Perhaps PHP is not for you. You don't have a variable called $cid. That's pretty obvious. You have $cid01. Why not just use $cid01? You have code that works. How is "ok it works" not the end of the conversation?
-
ANSWER THE QUESTION I gave you very specific instructions. Inside a box. NOT IN A PARAGRAPH. NOT IN A LINE OF CODE We're not magic. That crystal ball jess printed earlier isn't real, it's an emoticon.
-
You're doing it wrong. SOmewhere, some how, you're doing it wrong, but we honestly can't figure out what because none of this makes any sense. What do you HAVE: Show us the current value of $_SESSION['cid']. By itself. Not in a paragraph, not in a line of code, inside a [ code ] box by itself. What do you NEED: Show us the line of code without a variable in it that works. If you want $to_company = 'abc123' but $cid = 'abc', show us that.
-
If they're the same, you can JOIN the tables: SELECT * FROM expense_fuel JOIN expense_categories ON expense_fuel.fuel_code = expense_categories.id WHERE fuel_code = '{$type}' You're still vulnerable to SQL Injection
-
There doesn't appear to be a relationship between these tables. Is fuel_code the same as expense_categories.id?
-
Well if you'd answer the questions I've asked, we could help you more. Show the table structure, show the data, show what you want it to look like. Barand and I can continue guessing randomly all day, or you can actually show us the problem you're asking us to solve.
-
If we're just critiquing the code in general, you're also very vulnerable to SQL injection.
-
You're not making any sense to me. Sow a few rows of data from the tables, and what you want the results to look like, assuming you already have a fuel code
-
It seems to be on a 2-3 minute delay. I've been inadvertently stalking Jess all morning.
-
So "type" is in both tables?
-
How are they related? Can you JOIN these two tables? Your syntax is wrong in the second query, you can't just dump a raw PHP variable into a mysql query
-
So when you go to the site without cid in the URL, cid isn't in the URL and then you overwrite the session. That's the actual problem: You're visiting the page AGAIN without cid and your code doesn't say "don't do this if cid doesn't exist." You're developing without error_reporting turned on. If you had your errors turned on, you would have gotten a warning hours ago that would have prevented this whole conversation. if ( isset($_GET['cid']) ) { $_SESSION['cid'] = $_GET['cid']l } There, done.
-
So the URL bar in the browser says: http://www.mysite.com/form.php?cid=prg1234 And inside form.php you have the print_r code you got earlier? And 'cid' is not in $_REQUEST? Is all of that true?
-
You do other amazing things, like steal my posts before I'm done writing them.
-
No kidding. But it keeps fatal errors out of their logs, presumably they log fatal errors only. Aliasing all the missing functions (missing functions are a fatal error) to similar-but-not-working functions stops them from filling their logs with "FATAL ERROR: Customer has not updated their script in 6 years" over and over until the server goes down.
-
Disabling Php Input Without Disabling Html
ManiacDan replied to deathadder559's topic in PHP Coding Help
There is no "obvious reason" to disallow PHP tags. If you're using eval() or any other method of dynamically evaluating user-input as though it were PHP code, stop what you're doing now and change it. Allowing PHP in your inputs should not be a security concern at all, since there should be no way for user input to ever be executed by the PHP interpreter. -
Is it in the URL? Are you positive? PHP says it's not in the URL. Jess, get some work done! Stop posting what I'm posting 10 seconds before me
-
You haven't explained the problem, you've just said you want to do something. There's no WHY. I could ask you how to fill my shower stall with licorice, that doesn't answer "why are you trying to do that?" There is no reason to do what you're trying to do, that's what we're saying. Whether or not it's possible is irrelevant, because all the ways to do it slow down the normal use for arrays. If you'd really like to do it and can't say why, here: $yearArr = array( 1 => '19', 2 => '19', 3 => '18', 4 => '18', 5 => '20', 6 => '20' ); $temp = array(); foreach ( $yearArr AS $k => $v ) { if (($a = array_search($v, $temp)) !== false) { $temp[$a.'/'.$k] = $v; unset($temp[$a]); } else { $temp[$k] = $v; } } $yearArr = $temp; print_r($yearArr);