Jump to content

daniish

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by daniish

  1. Thanks that seems to have worked. No errors occur and my Google Map displays, however, none of the data from the MySQL database is visible but thats probably a separate issue.
  2. I too have used XAMPP, but changing the software is not an option here because this database is on my host web server (Fast Hosting Direct). Does anyone have any alternative suggestions. Many thanks
  3. The phpMyAdmin link suggests that i replace 'localhost' for 127.0.0.1 to resolve this issue, which i did and got the following error: Parse error: syntax error, unexpected T_DNUMBER in /home/sites/globexposure.net/public_html/includes/dbinfo.php on line 2 My include dbinfo.php looks like this: <?php $link = mysql_connect(127.0.0.1,username,password) or die("Could not connect: " . mysql_error()); mysql_select_db('database name') or die ("Can\'t use dbmapserver : " . mysql_error()); ?> Incidentally my username and database name are the same but this shouldn't cause any problems. What would you suggest?
  4. Hello, I am trying to return a set of results from a query on my database, but i get the following error message: Warning: mysql_connect() [function.mysql-connect]: Access denied for user '0'@'localhost' (using password: YES) in /home/sites/globexposure.net/public_html/includes/dbinfo.php on line 2 Could not connect: Access denied for user '0'@'localhost' (using password: YES) I suspect this means that i have not assigned the proper user privileges but i'm not sure how to check this through phpMyAdmin. Can anyone confirm this/know a solution? Many thanks
  5. Hello, How do i set (the target for) a URL link that i have on my website to open in an iFrame that i have on the same webpage? Presumably i need to add some kind of anchor in the iFrame but i'm not really sure. Many thanks Olly
  6. I have re-phrased this and asked it elsewhere where i got a solution. Please ignore this post.
  7. Essentially within Google API i don't understand how to parse the 'id' of the label to retrieve relevant fields from my database for display in the iFrame. As a workaround i would like to store a url which references the specific record 'id' within a field in my database. I know how to get the contents of this field to display in my Google Maps label, which will provide the necessary link without understanding the above. For this to work i need my initial form (add_poi_form.php) to collect this information as a hidden variable and i can use your code to work out what the MAX(id) is - but i need MAX(id) +1 I think this would be done in the following sort of way but i'm really not sure: [code] <form name="add_blog" action="insert_poi.php" method="post"> <?php $res = mysql_query("SELECT MAX(id) FROM locations") or die(mysql_error()); $max_id = mysql_result ($res, 0, 0); $info_id = $max_id ++1; ?> <INPUT TYPE=hidden ID=info_id NAME=info_id VALUE="<a href='http://www.globexposure.net/more_info.html?id=$info_id'>More info...</a>" /> [/code] Hopefully i haven't confused the situation and i'm sorry my question is so convoluted but i would appreciate your clarity. Thanks Olly
  8. Many thanks Barand thats very helpful. If i could trouble you for one last point: On my current form which adds my input to the MySQL database, if i wanted to include a short snippet of php to store the link in a field within the database...am i on the right path: [code] <form name="add_blog" action="insert_poi.php" method="post"> <?php $res = mysql_query("SELECT MAX(id) FROM locations") or die(mysql_error()); $max_id = mysql_result ($res, 0, 0); $new_id = $max_id ++1; ?> <INPUT TYPE=hidden ID=info_id NAME=info_id VALUE="<a href='http://www.globexposure.net/more_info.html?id=$new_id'>More info...</a>" /> [/code] insert_poi.php looks like this: [code] <?php $link = mysql_connect("a", "b", "c"); if (!$link)   {   die('Could not connect: ' . mysql_error());   } mysql_select_db("d", $link); $sql="INSERT INTO locations (title, date, description, lat, lon, link, marker, info_id) VALUES ('$_POST[title]','$_POST[date]','$_POST[description]','$_POST[lat]','$_POST[lon]','$_POST[link]','$_POST[itype]','$_POST[info_id]')"; if (!mysql_query($sql,$link))   {   die('Error: ' . mysql_error());   } echo "1 record added "; echo "<a href='http://www.globexposure.net/form_index.html'>Back to Form Index</a>"; mysql_close($link) ?> [/code] Again thank you.
  9. Only i have access to add records to this database...so i can always check the database to confirm what the latest record id is. I would like to have an html temlate (that uses php) to display the data entered on the form from the MySQL database using something like: echo $row['title']; echo $row['date']; echo $row['description']; where the 'id' from the form = the 'id' in the MySQL table (these would be the same). I already use auto_increment id in the table. I am using Google Maps to display points i visit and i have form to enter details of these on the move. I need the link to put in the Marker label so that users can select this link (which i hope to have open in an iFrame i have on the same page) to get more information. I hope you can help Barand!
  10. Hello, I have a form where i would like to send a hidden variable. The value of the variable is a URL to display the input from the form. The input from the form is stored as a record in a MySQL database. I am using the following code: Code: <INPUT TYPE=hidden NAME=info_id VALUE="http://www.globexposure.net/more_info.html> My question is: How do i append the MySQL record 'id' to the URL so that it returns the relevant information?  (I know the 'id' would be equal to the last 'id' in the database +1 but don't know how to code that) Many thanks Olly
  11. Evening! I have a form where i would like to send a hidden variable. The value of this variable is a URL to an html template displaying much of the information entered in the form. The info from the form is stored as a record in a MySQL database. I am using the following code but i'm not sure its right. [code] <INPUT TYPE=hidden NAME=info_id VALUE="http://www.globexposure.net/more_info.html?marker_id=" . $row['id'] . > [/code] The URL needs to include the MySQL 'id' for the record but i don't know how to parse the id to the form before the form is submitted. I hope you understand me and can help. Many thanks Olly
  12. Hmm i like arrays:) do you think i can get your method to work with the javascript i am using: [url=http://www.javascriptkit.com/script/script2/curdateform2.shtml]http://www.javascriptkit.com/script/script2/curdateform2.shtml[/url] Cheers!
  13. Hello, I have the following date selector in an html form: [code] <form name=add_blog action="insert.php" method="post"> Title: <br><input type="text" size="79" id="title" method="post" name="title"></input> <br><br> Date: <br> <select id="daydropdown"></select> <select id="monthdropdown"></select> <select id="yeardropdown"></select> <br><br> [/code] How do i concatenate the DATE values and save them in a variable that i can assign to a field in my SQL database? Many thanks for your help
  14. I think it is easiest if i just give you the whole script. May i draw your attention to the 'Label Description:' which is where i am attempting to get both the WYSIWYG editor and character counter to work. [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Add Blog </TITLE> < script type="text/javascript" > /*********************************************** * Drop Down Date select script- by JavaScriptKit.com * This notice MUST stay intact for use * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more ***********************************************/ var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec']; function populatedropdown(dayfield, monthfield, yearfield){ var today=new Date() var dayfield=document.getElementById(dayfield) var monthfield=document.getElementById(monthfield) var yearfield=document.getElementById(yearfield) for (var i=0; i<31; i++) dayfield.options[i]=new Option(i+1, i+1) dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day for (var m=0; m<12; m++) monthfield.options[m]=new Option(monthtext[m], monthtext[m]) monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month var thisyear=today.getFullYear() for (var y=0; y<20; y++){ yearfield.options[y]=new Option(thisyear, thisyear) thisyear+=1 } yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year } </ script > < SCRIPT LANGUAGE="JavaScript" > <!-- Begin   var submitcount=0;   function checkSubmit() {       if (submitcount == 0)       {       submitcount++;       document.add_blog.submit();       }   } function textCounter(field, countfield, maxlimit) {   if (field.value.length > maxlimit)       {field.value = field.value.substring(0, maxlimit);}       else       {countfield.value = maxlimit - field.value.length;}   } //  End --> </ script > </HEAD> < script language="JavaScript" type="text/javascript" src="wysiwyg.js" ></ script > <BODY> So you've just visited some place new and exciting...well blog those experiences right here. <br> The 'Travel Blog' & 'Associated Link' are not mandatory.<br><br> < script language="JavaScript" type="text/javascript" src="wysiwyg.js" ></ script > <form name=add_blog action="insert.php" method="post"> Title: <br><input type="text" size="79" id="title" method="post" name="title"></input> <br><br> Date: <br> <select id="daydropdown"></select> <select id="monthdropdown"></select> <select id="yeardropdown"></select> <br><br> Label Description: <br><textarea rows="5" cols="100" id="description" name="description" onKeyDown="textCounter(this.form.description,this.form.remLentext,255);" onKeyUp="textCounter(this.form.description,this.form.remLentext,255);"></textarea> < script language="JavaScript1.2">generate_wysiwyg('description');</ script > <br>Characters remaining: <input type=box readonly name=remLentext size=3 value=255 /> <br><br> Travel Blog: <br><textarea rows="25" cols="100" id="blog" name="blog"></textarea> < script language="JavaScript1.2" >generate_wysiwyg('blog');</ script > <br><br> Latitude: <br><input type="text" size="7" id="lat" name="lat"></input> <br><br> Longitude: <br><input type="text" size="7" id="lon" name="lon"></input> <br><br> Associated Link: <br><textarea rows="10" cols="100" id="link" name="link"></textarea> < script language="JavaScript1.2" >generate_wysiwyg('link');</ script > <br><br> Marker: <br><input type="text" size="10" id="marker" name="marker"></input> <br><br> <INPUT TYPE="button" VALUE="Submit" onclick='' name="submit" /> </form> < script type="text/javascript" > //populatedropdown(id_of_day_select, id_of_month_select, id_of_year_select) window.onload=function(){ populatedropdown("daydropdown", "monthdropdown", "yeardropdown") } </ script > </BODY> </HTML> [/code] Many thanks - i hope you can see a solution!
  15. i have a post on Javascript help and i cant post a reply....it just says my document contains no data :(
  16. Hello, I am writing a form but am having difficulty getting two javascripts to run together. I can get both of them working on their own but not together (I'm using the latest Firefox browser)! The javascripts are: A wysiwyg text editor A textarea character counter You can see my form here: [url=http://globexposure.net/openwysiwyg/add_blog_form4.html]http://globexposure.net/openwysiwyg/add_blog_form4.html[/url] I tried a second method also (it also doesn't work) which you can see here: [url=http://globexposure.net/openwysiwyg/add_blog_form2.html]http://globexposure.net/openwysiwyg/add_blog_form2.html[/url] Can anyone tell me why the textarea character counter does not work? Many thanks p.s. I posted on a different forum and only got 1 post which said the counter worked but not the WYSIWYG editor (on Safari browser).
  17. Cheers Steveclondon ...the php.ini was what i needed! Just needed to change the following from: ;display_errors = on                to              display_errors = on As you mention this is only worth doing on a test server. As a result i have decided to turn the above option off and write errors to a log file instead: error_log = errors.txt Thanks for your help!
  18. Hello, I have a known Parse Error:... in my script, which displays in the browser of one of my machines but is not visible on my other computer. Where can i turn this feature (display error messages) on/off ? Is this defined in the W.A.M.P build? Thanks Olly
  19. Huggie you're an absolute LEGEND! Thankyou so much ...just one lil error: Parse error: parse error, unexpected '{' in C:\wamp\www\moorings\search.php on line 52
  20. The HTML form: [code] <html> <head> <title>Mooring Facilities Search Form</title> </head> <body> Please select the facilities you would like at a mooring: <form name="myform" action="search.php" method="GET"> <div align="left"><br> <input type="checkbox" name="option[]" value="1"> Electricity<br> <input type="checkbox" name="option[]" value="2"> Shower<br> <input type="checkbox" name="option[]" value="3"> Toilet<br> <input type="checkbox" name="option[]" value="4"> Refuse-bin<br><br><br> <input type="submit" type="Submit"> </div> </form> </body> </html> [/code] and the PHP script: [code] <?php $user="root"; $host="127.0.0.1"; $password=""; $database = "moor_simple"; $connection = mysql_connect($host,$user,$password)       or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection)       or die ("couldn't select the database"); ?> <html> <head> <title>search database for matching records</title> </head> <body> The Search Results are: <?php $sql = "SELECT name FROM moor_facility WHERE id"; if (isset($_GET['option[1]'])(   $sql .= " AND electricity IS NOT NULL"; // I have added spaces in front of each of these values and removed the equals '=' } if (isset($_GET['option'][2]))(   $sql .= " AND toilet IS NOT NULL"; // added a space, removed = } if (isset($_GET['option'][3]))(   $sql .= " AND shower IS NOT NULL"; // added a space, removed = } if (isset($_GET['option'][4]))(   $sql .= " AND bin IS NOT NULL"; // added a space, removed = } echo "$sql<br>\n"; // quoted the echo string and added a newline character $result = mysql_query($sql); echo "$result<br>\n"; // quoted the echo string and added a newline character ?> </body> </html> [/code] Cheers Huggie!
  21. Thanks for your answers Huggie! Unfortunately it still wont display anything. In fact i put a little text in the HTML before your <?php  ?> and this wont display either. However, if i comment out the php then it is clearly displayed at the top of the screen. Do you think this is something todo with why my results wont display? Again many thanks for your time.
  22. Thanks Huggie! Can i just confirm that the following php will work for a mysql table like the following: [table][tr][td] id name     electricity           toilet                      shower               bin 1     a 1               NULL                      NULL                  1 2     b 1               1                            1                        1 3     c 1               NULL                      1                        NULL 4     d NULL                     NULL                        NULL                  1 [/table] sorry the columns don't line up very well - i hope you can make sense of it! [code] $sql = "SELECT name FROM moor_facility WHERE id"; if (isset($_GET['option'][1]))(   $sql .= "AND electricity = IS NOT NULL"; } if (isset($_GET['option'][2]))(   $sql .= "AND shower = IS NOT NULL"; } if (isset($_GET['option'][3]))(   $sql .= "AND toilet = IS NOT NULL"; } if (isset($_GET['option'][4]))(   $sql .= "AND bin = IS NOT NULL"; } echo $sql <br>; $result = mysql_query($sql); echo $result <br>; [/code] ...on another note the "echo $..." doesn't display anything - which i guess indicates that the SQL is wrong? Cheers
  23. Being new to PHP i am often not sure what search criteria to use - out of interest what did you use to find the above thread? I have modified my form to take advantage of an Array as suggested by Onlyican : [code] <form name="myform" action="search.php" method="GET"> <div align="left"><br> <input type="checkbox" name="option[]" value="1"> Electricity<br> <input type="checkbox" name="option[]" value="2"> Shower<br> <input type="checkbox" name="option[]" value="3"> Toilet<br> <input type="checkbox" name="option[]" value="4"> Refuse-bin<br> <br> <input type="submit" type="Submit"> </div> </form> [/code] Having had a look at the following thread : http://www.phpfreaks.com/forums/index.php/topic,107961.0.html  the IF Statement posted by HuggieBear looks the most logical to me. [code] <?php $user="root"; $host="127.0.0.1"; $password=""; $database = "moor_simple"; $connection = mysql_connect($host,$user,$password)       or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection)       or die ("couldn't select the database"); $sql = "SELECT name FROM moor_facility WHERE id"; if (isset($_GET['option[1]']))(   $sql .= "AND electricity = IS NOT NULL"; } if (isset($_GET['option[2]']))(   $sql .= "AND shower = IS NOT NULL"; } if (isset($_GET['option[3]']))(   $sql .= "AND toilet = IS NOT NULL"; } if (isset($_GET['option[4]']))(   $sql .= "AND bin = IS NOT NULL"; } $result = mysql_query($sql); echo $result <br>; ?> [/code] As yet it doesn't work, however, i think it might be to do with my use of IS NOT NULL. I have read that checkboxes that are not checked do not get put in the array, which seems to complicate matters. Have i understood the correct syntax ? Thankyou for your support
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.