Jump to content

leest

Members
  • Posts

    65
  • Joined

  • Last visited

    Never

Everything posted by leest

  1. OK, thanks for that, now i get the following message: "Notice: A session had already been started - ignoring session_start() in /home/sites/sbg.com/public_html/search/database_check.php on line 7" the only place i can see a session is on the page that calls for the if else wihich is contained in it's own page, if that makes sense,
  2. OK, i moved the start() to the begining of the script made sure that the closing bracket was a }, and it's still doing the same thing, so i will look at the second include file just to make sure it isn't that.
  3. ok i'll give it a go, sorry the closing bracket was where i copied and paste the original code,
  4. thanks for the reply, The whole page is pasted below, the two include pages refer to the database queries that generate num1 and num 2 and they are the parts that are working fine, well i think they are if num 1 = 1 then it displays test1 if num2 = 1 it displays test 2, the problem seems to be when num 2 = 0, though the v2 page that is included is just a page that runs one query to get a value from a database and then uses that value to run a second query and generate the result for num 2. include 'connections/db1.php'; include 'v1.php'; include 'v2.php'; session_start(); $username = $_SESSION['username']; $num1 = $_SESSION['num1']; $num2 = $_SESSION['num2']; if ($num1 > 0) { echo "test 1";} elseif ($num2 <1) { echo "test 2";} else {echo "Database is empty"
  5. OK, that was a bit short lived, what i have just discovered is that whilst it works fine for the if and else if parts, if both num 1 & num 2 return a value = 0 then i get the same effects as before. As for the error reporting i think it is on as i had an error earlier telling me when i had made a mistake with my database connection script, how can i check this? thanks
  6. Thanks I changed that closing bracket and it worked perfectly, lee
  7. Ok, I have simplified my if else/ else if statement, however when i add an elseif block the code stops working. No errors are produced just the page stops displaying any contents at the point where the if else file is called from another page. Any guidance would be appreciated: Thanks if ($num1 > 0) { echo "test 1";} elseif ($num2 <1) { echo "test 2";} else {echo "Database is empty"
  8. OK, i hav had this problem for a while i try and fix it then leave it and come back to later on when i have some spare time, but i just keep confusing myself with the more and more tutorials and things i read. Below is my if else script, that is for a job site that i am putting together, The first part checks to see if a candidate has already applied for this position previously, first it gets the candidate id if there is one and then checks it against the database to see if it already exsists for that job. This all works perectly and to be honest some body helped me achieve the last part with the if num bit. now in the else part i know that the candidate has already applied for that job and so i wanted to check to see if they have already applied to this company by checking the site id. If they have i want to just add them to this job, but if they haven't i want to insert them in to the company and for this job. now the problem i am having is that the first query of this part also uses the if num and i do not understand how to format this as it will not allow me to add another else or if i try else if, it doesn't work at all. Any guidance would be appreciated. Thanks lee //*** Checks the database to see if the Candidate already exsist in this companies system *****// include '../System/connections/db1.php'; $username = $_SESSION['username']; $SID = $_SESSION['SID']; //***** Gets Candidate ID from candidate table *************// $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']; $candidate_id = $row['candidate_id']; $JOID = $_SESSION['JOID']; $query = "SELECT * FROM candidate_joborder WHERE candidate_id ='$candidate_id' AND joborder_id = '$JOID'"; $result = mysql_query($query)or die(mysql_error()); $num = mysql_num_rows($result); //will be either 0 if its not there or more than zero if it is if ($num > 0){ $CJID = $_SESSION['CJID']; echo "You have already Applied for this Vacancy, to monitor the status of this Application please visit the My Applications page of your account, the reference number for this vacancy is: $CJID";} else{ $query = "SELECT username FROM candidate WHERE username ='$username' AND site_id ='$SID'"; $result = mysql_query($query)or die(mysql_error()); $num = mysql_num_rows($result); //will be either 0 if its not there or more than zero if it is if($num > 0) { //checks for an entry }
  9. HI, Thanks, I have just managed to fix it, i thought that i had previously had it working, but today it just went mad. BUt thanks for the reply lee
  10. Hi the following works fine on my current website and returns the information from the databse with the format that it was added with. However i am converting my website to work on php5 and it's now not working, any guidance would be appreciated. echo nl2br($row['description']); Thanks
  11. ok, i will make sure it is but i believe it is as i had an error a day or so ago. this is all the code there is other than calling the session at the begining of the script, the only thing changed on the script is the database name, the id is simply an auto incemented number, which is so simple as i am only echoing the one result, but it just simply doesn't display any of the page until i remove this code.
  12. No I changed the details of my script
  13. No totally I agree with what your saying, Anyway i tried changing the session but it made no difference though i wasn't sure it would as i had tried the query earlier with out a session and had the same effect and then if i remove the whole query the page shows so it is without doubt in that section of code, but i just can't see it.
  14. Thanks you, I don't know i have always just done it that way, but i will give it a go and hopefully it will work cheers lee
  15. Hi i am working through my website and trying to convert it to work with php5, Largely most of my site works ok and every now and then i hit some thing that gives me trouble. Largley i tend to manage to get it working, below i have a database query that works perfect in php 4 but in php 5, it doesn't work at all and when you click on to the page it is just blank. I have tried other queries that do work, but can not understand why this one doesn't, any info would be gratefully recieved. Thanks $_SESSION['id']="$id"; include 'connections/db.php'; $sql = "SELECT * FROM database WHERE id like '%$id%'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $title = $row['title']; $site_id = $row['site_id']; $jobject_id = $row['object_id']; echo $row['title'];
  16. HI, Thanks for that it worked perfectly
  17. Thanks Iwill give it a try Leest
  18. Not sure why but when i post the srcipt on here it removes the php tag from between the two = signs and from the end of the script.
  19. OK this code works fine in php4 and returns an image from a mysql database by passing the site_id to a download script through this link. However in php 5 it doesn't work. In the script i have used the short tag for php ie, just the less than and a question mark, when i add php to the tag, it stops the code from working.
  20. Hi, I have a link on my website that calls a download script and downloads an image in to my webpage. This works perfectly in php 4. I am currently converting my site from php4 to php 5 to allow me to use another hosting company and i am having trouble with passing information in the link to the downloads page. If i use this script un changed it doesn't display any errors just stops displaying the page at the point of the script. the script is: <img src="http://www.websitename/image_manager/download.php?id= [code=php:0]=$site_id [/code] the problem occurs when i try to change from the short method of writting the php tag to the normal version, with the short version the = sign changes to read along with the php tag and on the longer version it doesn't when the script is then run it displays the following error: "Parse error: syntax error, unexpected '=' in /public_html/search/search_results.php on line 428" if i remove the equals sign then it displays the page correctly but does not download the image. Any help or advice would be appreciated. Thanks
  21. leest

    If else error

    Thank you, I will make the changes and hopefully it will solve my problems. Thanks
  22. leest

    If else error

    I have an if else query i have worked through a tutorial to try and get the structure correct, however when i run the test script i get errors. I know the query works but when placed in the if else statement i get an error on line 22 which is $candidate_id = $_GET["candidate_id"]; the whole script and error message are shown below. Any guidance would be appreciated, thanks. include '../folder1/folder2/db1.php'; $username = $_SESSION['username']; $SID = $_SESSION['SID']; $query = "SELECT username FROM candidate WHERE username ='$username' AND site_id ='$SID'"; $result = mysql_query($query)or die(mysql_error()); $num = mysql_num_rows($result); //will be either 0 if its not there or more than zero if it is if($num > 0) { //checks for an entry //***** Gets Candidate ID from candidate table *************// $username = $_SESSION['username']; $query = "SELECT * FROM candidate WHERE username ='$username'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); $candidate_id = $row['candidate_id']; } elseif ( $candidate_id = $_GET["candidate_id"]; $query = "SELECT username FROM candidate_joborder WHERE username ='$username' AND candidate_id ='$candidate_id'"; $result = mysql_query($query)or die(mysql_error()); $num = mysql_num_rows($result); //will be either 0 if its not there or more than zero if it is if($num > 0) { //checks for an entry// ) else echo "test"; The error "Parse error: syntax error, unexpected ';' in /public_html/search/test.php on line 22"
  23. Thank you for your replies and the links, it does look a bit more involved than i realised so i will have a look at the links and see if i can work it out. Thanks for your advice. Lee
  24. Hi, I have never used ajax or Js before and so have no great understanding, i have tried to look for a few tutorials but haven't had much luck in finding any that help. On my website i have some results that are returned from a query, what i am trying to achieve is that when the mouse is run over the id result a mouse over effect occurs and display more information in the pop up window. I have some script that i have pasted below that seems to work to some degree, how ever it doesn't pass the id to the test.php page. Any suggestions or a point in the right direction would be appreciated. Thanks Lee <a href="#" onmouseover="ajax_showTooltip('demo-pages/test.php?id= $id ',this);return false" onmouseout="ajax_hideTooltip()"> echo "$id";
×
×
  • 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.