Jump to content

sdm

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sdm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a script that displays jobs available on a website, I want to be able to enable a .pdf file to be uploaded and made available as a viewable link as part of the description of a listing. Is this straightforward to do? Any pointers to how I can achieve this is appreciated, code snippets at PHP freaks etc. Thanks for your time. SDM
  2. Thanks for the reply. I'm quite new to this, where do I add the code you have shown me. Can I have a delete button next to the 'Edit' button? Thanks, SDM
  3. Hi all, I have now managed to get the script to display all records, but I can't get it to delete any records. The edit works fine but can someone show me how to add a delete button as well so that I can delete the one chosen with the current id please. This is the code I have so far: <? //include our database connection file include('dbconnect.php'); if($_POST['action']=="doedit"){ //grab the post vars $title = $_POST['title']; $id = $_POST['id']; $sector = $_POST['sector']; $location = $_POST['location']; $salary = $_POST['salary']; $details = $_POST['details']; //update the database $news = "UPDATE news SET title='$title', sector='$sector', location='$location', salary='$salary', details='$details' WHERE id = $id"; $editnews = mysql_query($news); echo("news edited."); } //print the news titles, with links to the edit page $getnews = mysql_query("select * from news ORDER BY id DESC"); while($r=mysql_fetch_array($getnews)){ extract($r); echo("> <a href=editjobs.php?id=$id&action=edit>$title</a><br />"); } echo("<br /><br />"); //if we are editing a news item, print the following.. if($_GET['action']=="edit"){ $id = $_GET['id']; $getnews = mysql_query("select * from news WHERE id=$id"); while($r=mysql_fetch_array($getnews)){ extract($r); //our form ?> <form action="editjobs.php" method="POST"> <input type="text" name="title" value="<? echo($title); ?>" /><br /> <input type="text" name="sector" value="<? echo($sector); ?>" /><br /> <input type="text" name="location" value="<? echo($location); ?>" /><br /> <input type="text" name="salary" value="<? echo($salary); ?>" /><br /> <textarea name="details" rows="6" cols="50"><? echo($details); ?></textarea> <input type="submit" value="edit" /> <input type="hidden" name="id" value="<? echo($id); ?>" /> <input type="hidden" name="action" value="doedit" /> </form> <? } } ?>
  4. I'm trying to get the database to return all the records and format them into table cells, this only outputs the first one. How do I format this so that it puts all sets into table before stopping the loop please. This is the code I currently have: <? include("dbconnect.php"); $getnews = mysql_query("select * from news ORDER BY id DESC"); while($r=mysql_fetch_array($getnews)){ extract($r); /* echo("<b>$title on $date<BR><BR>$sector<BR><BR>$location<BR><BR>$salary<BR><BR>$details</b><BR><BR>"); */ } ?> <div align="center"> <table width="643" border="1" cellspacing="1" cellpadding="1"> <tr> <td width="153"><?php print $title;?></td> <td width="198"><?php print $sector;?></td> <td width="122"><?php print $location;?></td> <td width="147"><?php print $salary?></td> </tr> <tr> <td>Description</td> <td colspan="3"><?php print $details;?></td> </tr> </table> </div> Thanks for your time. SDM
  5. Thanks for your assistance, the site in question has been altered and is now working correctly. SDM
  6. I have a site which I built sometime ago using PHP, it stopped working so I asked my host what the problem was. This was their response: "In this case we would like to let you know that several months ago the configuration on the servers was changed as php default setting was to have safe_mode enabled, it appears that your site has not registered the variables you are using so is conflicting with the safe_mode setting within php. It should also be noted that in future releases of php it is not possible to have it turned off. It is pretty straight forward to register the variables in the script, best thing to do is just search in google.com ......" I can't seem to find a good answer in Google, could someone help me out please. Thanks, SDM
×
×
  • 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.