premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
If I would have known you behaved like an asshat, I wouldn't have bothered. There is no need to put down people trying to help you out. If they troll you, take it off your chin like a man and not be an asshole about it.
-
MMMMMMMMMMMMMMMMMMMMMMMMM Very professional in deed.
-
There is no rhyme or reason to your combine, other than you want the first item of the subarrays to match up with the second array. $arr = array(); foreach ($ticketArray as $key => $val) { $arr[] = $ticketArray[$key][0]; } var_dump($arr); Should get you what you want, but might need more information if it doesn't work like you expect it to with all data.
-
If you would display the errors I am sure you would see why. mysql_query($sql1, $con) or trigger_error('Error Creating Database: ' . mysql_error()); See what error is being thrown.
-
Outside of document root would be ideal.
-
If you are using Apache, yes with mod_rewrite. RewriteEngine On RewriteRule (.*)$ index.php?p=$1 [L] However, /DATA is very generic and I would recommend something to distinguish it by, but yea, pending any errors on my part that should work.
-
So re-arrange to figure out why it is not working...that is like all of coding, trial and error till you get it right or give up. <?php $dt = date('Y', strtotime( '- 1 year')); echo '<select name="birthyear">'; for( $i = 1900; $i <= $dt; $i++ ) { echo '<option value="'.$i.'">'; echo $i; echo '</option>'; } echo '</select>'; ?>
-
Yep, you gotta watch out for that.
-
I just took the curl code and ran it on my server. string(93) "2011 06 13 16 50 330 1.0 2.0 0.8 7 4.8 105 1012.4 18.1 19.3 9.7 MM +0.4 MM" [1075]=> string(93) "2011 06 13 15 50 20 2.0 3.0 0.9 6 4.8 107 1012.5 17.5 18.8 9.3 MM +0.7 MM" [1076]=> string(93) "2011 06 13 14 50 30 4.0 5.0 0.8 7 4.5 101 1012.4 17.5 18.6 11.0 MM +1.2 MM" Seems to be working just fine on my end. Not sure where your hold up would be. Did it ever work?
-
Dump the $file in the function and see what is coming. It could be a server error, that would be my bet. var_dump would do the trick to see the data you are getting.
-
explode. file reads in a file and splits it at the line character. function getFile($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $file = curl_exec($ch); curl_close($ch); return explode("\n", $file); } Should return an array.
-
Should be, you may have to try adding the header and setting the USERAGENT via the curl_setopts to trick the page into thinking it is a browser requesting it. function getFile($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $file = curl_exec($ch); curl_close($ch); return $file; } See what that does.
-
function getFile($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $file = curl_exec($ch); curl_close($ch); return $file; } // Then replace the file call with getFile getFile("http://www.ndbc.noaa.gov/data/realtime2/44025.txt"); Reading the manual is often the best bet. I took this straight from the curl_init page, just added the return transfer and wrapped it in a function for you.
-
If you are using the ODBC class in PHP, I would use prepared statements. http://www.php.net/manual/en/function.odbc-prepare.php
-
Get results of rows that aren't in other results
premiso replied to imperium2335's topic in MySQL Help
ebmigue, you have already proven yourself an idiot. No need to further convince us. Thanks! -
http://www.phpfreaks.com/forums/index.php?topic=37442.0 On a side note, your setcookie won't ever get set. You set it to expire while it is created. setcookie("jf1ljj55k3q", "x", time()+3600); Will have it expire 1 hour from now.
-
Order of Operations. <?php $user_ip = $_SERVER['REMOTE_ADDR']; $conn = mysql_connect("localhost", "user", "pass")or trigger_error("cannot connect to mysql server: " . mysql_error()); // your database connection function mysql_select_db("database") or trigger_error("cannot select DB: " . mysql_error()); $q = mysql_query("select `id` from `allowed_ips` where `validate_ip` = '$user_ip' limit 1") or trigger_error('IP Query Failed: ' . mysql_error()); if (is_resource($q) { $r = mysql_fetch_assoc($q); } The first thing was that your mysql_query was before the select_database, so it was not able to query properly and probably threw a "database not selected" error. A few key notes, handle data properly. By checking if $q is a resource, you know your script will not cause havoc in case something failed and throw errors. And you can handle the error to display a nice message to the user. mysql_close is not needed to be called (unless maybe you want to connect to multiple mysql servers). PHP is smart enough to close the connection upon the script ending. Using or trigger_error is preferable over DIE as you can then handle the error nicely, it does not kill the script and for production, you can disable the display of errors to hide the important information from the average viewer. So give that code a try and see what error gets spat out at you.
-
Get results of rows that aren't in other results
premiso replied to imperium2335's topic in MySQL Help
Now that the kitty's have decided to agree to disagree the pissing match should be over. Let's get back to the SQL at hand: SELECT ds.id FROM detail_sheets ds WHERE ds.id NOT IN ( SELECT ds2.id FROM detail_sheets AS ds2 JOIN enquiries AS eq ON eq.detail_sheetRef = ds2.id JOIN jobs AS jb ON jb.enquieryReg = eq.id WHERE ds2.status = 'Customer' ) I just felt like optimizing it a bit for ya. I am not sure why the DISTINCT was used or even brought up, the original question did not suggest it was returning duplicate rows. If it is, then a GROUP BY id should be used instead. Hopefully this helps ya out imperium2335. Let me know if it doesn't work or you need extra help. EDIT: Changed NOT EXISTS to ds.id NOT IN, perhaps this may kick it into gear. -
Same physically location? The difference is the () parans. They are not required and not needed. There is no difference as it does the same thing with the same performance. I prefer the non-paran method. Example of echo using parameters: (*Edit Note) With the exception that you cannot pass parameters to echo when it is encased in parans. echo "Test", $one, $two; Both do the same thing, no difference in execute time, just one has parans around it. EDIT: Removed some incorrect information.
-
If you don't want to mess with apache and enabling another module take a look here http://www.php.net/manual/en/function.readfile.php#88549 <?php function readfile_chunked ($filename,$type='array') { $chunk_array=array(); $chunksize = 1*(1024*1024); // how many bytes per chunk $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { switch($type) { case'array': // Returns Lines Array like file() $lines[] = fgets($handle, $chunksize); break; case'string': // Returns Lines String like file_get_contents() $lines = fread($handle, $chunksize); break; } } fclose($handle); return $lines; } ?> Reading it out in chunks should solve your memory issues. I dunno how this handles up to performance, so you will just have to test that part.
-
http://www.phpfreaks.com/forums/index.php?topic=37442.0
-
Along with what Philip said, there are plenty of free places to host code at and issues / discussions at which offer much for the OS programmer, such as versioning with GIT / SVN etc. You can also install 3rd party software on a server to keep track of it, Redmine / Trac / Mantis. There is also GitHub, Google Code, SourceForge plus many more. I would think that you can feel free to discuss in the Beta section, but any issue tracking type setup should be done on your own terms, and not a place you really have no control over, at least in my opinion. That being said, feel free to post your Change Logs in the Beta section and ask people what they think would be cool for features or update people on here with it. But I would still look into the other tracking software out there.
-
This really isn't the place to ask. You should submit a support ticket.