x_filed2k
Members-
Posts
20 -
Joined
-
Last visited
Never
Everything posted by x_filed2k
-
Sorry for my mistake. Well I tried to do it... Here's the code... $text = preg_replace('/<div class=title>.*?<div class=\'end\'>/', '<div class=title><div class=\'end\'>', $text);
-
Waaa.. I thought it was preg_match... that was what I've read.
-
Oh, one more thing session alone is not enough. You need to use session and cookie. The scenario is vice-versa, what if the users browser cookie is on.. and the user when he closes the browser without loging-out and re-open it again, ofcourse he wanna keep to be log-in coz the last time he used it he didn't log-out.
-
Using preg_match() alone will not remove any string in between the <login> and <end>. Test your codes again but this time put a string in-between the <login> and <end>, and var_dump it, the result will be the string that you wanna remove. Try this one.. <?PHP $pattern = "/<login>.*?<end>/"; $sample_value = "<login>any string here<end>"; preg_match($pattern, $sample_value, $text); echo("This is the result when you only used the preg_match().<br />"); var_dump($text); echo("<br /><br />"); $text = str_replace($text, "<login><end>", $sample_value); echo("You have used the str_replace() to remove the unwanted strings.<br />"); var_dump($text); echo("<br /><br />"); ?>
-
Can't you use string_replace();
-
Can't you use a session? What if the cookie of the browser is disabled, it won't work..
-
It seems that he would like to use the value of field username as an array key and the value is the password.. Try this. require_once("../includes/config.php"); $q1 = "select * from egadmin"; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); $LOGIN_INFORMATION = array( '$a1['username']' => '$a1['password']' ); Your friend, Alexies
-
At the mean time this is the only help i can give, co'z i am already going home. later i can attend to you or the other guys can give more help. Just a suggestion.. It would be better if you will inform the user that he/she cant have the schedule at 3:50 and at the same time you need to tell that the available schedule would only be at 4:30 and onwards.
-
If you are insert a data you can try this... <?php include ("connectionusers.php"); $ID = $_SESSION["authenticatedUser"] ; $ID = $_GET['ID'] ; $query = "INSERT INTO `users`(`Weapon1`) VALUES (\"Pistol\")"; $result = mysql_query ($query); ?> or Updating a data. <?php include ("connectionusers.php"); $ID = $_SESSION["authenticatedUser"] ; $ID = $_GET['ID'] ; $query = "UDPATE `users` SET `Weapon1` = \"Pistol\" WHERE `ID` = \"${ID}\""; $result = mysql_query ($query); ?>
-
Are you an insert a value or updating a value?
-
I need some clarification. Is this what you wanna do? User access at.. 1:00 pm and it will generate... simething like: just consider this as timestamp (1:00)_file.txt (1:05)_file.txt (1:10)_file.txt (1:15)_file.txt (1:20)_file.txt is there a possibility that the user will access it again on 1:03 and the script will process? or there will be only a process if the current time is already after 1:20.
-
Hehe. Yeah, but it is a better practice to use htmlentities("<br />", ENT_QUOTES);
-
So, what you wanna have is a pagination or a navigation, with a number navigation and next and previous page. such example is, try to search something on a google, and if you get a lot of results there will be a number, next and previous navigation at the bottom.
-
I am not sure on what you are trying to do? Are you trying to print on a web browser an html tags.. if do so you need to use a function: echo(htmlentities("<br />", ENT_QUOTES)); But if you would like to <br /> only, of course you're not going to see it, coz it is a html tag, you can see it if you view source, .
-
if statement with an empty or unasigned verable
x_filed2k replied to crawlerbasher's topic in PHP Coding Help
I before I posted my code, i've tested it first. And when i tested it above it i place a ini_set("display_errors", "1"); error_reporting(E_ALL); to make sure and to check if any of my codes has an error. And it didn't gave me any warnings or errors. -
if statement with an empty or unasigned verable
x_filed2k replied to crawlerbasher's topic in PHP Coding Help
I am not taking your code, but I am giving a help. I was a long method type programmer before, but i've learned a lot. Doing such long method could make the next programmer hard to understand the logic of your codes. And that is my, "The way of my programming." -
Try this... Do you know modulus division? I thinks this is what you are trying to do. <?PHP $no_of_columns = 5; $variable_array = $your_array_variable; $column_begin = "<tr>"; $column_end = "</tr>"; echo("<table border=\"1\">"); for($i = 0; $i < count($variable_array); $i++) { if(($i % $no_of_columns) == 0) echo($column_begin); echo("<td>{$variable_array[$i]}</td> "); if(($i % $no_of_columns) == ($no_of_columns - 1)) echo($column_end); } if(($remaining = ($no_of_columns - ($i % $no_of_columns))) != 0) { for($a = 0; $a < $remaining; $a++) { echo("<td> </td>"); } echo($column_end); } echo("</table>"); ?>
-
what is the best way to write statesment in the function ?
x_filed2k replied to linux1880's topic in PHP Coding Help
Sorry wrong post-reply area. -
if statement with an empty or unasigned verable
x_filed2k replied to crawlerbasher's topic in PHP Coding Help
I'd highly unrecommend using this code, as it is a direct entry into a mass amount of problems. Well the codes of bombsquad and oni-kun is correct, but unnecessary. Well with the code of oni-kun, it used a long method, while with bombsquad's code he's missing one function the isset(). Let's analyze the problem: [*] Is the $_GET["id"] set? [*] If set, is the $_GET["id"] equal to Test? Now, if we make it into coding this would be the solution... if(isset($_GET["id"]) && ($id = htmlentities(strip_tags($_GET['id']))) == "Test") { echo "This is a Test Page"; } else { echo "No assigned verable or entry verable"; } Explanation: - If $_GET["id"] is not set, result would be "No assigned verable or entry verable". - If we've got set $_GET["id"] but not equal to Test, result would still be "No assigned verable or entry verable". to make it simplier. - $_GET["id"] should be set and equal to "Test". Which is equal to this condition.. if(isset($_GET["id"]) && ($id = htmlentities(strip_tags($_GET['id']))) == "Test") - any other situation that does not fall into this condition will have a result "No assigned verable or entry verable". And at the same time, we set and clean/validate the variable $id.