premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
You notice, you added the ../ I did not. Use this code in its entirety without changing it: $uploadLocation = $_SERVER['DOCUMENT_ROOT'] . "/nkmaa/ldtuploads/"; And it should work just fine.
-
Why are you even using buffers? You know you can just append output to a string and be fine. But here is what I think you are after (note without the buffers): <?php $query="SELECT * FROM location WHERE type='1'"; $result=mysql_query($query); $output = ""; // initialize $script = ""; if(mysql_num_rows($result)>0) { while($selectlinks=mysql_fetch_array($result)) { $name=$selectlinks['name']; $address=$selectlinks['address']; $lat=$selectlinks['lat']; $lng=$selectlinks['lng']; $output .= "$name,$address,$lat,"; $script .= "var marker = new GMarker(new GLatLng({$lat}, {$lng})); GEvent.addListener(marker, \"click\", function() { var html= '{$name}<br />{$address}'; marker.openInfoWindowHtml(html); }); map.addOverlay(marker);"; } // $output .= $script; // Only use this if it is what you wanted } include("template.php"); ?> Now I am unsure if you wanted the script output to be included after each lat long printing, if you did then change $script to $output, if you wanted them combined together then uncomment the $output .= $script line above. Else, you can use $script in the template file to display the javascript. Hope that helps.
-
Prevent PHP mail( ) from appending hostname to from address
premiso replied to jrw4's topic in PHP Coding Help
To do what you want I believe you will have to have an SMS gateway device and software setup on the server. As EMails always have to be from a host (the @ host) as that is just their nature and it is not a valid email without it. http://www.ozekisms.com/php-sms-api-asp-sms-api/index_p_php_q_ow_page_number_e_327opt.html Is a link to some software / hardware that you can do what you want to with. Not sure of the cost etc, but yea. I believe that is what you want and to try this with email is just wasting your time. (I could be wrong but I do not think so.) Alternatively, if you know the provider the sender's phone number is, you can look up the SMS email for their number and use that for the hose so for tmobile it would be something like: 10digitnumer@tmomail etc. which would allow you to do what you want, if that does not work for you then yea, the gateway would be the other way. EDIT: A list of the providers email address hosts http://www.accutracking.com/sms-email.html -
To move a file you have to use the path on the server and not the web path. Meaning your path to move the file would look something like: $uploadLocation = $_SERVER['DOCUMENT_ROOT'] . "nkmaa/ldtuploads/"; That will give you something like: /home/nkma4081/public_html/nkmaa/ldtuploads/ Which is the correct server path and not the web path. Hope that makes sense.
-
Well you do realize that you are contradicting yourself right? But either way the query would look something like: WHERE ((searchfield LIKE '%water%' OR searchfield LIKE '%hot%') AND searchfield NOT LIKE '%water hot%') Should get you what you want. The contradiction is that you want to pull a result if it contains water or hot, but not the reverse order. Either way, the above should show you what will need to be done to accomplish this.
-
/* Verify that user is activated */ $q = "SELECT userlevel FROM ".TBL_USERS." WHERE username = '$username' LIMIT 1"; $result = mysql_query($q, $this->connection) or trigger_error("Query Failed: " . mysql_error()); $level = mysql_result($result, 0, 0); // fetch the first column from the first row if($level == 1){ return true; //Indicates user is active } return false; //Indicates user is not activated. Should work for ya, mysql_result is able to pull a single column since that is all you need. Hope that helps. You should use true (1) if the user is a valid level and false (0) if they are not. This makes a lot more sense to more people. EDIT: Fixed a syntax issue.
-
You can make the field UNIQUE which would not allow it to be inserted. The only other way that I know of would be to do a SELECT query before the insert to test if that name is present in the database.
-
If you have more than a few developers and you want to be able to see changes etc, SVN is definitely the way to go. I have never used GIT, but heard good things about it. I have used Windows SVN, which worked good just really slow, and I have used the Subversion SVN, which worked great as well. If you do want to know exact changes and when they were made / by who SVN is the way to go!
-
Nested DIV's is perfectly fine and necessary in most cases. However, depending on the data you need to use the proper methods. If it is a blog you are designing then the CSS / DIVs is definitely the way to go. But if you are trying to display tabular data from a database, I would stick to tables. Hope that helps.
-
How do you store the return value for substr_count in a session?
premiso replied to sh0wtym3's topic in PHP Coding Help
session_start(); // needs to be before any output $results = substr_count("This is a test sentence","test"); $_SESSION["results"] = $results; Should work. You were just using ( ) instead of [ ] . -
Try saving the file using Notepad and not Notepad++ and see what happens. If it works your notepad++ is doing something funky to files when saving and I would suggest re-installing it.
-
I think you would need a time machine to go back in history.
-
the gc_maxliftime does not deal with how long the session stays. It determines how long the session has been inactive before the garbage collector trashes the file. session_set_cookie_params is going to be what you want. This will allow you to set the cookie's life time to be longer than 10-20 minutes. If you prefer to modify your php.ini file, to avoid having to add that code in your script before the session_start look at: http://us3.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime
-
session_register has been depreciated. You should assign values using $_SESSION['key'] = 'value'. Also I do not see you calling session_start at the top of the script(s). As without calling that no session should work.
-
mysql fetch array not iterating through the records
premiso replied to BinaryBird's topic in MySQL Help
Well why are you doing a $count incrementor? That is what LIMIT does. It will only return 3 records, no matter what. To make sure your query is valid add this: $query2 = "SELECT * FROM member WHERE team_id={$team_id} LIMIT 3"; // note that will limit the query to 3 $q2_set = mysql_query($query2,$dl) or trigger_error("Query Failed: " . mysql_error()); And to modify Philip's loop to remove the $count: while($result2 = mysql_fetch_array($q2_set)) { I would completely remove that $count and $count < 3 as it is redundant and not necessary. -
Well your code somewhere is messed up and you do not know, either in translation (uploading it to the server) or something. As the only way I can see to produce that error is a mistake like this: <? phpini_set(); Other than that I do not know how your files are setup and where that error is coming from. But given that it is on line one, maybe the editor is not really breaking out the lines. Make sure you are editing the proper file and that it is saving in the right spot.
-
Given this: phpini_set() you have your code most likely like so: <?phpini_set() Make sure that is not what is going on etc. If it is separate it out like this: <?php ini_set()
-
You want to use Javascript to display how many characters have been written in a text area. As PHP is server side it does not know until they submit the form.
-
If you know the session id, you can set the id with the session_id function, once the id has been set, you can then use the session_destroy function to kill the session. And to fully kill it:
-
echo "<td><a href=\"http://dracolas.comli.com/clan/profile.php?username=$username\">$username</a></td>"; Is what he is telling you to do.
-
Are you sure you are accessing the correct config.php? Try this: <?php // SQL info $host = "lpsql01.lunariffic.com"; $user = "b2ku00_admin"; $pass = "****"; $db = "b2ku00_forum"; // Setup connection $ms = mysql_pconnect($host, $user, $pass) or trigger_error("Unable to connect: " . mysql_error()); if ( !$ms ) { echo "Error connecting to database.\n"; } // Select DB mysql_select_db($db) or trigger_error("Database not selected: " . mysql_error()); echo "The database has been selected."; ?> And see if the echo statement echos or if there is an error. If there is no "The database has been selected." echo'ed you are modifying / including the wrong file and you need to look at that to fix it.
-
Age 12 when I learned HTML/Javascript. (roughly 12 years ago).
-
<?php if (isset($_GET['a'])) { $converter = array('blankspot' => 'blanks', 'test1' => array('x' => 123, 'y' => 456), 'test2' => array('x' => 321, 'y' => 654), 'blankspothere' => 'blank'); $a = $_GET['a']; if (isset($converter[$a])) { if (is_array($converter[$a])) header("Location: {$converter[$a]['x']}{$converter[$a]['y']}"); else header("Location: {$converter[$a]}"); exit; } } ?>
-
Next time please point out line 17, as it is annoying having to find it, especially since we are helping you, you should help us. // Create query $id = "SELECT member_id FROM `members` " ."WHERE `name`='".$_POST["username"]."' "; You were missing the semicolon there.
-
Upgraded to PHP 5.3 - new "undeclared variable" error
premiso replied to abitlikehomer's topic in PHP Coding Help
You have to declare the $xml variable before you append to it, so to prevent this error: $xml = ""; // declare variable. // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes //Top of xml file $_xml .= '<?xml version="1.0"?>'; Simply declare the $xml variable before you append to it EDIT: Eh I feel retarded, BahBah had it right, I just explained what was going on. I would use his suggestion as it would make more sense, but the same principals apply.