-
Posts
1,893 -
Joined
-
Last visited
-
Days Won
8
Everything posted by AbraCadaver
-
Did google tell you that there is rarely if EVER a good reason to use variable variables? Use an array: if ($pos[$i] == '1234') Post more code if you are still unsure.
-
please slove this country select array
AbraCadaver replied to blacktiger786's topic in PHP Coding Help
That's probably a bad idea. You might want to read up on database design and normalization so you don't run into problems down the road. But the simple answer is this, with no foreach loop: require 'databaseconnect.php'; if(isset($_POST['select'])) { $movies = implode(',', array_map('mysql_real_escape_string', $_POST['select'])); $run = "INSERT INTO `test` VALUES ('','$movies')"; $result = mysql_query($run); } Also, get off of the mysql_* functions and use mysqli_* or PDO. -
Html Code Line <meta charset="utf-8" /> Seems To Cause PHP Issue
AbraCadaver replied to phdphd's topic in HTML Help
Well, we'll hope that somebody with more charset knowledge than me reads this, as that is the extent of my knowledge there. -
Html Code Line <meta charset="utf-8" /> Seems To Cause PHP Issue
AbraCadaver replied to phdphd's topic in HTML Help
That was a long post with surprisingly little information. Error reporting on? What errors? Just a shot in the dark, are you using sessions and are you saving the BOM in your files? Notepad++: Settings > Preferences > New Document > UTF-8 without BOM, Apply to opened ANSI files? The BOM will cause issues, especially with sessions. -
please slove this country select array
AbraCadaver replied to blacktiger786's topic in PHP Coding Help
if(isset($_POST['select'])) { foreach ($_POST['select'] as $key => $value) { Don't use [] with the $_POST var. -
Code not recognising opendir, readdir, feof, fgets?
AbraCadaver replied to dudebrodude's topic in PHP Coding Help
Go to Settings > Style Configurator and select Language: PHP and Style: WORD, then add them under User-defined keywords. Notepad++ is a notepad with some scripting features, not a PHP editor. -
I have no idea what your directory structure is, but maybe: include ("includes/functions.php");
-
Sorry, I was wrong. allow_url_fopen affects file_get_contents() etc. allow_url_include determines whether you can include/require. When using any of those you us // not \\ in http://
-
Wrong website. You're looking for another kind of freaks.
-
If you click: <a href="gameInfo.php?id=<?php echo $_SESSION['id']; ?>"> (notice I changed it) Then on gameinfo.php, you get the id with: $id = $_GET['id'];
-
If you can't require the file on the remote site, then most likely allow_url_fopen is off. You can try this on the remote site pages: <script type="txt/javascript"> xmlhttp.open("GET","http://yoursite.com/tracker.php", true); xmlhttp.send(); </script> Or your tracking script could output a 1px transparent image and your remote site pages would just use: <img src="http://yoursite.com/tracker.php">
-
If the error is from that line number then check the previous line.
-
Running A Query From A Comma Separated String
AbraCadaver replied to sintax63's topic in PHP Coding Help
First, don't do that! Create another table for the selected workshops and store individual workshop ids along with the persons id: person_id workshop_id 5 1 5 14 5 12 5 7 13 1 13 11 13 9 -
Regex to find Variables Names & Function Names inside PHP Source File
AbraCadaver replied to tserfer's topic in Regex Help
OK, I was bored. Just a simple example with regex: preg_match_all('/function([^\(]+)\s*\(/i', $file, $functions); print_r($functions[1]); preg_match_all('/\$([a-z_][a-z0-9_]*)/i', $file, $variables); print_r(array_unique($variables[1])); -
Regex to find Variables Names & Function Names inside PHP Source File
AbraCadaver replied to tserfer's topic in Regex Help
Might check reflection class (but I think they will need to be loaded), or: print_r( token_get_all ( file_get_contents( $filename ) ) ); -
PHP - MySQL field string manipulation and value replacement
AbraCadaver replied to RCurtis's topic in PHP Coding Help
Probably an easier pattern, but: $var = preg_replace('/,1\b|\b1,/', '', $var); -
Just paste the ping code in the existing while loop and format the echo how you want inside a td /td or whatever.
-
Assuming everything that you've shown is working independently, just add your ping.php code into the while loop in list.php and change the 8.8.8.8 to $row['IP_Address'].
-
Also, phpMyAdmin http://www.phpmyadmin.net/home_page/index.php
-
Why not just: SELECT QuestionId FROM Questions WHERE CategoryId = ? ORDER BY RAND()
-
// assuming this is from a trusted source meaning you or your teacher.
-
Lots of ways depending on what you want to achieve overall. Here are two: $requestURI = $_SERVER['REQUEST_URI']; $something = basename($requestURI); if($something == '/articles') { // do something } if(preg_match('#/articles/\d+#', $requestURI)) { // do something } EDIT: I'm late today.
-
Haha, yes, wait till you use strip_tags() and stripslashes(), but wait, there's more.... how about some functions take ($needle, $haystack) and some take ($haystack, $needle)? That would be just plain crazy. EDIT: Seconds late
-
Lots of problems: 1. You need to run the POST vars through mysqli_real_escape_string() or use prepared statements before using them in your query. 2. Your form input is name etc. and you are trying to use $_POST[Name]. 3. You're mixing mysql and mysqli functions which won't work. etc...