premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
You can, but you do not need to. Inside the function you can access that by $_SESSION['cart']. It depends on if you want your function to handle more than just session or not.
-
Print elements of an array and concatenate them in a string
premiso replied to g_p_java's topic in PHP Coding Help
Why not post the code you are using? That way we can specifically show you what to do... -
It depends, if he is going to re-use it, Snart's way is better, if he is not, your way is better. All scenario dependent
-
[SOLVED] Should You mysql_real_escape_string ALL form data?
premiso replied to limitphp's topic in PHP Coding Help
<?php array_walk($_POST['genre'], "mysql_real_escape_string"); $genres = "'" . implode("','", $_POST['genre']) . "'"; ?> Should apply that function to each element of $_POST['genre'] -
$query = "SELECT * FROM pbs WHERE ID = '1' AND `time` <> ''"; OR if `time` can be null $query = "SELECT * FROM pbs WHERE ID = '1' AND `time` IS NOT NULL";
-
You can parse it. <?php $testData = 'array(array( field_1=>"AAA", field_2=>"111" ), array( field_1=>"BBB", field_2=>"222" ), array( field_1=>"CCC", field_2=>"333" ))'; $data = explode(" ), array( ", $testData); $data[0] = str_replace("array(array( ", "", $data[0]); $data[(count($data)-1)] = str_replace(" ))", "", $data[(count($data)-1)]); $newArray = array(); $i=0; foreach ($data as $dat) { $fields = split(", ", $dat); $newArray[$i] = array(); foreach ($fields as $field) { list($key, $val) = explode("=>", $field); $newArray[$i][$key] = str_replace('"', "", $val); } $i++; } print_r($newArray); die(); ?>
-
<?php $arr_codes = array(); $arr_codes["0"] = 'j'; $arr_codes["1"] = 'a'; //etc ?> Is how you would need to do it. Each time you are overwriting the other way.
-
[SOLVED] mysql current timestampt to php
premiso replied to dennismonsewicz's topic in PHP Coding Help
No, it will not. But why not pull the data out how you want it formatted when the tool is right there? That and using MySQL DATE_FORMAT will not have the limits of strtotime, which are limits of the OS. I do not believe on a UNIX system strtotime can go past 2039. Anyhow, not to put you down. Just decided to add my reasoning. Either way works. -
[SOLVED] mysql current timestampt to php
premiso replied to dennismonsewicz's topic in PHP Coding Help
Which would be about 8-10x slower than using MySQL's EDIT: Decided to add an example: SELECT DATE_FORMAT(`datefield`, '%d/%c/%Y') FROM table_name WHERE condition = something; -
[SOLVED] mysql current timestampt to php
premiso replied to dennismonsewicz's topic in PHP Coding Help
MySQL DATE_FORMAT -
Anything, such as the image1-4, that may not have a value allow it to be NULL instead of NOT NULL.
-
Couldn't you do this? <?php $ip = $_SERVER["REMOTE_ADDR"]; $splitIp = explode(".", $ip); $charArray = array(); foreach($splitIp as $ipPart){ $charArray = array_merge($charArray, str_split($ipPart)); } var_dump($charArray); ?> Seems a bit easier without messing with the loop
-
"my sites" The client has to either pay out or higher someone cheaper for me to do that. @corbin ms updates, it is there. People just do not install it or have a pirated version of windows and cannot install it.
-
Yea, probably. I display a warning on my sites to IE6 users to update their outdated software and to alert them about FireFox. The funny thing is, people still use the old versions, which really Microsoft probably will not care about IE6 once IE8 is out, and wonder why they get spyware and virus's. As for me, it is not worth my time as a programmer to debug CSS issues, I actually charge double the amount to debug css issues resulting in an outdated browser to be "hacked" to work. If they are willing to pay me double per hour, great. I am all for fixing it. But I am a stubborn guy and they would rather higher someone at $15/hour to solve that headache for them.
-
What would be the advantage of doing that? Having it as $itemid => $qty should be just fine.
-
hahahaha Unfortunately people pay me to make websites and I have to make sure their sites work on the most popular browsers, unfortunately the most popular browser sucks and is a living hell, personally FF3 Anytime someone questions me on IE6, I say tell your users we do not support or you can find someone else to do that. It is such a pain in the but it is not worth the time to try and fix it, cause 1 fix for one browser breaks another etc. And since IE6 is going to be outdated by IE7 and IE8, it is not worth it to code for it. Especially since IE8 is suppose to comply with standards...we will see how that goes. But that is just me.
-
<?php session_start(); if(!isset($_SESSION["username"])){ header("location: login.php"); } ?> Should do the trick.
-
Chances are the html in the php version has a link to a css style sheet that is relative. Since that probably was no copied the styling did not copy over. EDIT: Just looked at the source, both versions seem to work fine on my end. Using Firefox 3 EDIT:EDIT: I am a retard, good catch gevens.
-
how to delete files stored on the server using PHP
premiso replied to starrylitgal's topic in PHP Coding Help
rename will move the file. EDIT: Found that out from the manual, so took out the copy/unlink. -
Nope, MD5 is a 1-way hash. It "can" be broken using different algorithms, but for the most part is safer than just leaving as plain text.
-
MySQL does have a built in MD5() function you can use. You may have been using the PASSWORD( ) function instead. I would go with the MD5() then MD5 your password in the code again and see if that works. When you create your login script, you can have either mysql do that or php either does not mat matter.
-
[SOLVED] Displaying table results in multi column table
premiso replied to rvdb86's topic in PHP Coding Help
Post the code and we probably can help you. -
Not sure how that come object works, but I would do Quit before Close and see if that helps you at all.
-
Are you closing the $word object? Or does it have an option to close? It sounds like you are not properly closing that object, which is why the process keeps running.
-
That is just messed up. Not sure where it is going wrong... You could try this: <?php list($id, $size) = my_explode(";", "11;4.2"); function my_explode($where, $what) { $exploded = explode($where, $what); if (is_array($exploded)) { foreach ($exploded as $key => $item) { if (strstr($item, $where) !== false) { $exploded[$key] = str_replace($where, "", $item); } } } return $exploded; } ?> And run that and see if it works properly. If so, it seems like maybe your server is doing some strange stuff... EDIT: Fixed the code.