Jump to content

leest

Members
  • Posts

    65
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

leest's Achievements

Member

Member (2/5)

0

Reputation

  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; }
×
×
  • 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.