Jump to content

leest

Members
  • Posts

    65
  • Joined

  • Last visited

    Never

Everything posted by leest

  1. Thanks worked perfectly,
  2. OK, thought i had solved this problem but i hadn't. Anyway the insert query works fine, however i need to put the information in to the mysql database contained in "". This php code works fine: $query = "INSERT INTO dashboard_component (module_name, module_parameters, site_id, column_number, position) VALUES ('text', 'Welcome,((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))', '$site_id', 0, 1)"; mysql_query($query) or die(mysql_error()); now when i re-write the code like this to try and enter the data in to the table within "", it fails, when the page is called, it just returns a blank page. ('text', '"Welcome,((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))"', '$site_id', 0, 1)"; Any suggestions will be much appreciated, thanks
  3. ok, Thanks for that, another stupid mistake, i had a mismatch in column numbers all fixed now thanks, but now i have another problem i need this part of the insert script to have " " around it like so: $query = "INSERT INTO dashboard_component (dashboard_component_id, module_name, module_parameters, site_id, column_number, position) VALUES (13, 'text', 'Welcome', '"((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))"', '$site_id', 0, 1)"; mysql_query($query) or die('Error, insert query failed'); however when i write it like this it just gets binned and shows a blank page, when i take them out it works fine. I need to add the "" so the info is formated for when it is read from the database table and then displays the username. Does any body have any ideas or suggestions
  4. Cheers i'll give it a try
  5. I have some info i am trying to add to my database but it just keeps returning the following error: Error insert query failed. I have tried writing this query many different ways but fet the same answer, any suggestions would be appreciated. Thanks $query = "INSERT INTO dashboard_component (dashboard_component_id, module_name, module_parameters, site_id, column_number, position) VALUES (13, 'text', 'Welcome', '((USERNAME))!\r\nDate: ((DATE))\r\nTime: ((TIME))', '$site_id', 0, 1)"; mysql_query($query) or die('Error, insert query failed');
  6. ok, i am a bit of an idiot and when i looked at it properly it made sense, the only thing is when i upload it to my server it didn't work, the drop down list worked but when i selected yes the other field didn't work. I know i have javascript running on my pc and so not sure why it would not work, could it be something on the server side???
  7. HI thanks for the reply and sorry in the delay but i have been away. Ok i am not to experienecd with javascript, the field that i want to make only visible if the value in the drop down list is the last field in my form, i have about ten form fields. so do i change the text1 to represent the field value. Cheers
  8. Ok i am just after some advice, I have a registration form and want to make a a field only avaliable if the user selects yes from a drop down list. I also want to make this field a required field. I think i know how to achieve the last part but was just wondering if any body knew if having a form field display as a result of a drop down menu was possible.
  9. I have done that but i am still getting the same problem, the first query works fine, but then if you login the page shows all results
  10. thanks for the reply, well once someone has logged in it runs a login process page and then comes straight back to this same page, i do have session start on the process page but maybe that is where my problem lies???
  11. i have a job board site where the user can choose jobs by location and category, which are selected by drop down menus. the selected information is then sent via a GET form. on the results page i get the results fine and display the correct job vacancies. On the same page as the results page i have a login form, now this is where my problems start, as soon as a user logs in all the results are returned. Now i have tried to register the Get vars as sessions and then using the isset command but it doesn't seem to work. below is a copy of the code and any guidance would be appreciated. session_start(); if(isset($_GET['category'],$_GET['location'] )) { $category = $_GET["category"] ; $location = $_GET["location"] ; $_SESSION['category']= $_GET['category']; $_SESSION['location']= $_GET['location']; } $category = $_SESSION['category']; $location = $_SESSION['location'];
  12. Ok, Yes i have manually set id to 1 for testing purposes, test2 was an error it wasn't meant to be a variable just an echo to see how far the script got, so that was fixed ages ago. I have checked the config file and that works fine, what i am getting now is an error failed query that is generated by the query it's self and i don't know why. I have included the database structure below. `id` int(11) NOT NULL auto_increment, `name` varchar(30) NOT NULL, `type` varchar(30) NOT NULL, `size` int(11) NOT NULL, `content` mediumblob NOT NULL, `site_id` varchar(10) NOT NULL, PRIMARY KEY (`id`) below is the script i am now running and the script that generates the error, query failed message. include 'System/connections/db3.php'; $id = 1; $query = "SELECT name, type, size, content " . "FROM upload WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-length: $size"); header("Content-type: $type"); header("Content-Disposition: attachment; filename=$name"); echo $content; exit;
  13. ok i have stripped the code down and took away the query and bottom half of the code so just the variable and echo statements where left and the variable echoed, however as soon as i added the query part the variable stopped echoing. but it doesn't makes sense
  14. Thanks for the reply, because i am calling the download page direct from the browser i manually set the variable as it is of course not being sent one and so i thought i would remove the if statement to see if that made any difference. if(isset($_GET['id'])) { now when i run the script i get no thing at all,
  15. I have a script that i have previously had working but i have swapped servers and changed some pages and now i can not seem to get this to work, so any ideas would be appreciated. The line to pass the id is: <img src="http://My website/image/download.php?id= echo $site_id the site id is generated from a database query which works ok it then calls this code, i have preset the id and added a couple of echo's to see how far the code gets, but it only displays the first test and doesn't get to the echo id or test2. echo "test"; if(isset($_GET['id'])) { include 'config.php'; $id = 1; echo "$id"; echo "$test2"; $query = "SELECT name, type, size, content " . "FROM upload WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-length: $size"); header("Content-type: $type"); header("Content-Disposition: attachment; filename=$name"); echo $content; exit; }
  16. leest

    mysql & code

    i'll give it a go thanks
  17. I had a similar problem a little while ago, but rather than having a long and complicated join i added a sub query to extract the clients details.
  18. leest

    mysql & code

    Ok, I posted a code earlier and finally got it orking, the problem now is i got a it ambitious, and found this tutorial script I have played around with it and changed a few things but when i run it, it returns a blank page. with no information i have echo checked the databse etc and all is working perfec, but i think i am losing it when it starts the geo code part. Does any body have any ideas??? define("MAPS_HOST", "maps.google.com"); define("KEY", "ABQIAAAAVwap6S1SY6Dy31wrLpcgMxRBjdw_Uqb4fDsWbJeQLrPjg6_7hxRMhG5Acz3cLO1a6difeC85xaXsMA"); // Select all the rows in the markers table $query = "SELECT * FROM joborder "; $result = mysql_query($query); if (!$result) { die("Invalid query: " . mysql_error()); } // Initialize delay in geocode speed $delay = 0; $base_url = "http://" . MAPS_HOST . "/maps/geo?output=xml" . "&key=" . KEY; // Iterate through the rows, geocoding each address while ($row = @mysql_fetch_assoc($result)) { $geocode_pending = true; while ($geocode_pending) { $state = $row["state"]; $joborder_id = $row["joborder_id"]; $request_url = $base_url . "&q=" . urlencode($state); $xml = simplexml_load_file($request_url) or die("url not loading"); $status = $xml->Response->Status->code; if (strcmp($status, "200") == 0) { // Successful geocode $geocode_pending = false; $coordinates = $xml->Response->Placemark->Point->coordinates; $coordinatesSplit = split(",", $coordinates); // Format: Longitude, Latitude, Altitude $lat = $coordinatesSplit[1]; $lng = $coordinatesSplit[0]; $query = sprintf("UPDATE joborder " . " SET lat = '%s', lng = '%s' " . " WHERE joborder_id = '%s' LIMIT 1;", mysql_real_escape_string($lat), mysql_real_escape_string($lng), mysql_real_escape_string($joborder_id)); $update_result = mysql_query($query); echo $row['joborder_id']; if (!$update_result) { die("Invalid query: " . mysql_error()); } } else if (strcmp($status, "620") == 0) { // sent geocodes too fast $delay += 100000; } else { // failure to geocode $geocode_pending = false; echo "Address " . $state . " failed to geocoded. "; echo "Received status " . $status . "\n"; } usleep($delay); } }
  19. Cheers, that works, i guess i will go have a look for the udf, cheers guys.
  20. Ok, well i guess that could be a whole lot easier, any idea where i would find it???
  21. Ok, I have a piece of code i have modified to take results from a database and plot them on to a google map, now the code works well, however it only display one result and doesn't seem to loopthrough the xml code, i am quite new with this type of coding and so a litle confused any pointers would be much appreciated. $sql = "SELECT * FROM joborder "; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $title = $row['title']; $city = $row['city']; $state = $row['state']; } {"locations": {"location":[ {"id": " echo "$title"; ", "city": " echo "$title"; ", "location": " echo "$city"; ", "address": " echo "$state"; ", "date": "May 2nd, 2007" } ] }}
  22. The code for v2 is below, having worked out that they haven't applied it then tries to establish if they have already registered with the company advertising the job. include 'connections/db1.php'; //***** Gets Candidate ID from candidate table *************// $username = $_SESSION['username']; $SID = $_SESSION['SID']; $query = "SELECT * FROM candidate WHERE username ='$username' AND site_id ='$SID'"; $result = mysql_query($query) or die(mysql_error()); $num2 = mysql_num_rows($result); $_SESSION['num2']="$num2";
  23. This is the script from v1, it queries the candidates database to see if they are already in the database with that company, then gets their id if they are and then sees if they have applied for the job to which they are applying, if they have num 1 = will equal 1: include 'connections/db1.php'; //***** Gets Candidate ID from candidate table *************// $username = $_SESSION['username']; $SID = $_SESSION['SID']; $query = "SELECT * FROM candidate WHERE username ='$username' AND site_id ='$SID'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); $candidate_id = $row['candidate_id']; $_SESSION['candidate_id']="$candidate_id"; $JOID = $_SESSION['JOID']; $candidate_id = $_SESSION['candidate_id']; $query = "SELECT * FROM candidate_joborder WHERE candidate_id ='$candidate_id' AND joborder_id ='$JOID'"; $result = mysql_query($query)or die(mysql_error()); $num1 = mysql_num_rows($result); $_SESSION['num1']="$num1";
  24. ok, the problem only occurs when num 1 and num 2 = 0, as long as num 1 or either num 2 = 1 then the script works perfectly, below are the returns for num 1 - 1 done includeing v1.php... done includeing v2.php... done username: leest num1: 1 num2: 1 test 1 when i choose an option to lead me to num2 = 0 but num 1 = 1 i get the following done includeing v1.php... done includeing v2.php... done username: leest num1: 1 num2: 1 test 1 so the problem is my way of thinking, as it only fails when num 1 and num 2 both = 0, so i need to add more options i think done includeing v1.php... done includeing v2.php... done username: leest num1: 1 num2: 1 test 1
  25. ok, I think must be something to do with the sessions, first of i got the following message: "Notice: A session had already been started - ignoring session_start() in /home/sites/harrier-recruitment.com/public_html/search/database_check.php on line 7 done includeing v1.php... " Then i removed the start session on line seven and this is all that was returned: done includeing v1.php... I think i will have to go back to the drawing board and start again as i may have made it to difficult as the current structure is as: Page 1 - calls the Include (if else ) the if else page then calls (v1.php + v2.php) and some where along the lines i think there must be a problem with the sessions as they are all registered on page one and then passed through each page, if that makes sense
×
×
  • 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.