Jump to content

imdead

Members
  • Posts

    116
  • Joined

  • Last visited

Everything posted by imdead

  1. Hey i created a page to add/edit/remove job's i've posted. I got everything running smoothly except for the edit function? any help would be really appreciated <?php $action = $_GET["action"]; if ($action == "delete"){ $delid = $_GET['delid']; $query = "DELETE FROM jobs WHERE id=".$delid." LIMIT 1"; $sql = mysql_query($query); echo("Job succesfully deleted! [ <a href='add_jobs.php'>Back</a> ]"); } if ($action == "edit"){ print("<strong>Editing a Job:</strong>"); $editid = $_GET['editid']; $sql = mysql_query("SELECT * FROM jobs WHERE id = ".$editid." ") or die ('Error: '.mysql_error ()); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $job_title = $row['job_title']; $job_description = $row['job_description']; $job_type = $row['job_type']; $job_area = $row['job_area']; $query2 = "UPDATE jobs SET (job_title, job_description, job_type, job_area, hot_job) VALUES ('$job_title', '$job_description', '$job_type', '$job_area', '$hot') WHERE id=$id"; echo("<form name='add' method='post' action='?action=edit'>"); echo("<input type='hidden' name='?action=edit'>"); echo("<table class=main cellspacing=0 cellpadding=5 width=50%>"); echo("<tr><td>Job Title: </td><td align='right'><input type='text' size=50 name='job_title' value='$job_title'></td></tr>"); echo("<tr><td>Job Description: </td><td align='right'><textarea size=50 name='job_description'>$job_description</textarea></td></tr>"); echo("<tr><td>Job Type: </td><td align='center'><select name='job_type'><option>Permanent</option><option>Locum or Contract</option></SELECT></td></tr>"); echo("<tr><td>Hot Job? </td><td align='center'>Yes <input type='radio' name='hot' value='Yes'> No <input type='radio' name='hot' value='no'></td></tr>"); echo("<tr><td>Job Area: </td><td align='center'><select name='job_area'><option>East Anglia</option><option>London / South East</option><option>Midlands</option><option>North West</option><option>Northern Ireland</option><option>Scotland</option><option>South</option><option>South West</option><option>Southern Ireland</option><option>Wales</option><option>Yorkshire / North East</option></SELECT></td></tr>"); echo("<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>"); echo("</table>"); } } if ($action == "add"){ $add = $_POST['add']; $job_title = $_POST['job_title']; $job_description = $_POST['job_description']; $job_type = $_POST['job_type']; $job_area = $_POST['job_area']; $hot = $_POST['hot']; $id = mysql_insert_id(); $query = "INSERT INTO jobs (id, job_title, job_description, job_type, job_area, hot_job) VALUES ('$id', '$job_title', '$job_description', '$job_type', '$job_area', '$hot')"; $sql = mysql_query($query) or die (mysql_error()); } print("<strong>Add A New Job!</strong>"); print("<br />"); print("<br />"); echo("<form name='add' method='post' action='?action=add'>"); echo("<input type='hidden' name='?action=add'>"); echo("<table class=main cellspacing=0 cellpadding=5 width=50%>"); echo("<tr><td>Job Title: </td><td align='right'><input type='text' size=50 name='job_title'></td></tr>"); echo("<tr><td>Job Description: </td><td align='right'><textarea size=50 name='job_description'></textarea></td></tr>"); echo("<tr><td>Job Type: </td><td align='center'><select name='job_type'><option>Permanent</option><option>Locum or Contract</option></SELECT></td></tr>"); echo("<tr><td>Hot Job? </td><td align='center'>Yes <input type='radio' name='hot' value='Yes'> No <input type='radio' name='hot' value='no' checked></td></tr>"); echo("<tr><td>Job Area: </td><td align='center'><select name='job_area'><option>East Anglia</option><option>London / South East</option><option>Midlands</option><option>North West</option><option>Northern Ireland</option><option>Scotland</option><option>South</option><option>South West</option><option>Southern Ireland</option><option>Wales</option><option>Yorkshire / North East</option></SELECT></td></tr>"); echo("<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>"); echo("</table>"); if($success == TRUE) { print("<strong>Success!</strong>"); } echo("<br>"); echo("</form>"); print("<strong>Existing Jobs:</strong>"); print("<br />"); print("<br />"); echo("<table class=main cellspacing=0 cellpadding=5>"); echo("<td>ID:</td><td>Title:</td><td>Description:</td><td>Type:</td><td>Area:</td><td>Edit (DO NOT USE YET):</td><td>Delete:</td>"); $query = "SELECT * FROM jobs WHERE 1=1"; $sql = mysql_query($query); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $job_title = $row['job_title']; $job_description = $row['job_description']; $job_type = $row['job_type']; $job_area = $row['job_area']; $position=18; $job_description2 = substr($job_description, 0, $position); echo("<tr><td><strong>$id</strong></td><td><strong>$job_title</strong></td><td><strong>$job_description2...</strong></td><td><strong>$job_type</strong></td><td><strong>$job_area</strong></td><td><a href='add_jobs.php?action=edit&editid=$id'>Edit</a></td><td><a href='add_jobs.php?action=delete&delid=$id'>Delete</a></td></tr>"); } ?>
  2. You forgot the $ on num <?php $num = 5; $testing = $num % 2; echo $testing; ?>
  3. Take a look at tbsource you can find the latest version's over at tbdev.net
  4. mysql_query (" INSERT INTO affiliates (Company , Contact , domain , email , Tel , Fax , Cell , Address , Postal , Referrer , Confirm , Type , ref2 , ref3 , ref4 , aff_id) VALUES ( '$company', '$fname', '$domain', '$email', '$tel', '$fax', '$cell', '$address', '$postal', '$userid', '0', '$type', '$aff', '$aff1', '$aff2', '$aff3', 'affid')") or die(mysql_error());
  5. i just use // Returns the current time in GMT in MySQL compatible format. function get_date_time($timestamp = 0) { if ($timestamp) return date("Y-m-d H:i:s", $timestamp); else return gmdate("Y-m-d H:i:s"); } Then when inserting dates just call get_date_time() so i use datetime in phpmyadmin for the table
  6. yeah that would work.
  7. dead site
  8. Looks Pretty Good To Me Mate
  9. You should block this directory: http://www.babble-net.com/PostSystem_Includes/
  10. D/w Got It Working, Thanks craygo
  11. Hmm, I Can't Get This Method To Work?
  12. Hey Guys, I've Tried Many Times But I Cant Get It Right. How Would I Make A Script That Shows How Many Queries Where Executed On The Page Loaded
  13. <td width="627" background="images/top_main_blue_bkg.jpg" class="main_nav_blue"><? include('common/blue_nav.php') ?></td> Missing A ; <td width="627" background="images/top_main_blue_bkg.jpg" class="main_nav_blue"><? include('common/blue_nav.php'); ?></td>
  14. <? if($cmd=="delete") { $id = $_GET['id']; $sql = "DELETE FROM news WHERE id=$id"; $result = mysql_query($sql); echo "Row deleted!"; } ?>
  15. <?php $page = $_GET['page']; switch ($page) { default: include "/homepage/news.php"; break; case 'login': include '/homepage/login.php'; break; case 'signup': include '/homepage/signup.php'; break; } ?>
  16. http://scott.projecth4x0r.com/beta3/forum.php?name="><marquee><h1>Kevin ]http://scott.projecth4x0r.com/beta3/forum.php?name[] ]http://scott.projecth4x0r.com/beta3/member.php?username[] ]http://scott.projecth4x0r.com/beta3/message.php?id[] http://scott.projecth4x0r.com/beta3/message.php?id=%22%3E
  17. mysql_query("update `players` set `message`='$message' where `ownerid` = '$stat[id]'");
  18. Fixed Thanks
  19. Thats Not Displaying Anything?
  20. Don't Worry I Fixed Them Links But Now, <?php $thumbs = scandir('image'); foreach($thumbs as $thumb) { if ($thumb[0]=='.') continue; if ($thumb[0]=='index.html') continue; echo '<img src="image/', $thumb, '"/ width="200" height="200">'; echo '<a href="image/', $thumb, '"/>View Normal Size</a>'; } ?> I Can't Make It Skip The Index.html file
  21. Hey Peoples , I Made This For My Image Gallery <?php $thumbs = scandir('image'); foreach($thumbs as $thumb) { if(substr($thumb, 0, 1) !== '.') echo '<img src="image/', $thumb, '"/ width="200" height="200">'; echo '<a href="image/', $thumb, '"/>View Normal Size</a>'; } ?> And It's Displaying It How It Should Execpt I Get Two Extra Links At The Front That Link To The Image Dir And One Links To The Main Root. What Can You Guys Do?
  22. Thanks Guys It's All Fixed Also vardump gave me // string(1) "1"
  23. yes session start is called in the header.php if i use a where <?php if($_SESSION['username']){ $sql = mysql_query("SELECT * FROM users WHERE username={$_SESSION['username']}") or die (mysql_error()); if (mysql_num_rows($sql) == 1){ $row = mysql_fetch_assoc($sql); $userlevel = $row['userlevel']; if ($userlevel == '1'){ echo"<a href='admin.php'>Admin Panel</a> // "; } else { echo "Error: not loged in"; } }} else { echo "session not registered"; } ?> I Get Unknown column 'kevski' in 'where clause'
  24. That Is The Entire Code, It's The Footer.php
  25. When I'm Not Logged In I Get session not registered When I Am Logged In As Both, User And Admin I Still Get Nothing On Eaither
×
×
  • 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.