mathewjenkinson
Members-
Posts
17 -
Joined
-
Last visited
Never
Everything posted by mathewjenkinson
-
i stripped off the path the whole error is:
-
yeah, theirs only 1 script in that directory: its called temperature_logger.php and i post the variables to it via temperature_logger.php?device=001&temp=23
-
Hi all, I went away and re-examined my code. I have two dev environments - one local and one remote. The code: <?php $unixtime = time(); // get device variables $device_id=$_GET['device']; $device_temp=$_GET['temp']; /* //for testing purposes echo "unixtime: " . $unixtime . "<br />"; echo "device id: " . $device_id . "<br />"; echo "device_temp: " . $device_temp . "<br />"; */ // Make a MySQL Connection mysql_connect("localhost", "root", "swordfish") or die(mysql_error()); mysql_select_db("logger") or die(mysql_error()); //mysql query $query = "INSERT INTO temperature (`id`,`device_id`,`temp`,`unixtime`) VALUES ('',$device_id,$device_temp,$unixtime)"; // Insert a row of information into the relevant device table mysql_query($query); mysql_close(); echo "Data Inserted!"; ?> works perfectly fine on my local server but the moment i upload it to my remote server. which has the same config I get the following error: after a quick google a few websites have suggested that i am missing the ; from line 3. but I have that. so It cant be that. Im very baffled as to why I can get it to work on my local machine and not on my remote server? Any ideas? Thanks Mathew
-
Hi Pikachu2000, I got access to the error log 5 mins ago, it displays a 'T_LOGICAL_OR' error. the mysql query now looks like: //mysql query $query = "INSERT INTO temperature (`id`,`deviceid`,`temperature`,`unixtime`) VALUES ('',$device_id,$temp,$unixtime)"; // Insert a row of information into the relevant device table mysql_query($query); the php script now echos that data has been inserted however when i go into the DB via phpmyadmin, theirs nothing in the table temperature. from the looks of things the mysql query is still wrong? thanks, Mathew
-
hi guys Ive written this php to take in two variables from the http POST, the idea is that I can multiple devices submit temperature readings to the php script, the script then append the unix time stamp and then the the 3 variables - device id, temp and unix time are then stored in a mysql DB. I can get the variables to present on a php page for debugging but I cant get the variables to be stored in the mysql DB. See the code: <?php $unixtime = time(); // get device variables $device_id=$_GET['device']; $device_temp=$_GET['temp']; /* //for testing purposes echo "unixtime: " . $unixtime . "<br />"; echo "device id: " . $device_id . "<br />"; echo "device_temp: " . $device_temp . "<br />"; */ // Make a MySQL Connection mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); //mysql query $query = "INSERT INTO temperature VALUES ('',$device_id,$temp,$unixtime)"; // Insert a row of information into the relevant device table mysql_query($query); or die(mysql_error()); mysql_close(); echo "Data Inserted!"; ?> I cant see where Im going wrong to correct this, but as nothing is displayed on the page i believe I am not forming the query correctly? - any ideas would be much appreciated. Thank you Mathew
-
Hi all, Im trying to create an test environment where a php page can complete a XML document and then proceed to post said xml document to a remote server. Its based on a telephone database currently stored on a local mysql server. The user clicks the telephone number and this is then inserted into the XML document completing the document. This is then posted to a remote server. Ive written the PHP so that when the user clicks from the displayed page, it loads a link to: http://localhost/xml_post.php?tel=0123456789 but how do I get the xml_post to insert the string into the pre-written xml and then post it to the server? the xml is small and basic: <?xml version='1.0' encoding='UTF-8' ?> <username>test</username> <password>123</password> <tel_number>INSERTED STRING</tel_number> Basically it goes: HTML link-> PHP -> XML -> database any help would be appericiated thank you! Mathew
-
How do I write an expression that allows the user to go to: domain.com/folder/ and be linked to: domain.com/folder/index.php?id=100 ived tried: RewriteRule ^/ index.php?id=100 [L] but no joy. anyone got any suggestions? Thanks Mathew
-
highlighting users location from a generic menu file.
mathewjenkinson replied to mathewjenkinson's topic in PHP Coding Help
Fantastic Thank you very much, would that work even if I used url_rewrite? -
ive got a vertical menu system stored in a mysql db thats called when a page loads. is there a way I can use a tag or parameter to highlight what page you are on? at present im using: <ul> <li><a href="#" tabindex="1">What We Do</a></li> <li><div class="active"><a href="#" tabindex="2">Education</a></div></li> <li><a href="#" tabindex="3">Research</a></li> <li><a href="#" tabindex="4">Grants and Awards</a></li> <li><a href="#" tabindex="5">National Societies</a></li> <li><a href="#" tabindex="6">EONS Newsletter</a></li> <li><a href="#" tabindex="7">News</a></li> <li><a href="#" tabindex="8">Events</a></li> </ul> with the div class identifying what page the user is presently on. This means putting the whole menu system into each page where it would be easier to load from a single file. Would it still be possible to highlight what page the user is on?
-
mod_rewrite directory list?
mathewjenkinson replied to mathewjenkinson's topic in Apache HTTP Server
Ive had a go following some tutorials but I cant seem to get the url rewrite to work, can anyone have a quick look and help identify where ive gone wrong?: RewriteEngine on RewriteRule ^/?whatwedo\index.html$ index.php?id=100 [L] RewriteRule ^/?whatwedo\education.html$ whatwedo/index.php?id=110 [L] RewriteRule ^/?whatwedo\research.html$ whatwedo/index.php?id=120 [L] RewriteRule ^/?whatwedo\grants_awards.html$ whatwedo/index.php?id=130 [L] RewriteRule ^/?whatwedo\national_societies.html$ whatwedo/index.php?id=140 [L] RewriteRule ^/?whatwedo\newsletter.html$ whatwedo/index.php?id=150 [L] RewriteRule ^/?whatwedo\news.html$ whatwedo/index.php?id=160 [L] RewriteRule ^/?whatwedo\events.html$ whatwedo/index.php?id=170 [L] Thank you very much, -
Is it possible to use mod_rewrite totally rewrite URLS that exist in the same folder? so: folder/index.php?id=110 comes out as: folder/education.php and folder/index.php?id=120 comes out as: folder/research.php Im assuming you would have to have a list in the .htacess file that references each file name, or is that rubbish? or could I use data from a mysql db to populate the name? So: folder/index.php?id=110 reads the title 'education' from the row in question and then fills that in as folder/education.php
-
another way to populate without using url ?id=
mathewjenkinson replied to mathewjenkinson's topic in PHP Coding Help
prehaps, that could work too. at the moment, its set up that: index.php?id=100 loads the data on education where as if i could do education.php that would be a lot better -
another way to populate without using url ?id=
mathewjenkinson replied to mathewjenkinson's topic in PHP Coding Help
the guy im designing the website for has requested it. apparently index.php?id=100 is 'yucky' - I dont see it personally but gotta do what the customer asks for. -
Is there a way I can request information from a DB to fill a page without using something like: http://www.domain.com/index.php?id=23 so its just http://www.domain.com/index.php but still gets the information from the db?
-
Hi All, Im writing a page that displays snipets of news articles. I can get the page to connect to the MYSQL DB and get the title and thumbnail however I want to limit the amount of the actual news bit to 50 characters with a link to the rest of the article. Anyone got any ideas? Thanks Mathew.
-
last 5 articles in a DB displayed on a page?
mathewjenkinson replied to mathewjenkinson's topic in PHP Coding Help
Thanks for the help. the next bit is the date. but still need to decide if i want to let people edit the story after its been published. -
Hi all, Im trying to set up a small news site. One of the features I would like is 'Recent news' where the last 5 created articles headline can be displayed along with a link to that article. The DB has been set up with 'article_id', 'Article_name' etc. so I was thinking about basically working back words from the highest article number and displaying those 5. but I have no clue how I would go about doing that... Anyone have any ideas? Thanks Mathew