Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
If anything support PHPFreaks by donating. I'm leaving work now, but I'll look at it when I get home.
-
Okay I found an easier solution that should work. Instead of this block of code, which you had your quotes messed up in anyway, try this: $query = 'SELECT * FROM supplements WHERE supp_id IN ('; foreach ($_SESSION['cart'] as $key => $value) { $query .= $key . ','; } $query .= substr ($query, 0, -1) . ') '; Just use this, you can give IN() an array rather than using a foreach to extract each individual $key. $query = "SELECT * FROM supplements WHERE supp_id IN({$_SESSION['cart']})";
-
I think each value needs single quotes around it. With integers maybe not, but try this: $query = "SELECT * FROM supplements WHERE supp_id IN ("; foreach ($_SESSION['cart'] as $key => $value) { $query .= "'$key'" . ","; } $query .= substr ($query, 0, -1) . ") ";
-
It should be: $_SESSION['MM_name'] NOT $_SESSION['MM_username'] But MM_username should still shown up after "Welcome", hmmm.....
-
Everything looks fine to me. Are you sure you're looking at the same page? Uploading it to the server (if you don't use local)? P.S. - The attributes should look like:
-
Yes, that's because you're adding a comma even if $key is empty. (see the 2 consecutive commas without value in between?) To check do something like: $query .= (!empty($key) ? $key."," : "";
-
Hmm, looks fine to me, are you echoing it out to see where it gets lost?
-
The string weren't terminating properly. Change both of these lines: $query = "SELECT * FROM supplements WHERE supp_id IN ('"; $query .= substr ($query, 0, -1) . "') ";
-
Same problem as before... Try: if (strpos($fp,"Redirected")){ if(strpos($fp,"whois.ripe.net")){ $whois_ip_servernew = 'whois.ripe.net'; whois_ip($whois_ip_servernew, '-1', 'FALSE', $visitor_ip); } else { return $fp; } } else { return $fp; }
-
Remove all those @ signs and it should output a more descriptive error message. Is 'askjohnny' definitely a database?
-
You should be using double quotes for your queries or you variables won't interpolate. Try this, and next time post the exact error message. $query = "SELECT * FROM supplements WHERE supp_id IN ('; foreach ($_SESSION['cart'] as $key => $value) { $query .= $key . ','; } $query .= substr ($query, 0, -1) . ') ";
-
You never closed your function... With proper indentation this could have been easily detected. Try this: ini_set("display_errors", "1"); error_reporting(E_ALL); function hello_test($text){ if ($text == 'hello'){ echo $text; } else { hello_test('hello'); } } hello_test('goodbye'); ?> EDIT: You know this will always echo "hello", right?
-
MS is coming out with something similar: http://www.istartedsomething.com/20090318/expression-web-superpreview-cross-browser-testing/ There was already a thread started on this by jcombs: http://www.phpfreaks.com/forums/index.php/topic,243716.0.html
-
What gives you doubt, have you tried?
-
Strictly with HTML? You would have to use the META Redirect.
-
You took it out of the WHILE loop again, and I think you meant you get the same foreach error. Use this: $supp_id_out = array(); while ($row_cl = mysql_fetch_assoc($result_cl)) { $supp_id_out[] = $row_cl["supp_id"]; $qty_out = $row_cl["qty"]; } foreach($supp_id_out as $key => $value) { $qty1 = $qty_out; $pid = $key; // add to the cart session variable $_SESSION['cart'][$pid] = $qty1; }
-
That's just the way it is. If it's an integer you do not need single quotes around values. No, because the actual string is in double quotes so it's interpolated into the entire string. Does that make sense?
-
Haha, ok just making sure! A blank page usually means syntax errors that are being suppressed, please do what PFMaBiSmAd suggested and report back the results.
-
Like Ken mentioned, with proper indentation and format this error could have been easily avoided or detected.
-
No. $sql = "SELECT COUNT(*) FROM category WHERE category = '$categoryvariable'";
-
Where you had it before. I never told you to take it out.